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