10
* quota defs for linux
11
* We don't use <linux/quota.h>
17
#include <sys/types.h>
20
typedef u_int32_t qid_t; /* Type in which we store ids in memory */
21
typedef u_int64_t qsize_t; /* Type in which we store size limitations */
24
#define USRQUOTA 0 /* element used for user quotas */
25
#define GRPQUOTA 1 /* element used for group quotas */
28
* Command definitions for the 'quotactl' system call.
29
* The commands are broken into a main command defined below
30
* and a subcommand that is used to convey the type of
31
* quota that is being manipulated (see above).
33
#define SUBCMDMASK 0x00ff
35
#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
37
/* Interface versions */
38
#define IFACE_VFSOLD 1
40
#define IFACE_GENERIC 3
42
/* _6_5_ are the older defs */
43
#define Q_6_5_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
46
#define Q_6_5_QUOTAOFF 0x0200 /* disable quotas */
47
#define Q_6_5_QUOTAON 0x0100 /* enable quotas */
50
#define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */
52
#define Q_QUOTAON 0x800002 /* turn quotas on */
53
#define Q_QUOTAOFF 0x800003 /* turn quotas off */
55
#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */
56
#define Q_GETINFO 0x800005 /* get information about quota files */
57
#define Q_SETINFO 0x800006 /* set information about quota files */
58
#define Q_GETQUOTA 0x800007 /* get user quota structure */
59
#define Q_SETQUOTA 0x800008 /* set user quota structure */
62
* Quota structure used for communication with userspace via quotactl
63
* Following flags are used to specify which fields are valid
71
#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
72
#define QIF_USAGE (QIF_SPACE | QIF_INODES)
73
#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
74
#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
77
/* The generic diskblock-struct: */
79
u_int64_t dqb_bhardlimit;
80
u_int64_t dqb_bsoftlimit;
81
u_int64_t dqb_curspace;
82
u_int64_t dqb_ihardlimit;
83
u_int64_t dqb_isoftlimit;
84
u_int64_t dqb_curinodes;
90
/* version-specific info */
91
struct v1_mem_dqinfo {};
92
struct v2_mem_dqinfo {
93
unsigned int dqi_blocks;
94
unsigned int dqi_free_blk;
95
unsigned int dqi_free_entry;
98
/* The generic diskinfo-struct: */
100
u_int64_t dqi_bgrace;
101
u_int64_t dqi_igrace;
106
/* Ioctl for getting quota size */
107
#include <sys/ioctl.h>
109
#if defined(__alpha__) || defined(__powerpc__) || defined(__sh__) || defined(__sparc__) || defined(__sparc64__)
110
#define FIOQSIZE _IOR('f', 128, loff_t)
111
#elif defined(__arm__) || defined(__mc68000__) || defined(__s390__)
112
#define FIOQSIZE 0x545E
113
#elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__ia64__) || defined(__parisc__) || defined(__cris__) || defined(__hppa__)
114
#define FIOQSIZE 0x5460
115
#elif defined(__mips__) || defined(__mips64__)
116
#define FIOQSIZE 0x6667
120
long quotactl __P((int, const char *, qid_t, caddr_t));
123
* runtime detection of quota format
126
/* Values for format handling */
127
#define QF_TOONEW -2 /* Quota format is too new to handle */
128
#define QF_ERROR -1 /* There was error while detecting format (maybe unknown format...) */
129
#define QF_VFSOLD 0 /* Old quota format */
130
#define QF_VFSV0 1 /* New quota format - version 0 */
131
#define QF_XFS 3 /* XFS quota */
133
#define KERN_KNOWN_QUOTA_VERSION (6*10000 + 5*100 + 0)
134
int kern_quota_format(fs_t *, int);
136
#include "dqblk_v1.h"
137
#include "dqblk_v2.h"
138
#include "xfs_quota.h"