filecheck.h 2.3 KB

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