quota.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef _SYS_QUOTA_H
  2. #define _SYS_QUOTA_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stdint.h>
  7. #define _LINUX_QUOTA_VERSION 2
  8. #define dbtob(num) ((num) << 10)
  9. #define btodb(num) ((num) >> 10)
  10. #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
  11. #define MAX_IQ_TIME 604800
  12. #define MAX_DQ_TIME 604800
  13. #define MAXQUOTAS 2
  14. #define USRQUOTA 0
  15. #define GRPQUOTA 1
  16. #define INITQFNAMES { "user", "group", "undefined" };
  17. #define QUOTAFILENAME "quota"
  18. #define QUOTAGROUP "staff"
  19. #define NR_DQHASH 43
  20. #define NR_DQUOTS 256
  21. #define SUBCMDMASK 0x00ff
  22. #define SUBCMDSHIFT 8
  23. #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
  24. #define Q_SYNC 0x800001
  25. #define Q_QUOTAON 0x800002
  26. #define Q_QUOTAOFF 0x800003
  27. #define Q_GETFMT 0x800004
  28. #define Q_GETINFO 0x800005
  29. #define Q_SETINFO 0x800006
  30. #define Q_GETQUOTA 0x800007
  31. #define Q_SETQUOTA 0x800008
  32. #define QFMT_VFS_OLD 1
  33. #define QFMT_VFS_V0 2
  34. #define QFMT_OCFS2 3
  35. #define QFMT_VFS_V1 4
  36. #define QIF_BLIMITS 1
  37. #define QIF_SPACE 2
  38. #define QIF_ILIMITS 4
  39. #define QIF_INODES 8
  40. #define QIF_BTIME 16
  41. #define QIF_ITIME 32
  42. #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
  43. #define QIF_USAGE (QIF_SPACE | QIF_INODES)
  44. #define QIF_TIMES (QIF_BTIME | QIF_ITIME)
  45. #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
  46. struct dqblk {
  47. uint64_t dqb_bhardlimit;
  48. uint64_t dqb_bsoftlimit;
  49. uint64_t dqb_curspace;
  50. uint64_t dqb_ihardlimit;
  51. uint64_t dqb_isoftlimit;
  52. uint64_t dqb_curinodes;
  53. uint64_t dqb_btime;
  54. uint64_t dqb_itime;
  55. uint32_t dqb_valid;
  56. };
  57. #define dq_bhardlimit dq_dqb.dqb_bhardlimit
  58. #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
  59. #define dq_curspace dq_dqb.dqb_curspace
  60. #define dq_valid dq_dqb.dqb_valid
  61. #define dq_ihardlimit dq_dqb.dqb_ihardlimit
  62. #define dq_isoftlimit dq_dqb.dqb_isoftlimit
  63. #define dq_curinodes dq_dqb.dqb_curinodes
  64. #define dq_btime dq_dqb.dqb_btime
  65. #define dq_itime dq_dqb.dqb_itime
  66. #define dqoff(UID) ((long long)(UID) * sizeof (struct dqblk))
  67. #define IIF_BGRACE 1
  68. #define IIF_IGRACE 2
  69. #define IIF_FLAGS 4
  70. #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
  71. struct dqinfo {
  72. uint64_t dqi_bgrace;
  73. uint64_t dqi_igrace;
  74. uint32_t dqi_flags;
  75. uint32_t dqi_valid;
  76. };
  77. int quotactl(int, const char *, int, char *);
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif