]> nv-tegra.nvidia Code Review - linux-2.6.git/blob - include/linux/dqblk_xfs.h
[XFS] Add the project quota type into the XFS quota header.
[linux-2.6.git] / include / linux / dqblk_xfs.h
1 /*
2  * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation.
7  *
8  * This program 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
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesset General Public License
14  * along with this program; if not, write to the Free Software Foundation,
15  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16  */
17 #ifndef _LINUX_DQBLK_XFS_H
18 #define _LINUX_DQBLK_XFS_H
19
20 #include <linux/types.h>
21
22 /*
23  * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM).
24  */
25
26 #define XQM_CMD(x)      (('X'<<8)+(x))  /* note: forms first QCMD argument */
27 #define XQM_COMMAND(x)  (((x) & (0xff<<8)) == ('X'<<8)) /* test if for XFS */
28
29 #define XQM_USRQUOTA    0       /* system call user quota type */
30 #define XQM_GRPQUOTA    1       /* system call group quota type */
31 #define XQM_PRJQUOTA    2       /* system call project quota type */
32 #define XQM_MAXQUOTAS   3
33
34 #define Q_XQUOTAON      XQM_CMD(1)      /* enable accounting/enforcement */
35 #define Q_XQUOTAOFF     XQM_CMD(2)      /* disable accounting/enforcement */
36 #define Q_XGETQUOTA     XQM_CMD(3)      /* get disk limits and usage */
37 #define Q_XSETQLIM      XQM_CMD(4)      /* set disk limits */
38 #define Q_XGETQSTAT     XQM_CMD(5)      /* get quota subsystem status */
39 #define Q_XQUOTARM      XQM_CMD(6)      /* free disk space used by dquots */
40
41 /*
42  * fs_disk_quota structure:
43  *
44  * This contains the current quota information regarding a user/proj/group.
45  * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of
46  * 512 bytes.
47  */
48 #define FS_DQUOT_VERSION        1       /* fs_disk_quota.d_version */
49 typedef struct fs_disk_quota {
50         __s8            d_version;      /* version of this structure */
51         __s8            d_flags;        /* XFS_{USER,PROJ,GROUP}_QUOTA */
52         __u16           d_fieldmask;    /* field specifier */
53         __u32           d_id;           /* user, project, or group ID */
54         __u64           d_blk_hardlimit;/* absolute limit on disk blks */
55         __u64           d_blk_softlimit;/* preferred limit on disk blks */
56         __u64           d_ino_hardlimit;/* maximum # allocated inodes */
57         __u64           d_ino_softlimit;/* preferred inode limit */
58         __u64           d_bcount;       /* # disk blocks owned by the user */
59         __u64           d_icount;       /* # inodes owned by the user */
60         __s32           d_itimer;       /* zero if within inode limits */
61                                         /* if not, we refuse service */
62         __s32           d_btimer;       /* similar to above; for disk blocks */
63         __u16           d_iwarns;       /* # warnings issued wrt num inodes */
64         __u16           d_bwarns;       /* # warnings issued wrt disk blocks */
65         __s32           d_padding2;     /* padding2 - for future use */
66         __u64           d_rtb_hardlimit;/* absolute limit on realtime blks */
67         __u64           d_rtb_softlimit;/* preferred limit on RT disk blks */
68         __u64           d_rtbcount;     /* # realtime blocks owned */
69         __s32           d_rtbtimer;     /* similar to above; for RT disk blks */
70         __u16           d_rtbwarns;     /* # warnings issued wrt RT disk blks */
71         __s16           d_padding3;     /* padding3 - for future use */ 
72         char            d_padding4[8];  /* yet more padding */
73 } fs_disk_quota_t;
74
75 /*
76  * These fields are sent to Q_XSETQLIM to specify fields that need to change.
77  */
78 #define FS_DQ_ISOFT     (1<<0)
79 #define FS_DQ_IHARD     (1<<1)
80 #define FS_DQ_BSOFT     (1<<2)
81 #define FS_DQ_BHARD     (1<<3)
82 #define FS_DQ_RTBSOFT   (1<<4)
83 #define FS_DQ_RTBHARD   (1<<5)
84 #define FS_DQ_LIMIT_MASK        (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \
85                                  FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD)
86 /*
87  * These timers can only be set in super user's dquot. For others, timers are
88  * automatically started and stopped. Superusers timer values set the limits
89  * for the rest.  In case these values are zero, the DQ_{F,B}TIMELIMIT values
90  * defined below are used. 
91  * These values also apply only to the d_fieldmask field for Q_XSETQLIM.
92  */
93 #define FS_DQ_BTIMER    (1<<6)
94 #define FS_DQ_ITIMER    (1<<7)
95 #define FS_DQ_RTBTIMER  (1<<8)
96 #define FS_DQ_TIMER_MASK        (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER)
97
98 /*
99  * Warning counts are set in both super user's dquot and others. For others,
100  * warnings are set/cleared by the administrators (or automatically by going
101  * below the soft limit).  Superusers warning values set the warning limits
102  * for the rest.  In case these values are zero, the DQ_{F,B}WARNLIMIT values
103  * defined below are used. 
104  * These values also apply only to the d_fieldmask field for Q_XSETQLIM.
105  */
106 #define FS_DQ_BWARNS    (1<<9)
107 #define FS_DQ_IWARNS    (1<<10)
108 #define FS_DQ_RTBWARNS  (1<<11)
109 #define FS_DQ_WARNS_MASK        (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS)
110
111 /*
112  * Various flags related to quotactl(2).  Only relevant to XFS filesystems.
113  */
114 #define XFS_QUOTA_UDQ_ACCT      (1<<0)  /* user quota accounting */
115 #define XFS_QUOTA_UDQ_ENFD      (1<<1)  /* user quota limits enforcement */
116 #define XFS_QUOTA_GDQ_ACCT      (1<<2)  /* group quota accounting */
117 #define XFS_QUOTA_GDQ_ENFD      (1<<3)  /* group quota limits enforcement */
118 #define XFS_QUOTA_PDQ_ACCT      (1<<4)  /* project quota accounting */
119 #define XFS_QUOTA_PDQ_ENFD      (1<<5)  /* project quota limits enforcement */
120
121 #define XFS_USER_QUOTA          (1<<0)  /* user quota type */
122 #define XFS_PROJ_QUOTA          (1<<1)  /* project quota type */
123 #define XFS_GROUP_QUOTA         (1<<2)  /* group quota type */
124
125 /*
126  * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
127  * Provides a centralized way to get meta infomation about the quota subsystem.
128  * eg. space taken up for user and group quotas, number of dquots currently
129  * incore.
130  */
131 #define FS_QSTAT_VERSION        1       /* fs_quota_stat.qs_version */
132
133 /*
134  * Some basic infomation about 'quota files'.
135  */
136 typedef struct fs_qfilestat {
137         __u64           qfs_ino;        /* inode number */
138         __u64           qfs_nblks;      /* number of BBs 512-byte-blks */
139         __u32           qfs_nextents;   /* number of extents */
140 } fs_qfilestat_t;
141
142 typedef struct fs_quota_stat {
143         __s8            qs_version;     /* version number for future changes */
144         __u16           qs_flags;       /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
145         __s8            qs_pad;         /* unused */
146         fs_qfilestat_t  qs_uquota;      /* user quota storage information */
147         fs_qfilestat_t  qs_gquota;      /* group quota storage information */
148         __u32           qs_incoredqs;   /* number of dquots incore */
149         __s32           qs_btimelimit;  /* limit for blks timer */      
150         __s32           qs_itimelimit;  /* limit for inodes timer */    
151         __s32           qs_rtbtimelimit;/* limit for rt blks timer */   
152         __u16           qs_bwarnlimit;  /* limit for num warnings */
153         __u16           qs_iwarnlimit;  /* limit for num warnings */
154 } fs_quota_stat_t;
155
156 #endif  /* _LINUX_DQBLK_XFS_H */