2 Unix SMB/CIFS implementation.
3 SYS QUOTA code constants
4 Copyright (C) Stefan (metze) Metzmacher 2003
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifdef HAVE_SYS_QUOTAS
26 /* Sometimes we need this on linux for linux/quota.h */
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
31 #ifdef HAVE_ASM_TYPES_H
32 #include <asm/types.h>
36 * This shouldn't be neccessary - it should be /usr/include/sys/quota.h
37 * Unfortunately, RH7.1 ships with a different quota system using struct mem_dqblk
38 * rather than the struct dqblk defined in /usr/include/sys/quota.h.
39 * This means we must include linux/quota.h to have a hope of working on
40 * RH7.1 systems. And it also means this breaks if the kernel is upgraded
41 * to a Linus 2.4.x (where x > the minor number shipped with RH7.1) until
42 * Linus synchronises with the AC patches. Sometimes I *hate* Linux :-). JRA.
44 #ifdef HAVE_LINUX_QUOTA_H
45 #include <linux/quota.h>
46 #elif defined(HAVE_SYS_QUOTA_H)
47 #include <sys/quota.h>
50 #if defined(HAVE_STRUCT_IF_DQBLK)
51 # define SYS_DQBLK if_dqblk
52 # define dqb_curblocks dqb_curspace/bsize
53 #elif defined(HAVE_STRUCT_MEM_DQBLK)
54 # define SYS_DQBLK mem_dqblk
55 # define dqb_curblocks dqb_curspace/bsize
56 #else /* STRUCT_DQBLK */
57 # define SYS_DQBLK dqblk
61 #define Q_SETQLIM Q_SETQUOTA
64 /*********************************************
65 check for XFS QUOTA MANAGER
66 *********************************************/
68 #ifdef HAVE_LINUX_XQM_H
69 # include <linux/xqm.h>
70 # define HAVE_XFS_QUOTA
72 # ifdef HAVE_XFS_XQM_H
74 # define HAVE_XFS_QUOTA
76 # ifdef HAVE_LINUX_DQBLK_XFS_H
77 # include <linux/dqblk_xfs.h>
78 # define HAVE_XFS_QUOTA
84 # ifndef HAVE_XFS_QUOTA
85 # define HAVE_XFS_QUOTA
87 # define Q_XQUOTAON Q_QUOTAON
88 # endif /* Q_XQUOTAON */
90 # define Q_XQUOTAOFF Q_QUOTAOFF
91 # endif /* Q_XQUOTAOFF */
93 # define Q_XGETQSTAT Q_GETQSTAT
94 # endif /* Q_XGETQSTAT */
95 # endif /* HAVE_XFS_QUOTA */
96 #endif /* Q_XGETQUOTA */
99 /* Linux has BBSIZE in <linux/xfs_fs.h>
101 * IRIX has BBSIZE in <sys/param.h>
103 #ifdef HAVE_LINUX_XFS_FS_H
104 #include <linux/xfs_fs.h>
105 #elif defined(HAVE_XFS_XFS_FS_H)
106 #include <xfs/xfs_fs.h>
107 #endif /* *_XFS_FS_H */
113 #define BBSIZE (1<<BBSHIFT)
116 #endif /* HAVE_XFS_QUOTA */
119 # ifndef QUOTABLOCK_SIZE
120 # define QUOTABLOCK_SIZE 1024
124 # ifndef QUOTABLOCK_SIZE
125 # define QUOTABLOCK_SIZE BBSIZE
129 # ifndef QUOTABLOCK_SIZE
130 # define QUOTABLOCK_SIZE DEV_BSIZE
132 #endif /* HPUP,... */
134 #if !defined(QUOTAFILENAME) && defined(QFILENAME)
135 #define QUOTAFILENAME QFILENAME
139 #define USERQUOTAFILE_EXTENSION ".user"
141 #define USERQUOTAFILE_EXTENSION ""
144 /* this check should be before the QCMD fake! */
145 #if defined(QCMD)&&defined(GRPQUOTA)
146 #define HAVE_GROUP_QUOTA
149 /* on some systems we have to fake this up ...*/
151 #define QCMD(cmd,type) (cmd)
155 #ifdef HAVE_DQB_FSOFTLIMIT
156 #define dqb_isoftlimit dqb_fsoftlimit
157 #define dqb_ihardlimit dqb_fhardlimit
158 #define dqb_curinodes dqb_curfiles
161 /* maybe we can add a configure test for HAVE_CADDR_T,
162 * but it's not needed
165 #define CADDR_T caddr_t
167 #define CADDR_T void*
170 #if defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT)
172 #define HAVE_MNTENT 1
173 /*#endif defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT) */
174 #elif defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM)
176 #endif /* defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) */
178 #endif /* HAVE_SYS_QUOTAS */
181 #ifndef QUOTABLOCK_SIZE
182 #define QUOTABLOCK_SIZE 1024
185 /**************************************************
186 Some stuff for the sys_quota api.
187 **************************************************/
189 #define SMB_QUOTAS_NO_LIMIT ((SMB_BIG_UINT)(0))
190 #define SMB_QUOTAS_NO_SPACE ((SMB_BIG_UINT)(1))
192 typedef struct _SMB_DISK_QUOTA {
193 enum SMB_QUOTA_TYPE qtype;
195 SMB_BIG_UINT hardlimit; /* In bsize units. */
196 SMB_BIG_UINT softlimit; /* In bsize units. */
197 SMB_BIG_UINT curblocks; /* In bsize units. */
198 SMB_BIG_UINT ihardlimit; /* inode hard limit. */
199 SMB_BIG_UINT isoftlimit; /* inode soft limit. */
200 SMB_BIG_UINT curinodes; /* Current used inodes. */
204 #endif /*_SYSQUOTAS_H */