Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * filecheck.h
0004  *
0005  * Online file check.
0006  *
0007  * Copyright (C) 2016 SuSE.  All rights reserved.
0008  */
0009 
0010 
0011 #ifndef FILECHECK_H
0012 #define FILECHECK_H
0013 
0014 #include <linux/types.h>
0015 #include <linux/list.h>
0016 
0017 
0018 /* File check errno */
0019 enum {
0020     OCFS2_FILECHECK_ERR_SUCCESS = 0,    /* Success */
0021     OCFS2_FILECHECK_ERR_FAILED = 1000,  /* Other failure */
0022     OCFS2_FILECHECK_ERR_INPROGRESS,     /* In progress */
0023     OCFS2_FILECHECK_ERR_READONLY,       /* Read only */
0024     OCFS2_FILECHECK_ERR_INJBD,      /* Buffer in jbd */
0025     OCFS2_FILECHECK_ERR_INVALIDINO,     /* Invalid ino */
0026     OCFS2_FILECHECK_ERR_BLOCKECC,       /* Block ecc */
0027     OCFS2_FILECHECK_ERR_BLOCKNO,        /* Block number */
0028     OCFS2_FILECHECK_ERR_VALIDFLAG,      /* Inode valid flag */
0029     OCFS2_FILECHECK_ERR_GENERATION,     /* Inode generation */
0030     OCFS2_FILECHECK_ERR_UNSUPPORTED     /* Unsupported */
0031 };
0032 
0033 #define OCFS2_FILECHECK_ERR_START   OCFS2_FILECHECK_ERR_FAILED
0034 #define OCFS2_FILECHECK_ERR_END     OCFS2_FILECHECK_ERR_UNSUPPORTED
0035 
0036 struct ocfs2_filecheck {
0037     struct list_head fc_head;   /* File check entry list head */
0038     spinlock_t fc_lock;
0039     unsigned int fc_max;    /* Maximum number of entry in list */
0040     unsigned int fc_size;   /* Current entry count in list */
0041     unsigned int fc_done;   /* Finished entry count in list */
0042 };
0043 
0044 #define OCFS2_FILECHECK_MAXSIZE     100
0045 #define OCFS2_FILECHECK_MINSIZE     10
0046 
0047 /* File check operation type */
0048 enum {
0049     OCFS2_FILECHECK_TYPE_CHK = 0,   /* Check a file(inode) */
0050     OCFS2_FILECHECK_TYPE_FIX,   /* Fix a file(inode) */
0051     OCFS2_FILECHECK_TYPE_SET = 100  /* Set entry list maximum size */
0052 };
0053 
0054 struct ocfs2_filecheck_sysfs_entry {    /* sysfs entry per partition */
0055     struct kobject fs_kobj;
0056     struct completion fs_kobj_unregister;
0057     struct ocfs2_filecheck *fs_fcheck;
0058 };
0059 
0060 
0061 int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
0062 void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
0063 
0064 #endif  /* FILECHECK_H */