xref: /openbmc/linux/fs/ocfs2/filecheck.h (revision b4e18b29)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* -*- mode: c; c-basic-offset: 8; -*-
3  * vim: noexpandtab sw=8 ts=8 sts=0:
4  *
5  * filecheck.h
6  *
7  * Online file check.
8  *
9  * Copyright (C) 2016 SuSE.  All rights reserved.
10  */
11 
12 
13 #ifndef FILECHECK_H
14 #define FILECHECK_H
15 
16 #include <linux/types.h>
17 #include <linux/list.h>
18 
19 
20 /* File check errno */
21 enum {
22 	OCFS2_FILECHECK_ERR_SUCCESS = 0,	/* Success */
23 	OCFS2_FILECHECK_ERR_FAILED = 1000,	/* Other failure */
24 	OCFS2_FILECHECK_ERR_INPROGRESS,		/* In progress */
25 	OCFS2_FILECHECK_ERR_READONLY,		/* Read only */
26 	OCFS2_FILECHECK_ERR_INJBD,		/* Buffer in jbd */
27 	OCFS2_FILECHECK_ERR_INVALIDINO,		/* Invalid ino */
28 	OCFS2_FILECHECK_ERR_BLOCKECC,		/* Block ecc */
29 	OCFS2_FILECHECK_ERR_BLOCKNO,		/* Block number */
30 	OCFS2_FILECHECK_ERR_VALIDFLAG,		/* Inode valid flag */
31 	OCFS2_FILECHECK_ERR_GENERATION,		/* Inode generation */
32 	OCFS2_FILECHECK_ERR_UNSUPPORTED		/* Unsupported */
33 };
34 
35 #define OCFS2_FILECHECK_ERR_START	OCFS2_FILECHECK_ERR_FAILED
36 #define OCFS2_FILECHECK_ERR_END		OCFS2_FILECHECK_ERR_UNSUPPORTED
37 
38 struct ocfs2_filecheck {
39 	struct list_head fc_head;	/* File check entry list head */
40 	spinlock_t fc_lock;
41 	unsigned int fc_max;	/* Maximum number of entry in list */
42 	unsigned int fc_size;	/* Current entry count in list */
43 	unsigned int fc_done;	/* Finished entry count in list */
44 };
45 
46 #define OCFS2_FILECHECK_MAXSIZE		100
47 #define OCFS2_FILECHECK_MINSIZE		10
48 
49 /* File check operation type */
50 enum {
51 	OCFS2_FILECHECK_TYPE_CHK = 0,	/* Check a file(inode) */
52 	OCFS2_FILECHECK_TYPE_FIX,	/* Fix a file(inode) */
53 	OCFS2_FILECHECK_TYPE_SET = 100	/* Set entry list maximum size */
54 };
55 
56 struct ocfs2_filecheck_sysfs_entry {	/* sysfs entry per partition */
57 	struct kobject fs_kobj;
58 	struct completion fs_kobj_unregister;
59 	struct ocfs2_filecheck *fs_fcheck;
60 };
61 
62 
63 int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
64 void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
65 
66 #endif  /* FILECHECK_H */
67