quota.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* This just represents the non-kernel parts of <linux/quota.h>.
  2. Copyright (C) 1998-2017 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. /*
  16. * Copyright (c) 1982, 1986 Regents of the University of California.
  17. * All rights reserved.
  18. *
  19. * This code is derived from software contributed to Berkeley by
  20. * Robert Elz at The University of Melbourne.
  21. *
  22. * Redistribution and use in source and binary forms, with or without
  23. * modification, are permitted provided that the following conditions
  24. * are met:
  25. * 1. Redistributions of source code must retain the above copyright
  26. * notice, this list of conditions and the following disclaimer.
  27. * 2. Redistributions in binary form must reproduce the above copyright
  28. * notice, this list of conditions and the following disclaimer in the
  29. * documentation and/or other materials provided with the distribution.
  30. * 4. Neither the name of the University nor the names of its contributors
  31. * may be used to endorse or promote products derived from this software
  32. * without specific prior written permission.
  33. *
  34. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  35. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  36. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  37. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  38. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  39. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  40. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  41. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  42. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  43. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  44. * SUCH DAMAGE.
  45. */
  46. #ifndef _SYS_QUOTA_H
  47. #define _SYS_QUOTA_H 1
  48. #include <features.h>
  49. #include <sys/types.h>
  50. #include <linux/quota.h>
  51. /*
  52. * Convert diskblocks to blocks and the other way around.
  53. * currently only to fool the BSD source. :-)
  54. */
  55. #define dbtob(num) ((num) << 10)
  56. #define btodb(num) ((num) >> 10)
  57. /*
  58. * Convert count of filesystem blocks to diskquota blocks, meant for
  59. * filesystems where i_blksize != 1024.
  60. */
  61. #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
  62. /*
  63. * Definitions for disk quotas imposed on the average user
  64. * (big brother finally hits Linux).
  65. *
  66. * The following constants define the amount of time given a user
  67. * before the soft limits are treated as hard limits (usually resulting
  68. * in an allocation failure). The timer is started when the user crosses
  69. * their soft limit, it is reset when they go below their soft limit.
  70. */
  71. #define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */
  72. #define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */
  73. #define QUOTAFILENAME "quota"
  74. #define QUOTAGROUP "staff"
  75. #define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */
  76. #define NR_DQUOTS 256 /* Number of quotas active at one time */
  77. /* Old name for struct if_dqblk. */
  78. struct dqblk
  79. {
  80. __uint64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */
  81. __uint64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */
  82. __uint64_t dqb_curspace; /* current quota block count */
  83. __uint64_t dqb_ihardlimit; /* maximum # allocated inodes */
  84. __uint64_t dqb_isoftlimit; /* preferred inode limit */
  85. __uint64_t dqb_curinodes; /* current # allocated inodes */
  86. __uint64_t dqb_btime; /* time limit for excessive disk use */
  87. __uint64_t dqb_itime; /* time limit for excessive files */
  88. __uint32_t dqb_valid; /* bitmask of QIF_* constants */
  89. };
  90. /*
  91. * Shorthand notation.
  92. */
  93. #define dq_bhardlimit dq_dqb.dqb_bhardlimit
  94. #define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
  95. #define dq_curspace dq_dqb.dqb_curspace
  96. #define dq_valid dq_dqb.dqb_valid
  97. #define dq_ihardlimit dq_dqb.dqb_ihardlimit
  98. #define dq_isoftlimit dq_dqb.dqb_isoftlimit
  99. #define dq_curinodes dq_dqb.dqb_curinodes
  100. #define dq_btime dq_dqb.dqb_btime
  101. #define dq_itime dq_dqb.dqb_itime
  102. #define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk)))
  103. /* Old name for struct if_dqinfo. */
  104. struct dqinfo
  105. {
  106. __uint64_t dqi_bgrace;
  107. __uint64_t dqi_igrace;
  108. __uint32_t dqi_flags;
  109. __uint32_t dqi_valid;
  110. };
  111. __BEGIN_DECLS
  112. extern int quotactl (int __cmd, const char *__special, int __id,
  113. __caddr_t __addr) __THROW;
  114. __END_DECLS
  115. #endif /* sys/quota.h */