xref: /openbmc/linux/fs/ocfs2/filecheck.h (revision 7e6f7d24)
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 */
29 enum {
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 
46 struct ocfs2_filecheck {
47 	struct list_head fc_head;	/* File check entry list head */
48 	spinlock_t fc_lock;
49 	unsigned int fc_max;	/* Maximum number of entry in list */
50 	unsigned int fc_size;	/* Current entry count in list */
51 	unsigned int fc_done;	/* Finished entry count in list */
52 };
53 
54 #define OCFS2_FILECHECK_MAXSIZE		100
55 #define OCFS2_FILECHECK_MINSIZE		10
56 
57 /* File check operation type */
58 enum {
59 	OCFS2_FILECHECK_TYPE_CHK = 0,	/* Check a file(inode) */
60 	OCFS2_FILECHECK_TYPE_FIX,	/* Fix a file(inode) */
61 	OCFS2_FILECHECK_TYPE_SET = 100	/* Set entry list maximum size */
62 };
63 
64 struct ocfs2_filecheck_sysfs_entry {	/* sysfs entry per partition */
65 	struct kobject fs_kobj;
66 	struct completion fs_kobj_unregister;
67 	struct ocfs2_filecheck *fs_fcheck;
68 };
69 
70 
71 int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
72 void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
73 
74 #endif  /* FILECHECK_H */
75