filecheck.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #ifndef FILECHECK_H
  12. #define FILECHECK_H
  13. #include <linux/types.h>
  14. #include <linux/list.h>
  15. /* File check errno */
  16. enum {
  17. OCFS2_FILECHECK_ERR_SUCCESS = 0, /* Success */
  18. OCFS2_FILECHECK_ERR_FAILED = 1000, /* Other failure */
  19. OCFS2_FILECHECK_ERR_INPROGRESS, /* In progress */
  20. OCFS2_FILECHECK_ERR_READONLY, /* Read only */
  21. OCFS2_FILECHECK_ERR_INJBD, /* Buffer in jbd */
  22. OCFS2_FILECHECK_ERR_INVALIDINO, /* Invalid ino */
  23. OCFS2_FILECHECK_ERR_BLOCKECC, /* Block ecc */
  24. OCFS2_FILECHECK_ERR_BLOCKNO, /* Block number */
  25. OCFS2_FILECHECK_ERR_VALIDFLAG, /* Inode valid flag */
  26. OCFS2_FILECHECK_ERR_GENERATION, /* Inode generation */
  27. OCFS2_FILECHECK_ERR_UNSUPPORTED /* Unsupported */
  28. };
  29. #define OCFS2_FILECHECK_ERR_START OCFS2_FILECHECK_ERR_FAILED
  30. #define OCFS2_FILECHECK_ERR_END OCFS2_FILECHECK_ERR_UNSUPPORTED
  31. struct ocfs2_filecheck {
  32. struct list_head fc_head; /* File check entry list head */
  33. spinlock_t fc_lock;
  34. unsigned int fc_max; /* Maximum number of entry in list */
  35. unsigned int fc_size; /* Current entry count in list */
  36. unsigned int fc_done; /* Finished entry count in list */
  37. };
  38. #define OCFS2_FILECHECK_MAXSIZE 100
  39. #define OCFS2_FILECHECK_MINSIZE 10
  40. /* File check operation type */
  41. enum {
  42. OCFS2_FILECHECK_TYPE_CHK = 0, /* Check a file(inode) */
  43. OCFS2_FILECHECK_TYPE_FIX, /* Fix a file(inode) */
  44. OCFS2_FILECHECK_TYPE_SET = 100 /* Set entry list maximum size */
  45. };
  46. struct ocfs2_filecheck_sysfs_entry { /* sysfs entry per partition */
  47. struct kobject fs_kobj;
  48. struct completion fs_kobj_unregister;
  49. struct ocfs2_filecheck *fs_fcheck;
  50. };
  51. int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
  52. void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
  53. #endif /* FILECHECK_H */