Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * filecheck.h
4 *
5 * Online file check.
6 *
7 * Copyright (C) 2016 SuSE. All rights reserved.
8 */
9
10
11#ifndef FILECHECK_H
12#define FILECHECK_H
13
14#include <linux/types.h>
15#include <linux/list.h>
16
17
18/* File check errno */
19enum {
20 OCFS2_FILECHECK_ERR_SUCCESS = 0, /* Success */
21 OCFS2_FILECHECK_ERR_FAILED = 1000, /* Other failure */
22 OCFS2_FILECHECK_ERR_INPROGRESS, /* In progress */
23 OCFS2_FILECHECK_ERR_READONLY, /* Read only */
24 OCFS2_FILECHECK_ERR_INJBD, /* Buffer in jbd */
25 OCFS2_FILECHECK_ERR_INVALIDINO, /* Invalid ino */
26 OCFS2_FILECHECK_ERR_BLOCKECC, /* Block ecc */
27 OCFS2_FILECHECK_ERR_BLOCKNO, /* Block number */
28 OCFS2_FILECHECK_ERR_VALIDFLAG, /* Inode valid flag */
29 OCFS2_FILECHECK_ERR_GENERATION, /* Inode generation */
30 OCFS2_FILECHECK_ERR_UNSUPPORTED /* Unsupported */
31};
32
33#define OCFS2_FILECHECK_ERR_START OCFS2_FILECHECK_ERR_FAILED
34#define OCFS2_FILECHECK_ERR_END OCFS2_FILECHECK_ERR_UNSUPPORTED
35
36struct ocfs2_filecheck {
37 struct list_head fc_head; /* File check entry list head */
38 spinlock_t fc_lock;
39 unsigned int fc_max; /* Maximum number of entry in list */
40 unsigned int fc_size; /* Current entry count in list */
41 unsigned int fc_done; /* Finished entry count in list */
42};
43
44#define OCFS2_FILECHECK_MAXSIZE 100
45#define OCFS2_FILECHECK_MINSIZE 10
46
47/* File check operation type */
48enum {
49 OCFS2_FILECHECK_TYPE_CHK = 0, /* Check a file(inode) */
50 OCFS2_FILECHECK_TYPE_FIX, /* Fix a file(inode) */
51 OCFS2_FILECHECK_TYPE_SET = 100 /* Set entry list maximum size */
52};
53
54struct ocfs2_filecheck_sysfs_entry { /* sysfs entry per partition */
55 struct kobject fs_kobj;
56 struct completion fs_kobj_unregister;
57 struct ocfs2_filecheck *fs_fcheck;
58};
59
60
61int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
62void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
63
64#endif /* FILECHECK_H */
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * filecheck.h
5 *
6 * Online file check.
7 *
8 * Copyright (C) 2016 SuSE. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation, version 2.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19
20
21#ifndef FILECHECK_H
22#define FILECHECK_H
23
24#include <linux/types.h>
25#include <linux/list.h>
26
27
28/* File check errno */
29enum {
30 OCFS2_FILECHECK_ERR_SUCCESS = 0, /* Success */
31 OCFS2_FILECHECK_ERR_FAILED = 1000, /* Other failure */
32 OCFS2_FILECHECK_ERR_INPROGRESS, /* In progress */
33 OCFS2_FILECHECK_ERR_READONLY, /* Read only */
34 OCFS2_FILECHECK_ERR_INJBD, /* Buffer in jbd */
35 OCFS2_FILECHECK_ERR_INVALIDINO, /* Invalid ino */
36 OCFS2_FILECHECK_ERR_BLOCKECC, /* Block ecc */
37 OCFS2_FILECHECK_ERR_BLOCKNO, /* Block number */
38 OCFS2_FILECHECK_ERR_VALIDFLAG, /* Inode valid flag */
39 OCFS2_FILECHECK_ERR_GENERATION, /* Inode generation */
40 OCFS2_FILECHECK_ERR_UNSUPPORTED /* Unsupported */
41};
42
43#define OCFS2_FILECHECK_ERR_START OCFS2_FILECHECK_ERR_FAILED
44#define OCFS2_FILECHECK_ERR_END OCFS2_FILECHECK_ERR_UNSUPPORTED
45
46int ocfs2_filecheck_create_sysfs(struct super_block *sb);
47int ocfs2_filecheck_remove_sysfs(struct super_block *sb);
48
49#endif /* FILECHECK_H */