00001 #ifndef _SAMBA_LINUX_XFS_H_ 00002 #define _SAMBA_LINUX_XFS_H_ 00003 00004 #ifndef _QUOTAIO_LINUX_XFS 00005 #define _QUOTAIO_LINUX_XFS 00006 00007 /* 00008 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 00009 * 00010 * This program is free software; you can redistribute it and/or modify it 00011 * under the terms of version 2 of the GNU General Public License as 00012 * published by the Free Software Foundation. 00013 * 00014 * This program is distributed in the hope that it would be useful, but 00015 * WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00017 * 00018 * Further, this software is distributed without any warranty that it is 00019 * free of the rightful claim of any third person regarding infringement 00020 * or the like. Any license provided herein, whether implied or 00021 * otherwise, applies only to this software file. Patent licenses, if 00022 * any, provided herein do not apply to combinations of this program with 00023 * other software, or any other product whatsoever. 00024 * 00025 * You should have received a copy of the GNU General Public License along 00026 * with this program; if not, write the Free Software Foundation, Inc., 59 00027 * Temple Place - Suite 330, Boston MA 02111-1307, USA. 00028 * 00029 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 00030 * Mountain View, CA 94043, or: 00031 * 00032 * http://www.sgi.com 00033 * 00034 * For further information regarding this notice, see: 00035 * 00036 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ 00037 */ 00038 00039 #include <linux/types.h> 00040 00041 #define XQM_CMD(cmd) ( ('X'<<8)+(cmd) ) 00042 #define IS_XQM_CMD(cmd) ( ((int)(cmd)>>8) == 'X' ) 00043 00044 /* 00045 * Disk quota - quotactl(2) commands for XFS Quota Manager (XQM). 00046 */ 00047 #define Q_XQUOTAON XQM_CMD(0x1) /* enable quota accounting/enforcement */ 00048 #define Q_XQUOTAOFF XQM_CMD(0x2) /* disable quota accounting/enforcement */ 00049 #define Q_XGETQUOTA XQM_CMD(0x3) /* get disk limits & usage */ 00050 #define Q_XSETQLIM XQM_CMD(0x4) /* set disk limits only */ 00051 #define Q_XGETQSTAT XQM_CMD(0x5) /* returns fs_quota_stat_t struct */ 00052 #define Q_XQUOTARM XQM_CMD(0x6) /* free quota files' space */ 00053 00054 /* 00055 * fs_disk_quota structure: 00056 * 00057 * This contains the current quota information regarding a user/proj/group. 00058 * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of 00059 * 512 bytes. 00060 */ 00061 #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ 00062 typedef struct fs_disk_quota { 00063 u_int8_t d_version; /* version of this structure */ 00064 u_int8_t d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ 00065 u_int16_t d_fieldmask; /* field specifier */ 00066 u_int32_t d_id; /* user, project, or group ID */ 00067 u_int64_t d_blk_hardlimit; /* absolute limit on disk blks */ 00068 u_int64_t d_blk_softlimit; /* preferred limit on disk blks */ 00069 u_int64_t d_ino_hardlimit; /* maximum # allocated inodes */ 00070 u_int64_t d_ino_softlimit; /* preferred inode limit */ 00071 u_int64_t d_bcount; /* # disk blocks owned by the user */ 00072 u_int64_t d_icount; /* # inodes owned by the user */ 00073 int32_t d_itimer; /* zero if within inode limits */ 00074 /* if not, we refuse service */ 00075 int32_t d_btimer; /* similar to above; for disk blocks */ 00076 u_int16_t d_iwarns; /* # warnings issued wrt num inodes */ 00077 u_int16_t d_bwarns; /* # warnings issued wrt disk blocks */ 00078 int32_t d_padding2; /* padding2 - for future use */ 00079 u_int64_t d_rtb_hardlimit; /* absolute limit on realtime blks */ 00080 u_int64_t d_rtb_softlimit; /* preferred limit on RT disk blks */ 00081 u_int64_t d_rtbcount; /* # realtime blocks owned */ 00082 int32_t d_rtbtimer; /* similar to above; for RT disk blks */ 00083 u_int16_t d_rtbwarns; /* # warnings issued wrt RT disk blks */ 00084 int16_t d_padding3; /* padding3 - for future use */ 00085 char d_padding4[8]; /* yet more padding */ 00086 } fs_disk_quota_t; 00087 00088 /* 00089 * These fields are sent to Q_XSETQLIM to specify fields that need to change. 00090 */ 00091 #define FS_DQ_ISOFT (1<<0) 00092 #define FS_DQ_IHARD (1<<1) 00093 #define FS_DQ_BSOFT (1<<2) 00094 #define FS_DQ_BHARD (1<<3) 00095 #define FS_DQ_RTBSOFT (1<<4) 00096 #define FS_DQ_RTBHARD (1<<5) 00097 #define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ 00098 FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) 00099 /* 00100 * These timers can only be set in super user's dquot. For others, timers are 00101 * automatically started and stopped. Superusers timer values set the limits 00102 * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values 00103 * defined below are used. 00104 * These values also apply only to the d_fieldmask field for Q_XSETQLIM. 00105 */ 00106 #define FS_DQ_BTIMER (1<<6) 00107 #define FS_DQ_ITIMER (1<<7) 00108 #define FS_DQ_RTBTIMER (1<<8) 00109 #define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) 00110 00111 /* 00112 * The following constants define the default amount of time given a user 00113 * before the soft limits are treated as hard limits (usually resulting 00114 * in an allocation failure). These may be modified by the quotactl(2) 00115 * system call with the Q_XSETQLIM command. 00116 */ 00117 #define DQ_FTIMELIMIT (7 * 24*60*60) /* 1 week */ 00118 #define DQ_BTIMELIMIT (7 * 24*60*60) /* 1 week */ 00119 00120 /* 00121 * Various flags related to quotactl(2). Only relevant to XFS filesystems. 00122 */ 00123 #define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ 00124 #define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ 00125 #define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ 00126 #define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ 00127 00128 #define XFS_USER_QUOTA (1<<0) /* user quota type */ 00129 #define XFS_PROJ_QUOTA (1<<1) /* (IRIX) project quota type */ 00130 #define XFS_GROUP_QUOTA (1<<2) /* group quota type */ 00131 00132 /* 00133 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. 00134 * Provides a centralized way to get meta infomation about the quota subsystem. 00135 * eg. space taken up for user and group quotas, number of dquots currently 00136 * incore. 00137 */ 00138 #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ 00139 00140 /* 00141 * Some basic infomation about 'quota files'. 00142 */ 00143 typedef struct fs_qfilestat { 00144 u_int64_t qfs_ino; /* inode number */ 00145 u_int64_t qfs_nblks; /* number of BBs 512-byte-blks */ 00146 u_int32_t qfs_nextents; /* number of extents */ 00147 } fs_qfilestat_t; 00148 00149 typedef struct fs_quota_stat { 00150 u_int8_t qs_version; /* version number for future changes */ 00151 u_int16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ 00152 u_int8_t qs_pad; /* unused */ 00153 fs_qfilestat_t qs_uquota; /* user quota storage information */ 00154 fs_qfilestat_t qs_gquota; /* group quota storage information */ 00155 u_int32_t qs_incoredqs; /* number of dquots incore */ 00156 int32_t qs_btimelimit; /* limit for blks timer */ 00157 int32_t qs_itimelimit; /* limit for inodes timer */ 00158 int32_t qs_rtbtimelimit; /* limit for rt blks timer */ 00159 u_int16_t qs_bwarnlimit; /* limit for num warnings */ 00160 u_int16_t qs_iwarnlimit; /* limit for num warnings */ 00161 } fs_quota_stat_t; 00162 00163 #endif /* _QUOTAIO_LINUX_XFS */ 00164 00165 #endif /* _SAMBA_LINUX_XFS_H_ */