Clean up a comment noticed by Jonathan Shao@Panasas.com and remove an
[Samba/gebeck_regimport.git] / source3 / include / sysquotas.h
blobb803e6277abbf0fba70f9430aedadeacc4308712
1 /*
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.
21 #ifndef _SYSQUOTAS_H
22 #define _SYSQUOTAS_H
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>
29 #endif
31 #ifdef HAVE_ASM_TYPES_H
32 #include <asm/types.h>
33 #endif
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>
48 #endif
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
58 #endif
60 #ifndef Q_SETQLIM
61 #define Q_SETQLIM Q_SETQUOTA
62 #endif
64 /*********************************************
65 check for XFS QUOTA MANAGER
66 *********************************************/
67 /* on linux */
68 #ifdef HAVE_LINUX_XQM_H
69 # include <linux/xqm.h>
70 # define HAVE_XFS_QUOTA
71 #else
72 # ifdef HAVE_XFS_XQM_H
73 # include <xfs/xqm.h>
74 # define HAVE_XFS_QUOTA
75 # else
76 # ifdef HAVE_LINUX_DQBLK_XFS_H
77 # include <linux/dqblk_xfs.h>
78 # define HAVE_XFS_QUOTA
79 # endif
80 # endif
81 #endif
82 /* on IRIX */
83 #ifdef Q_XGETQUOTA
84 # ifndef HAVE_XFS_QUOTA
85 # define HAVE_XFS_QUOTA
86 # ifndef Q_XQUOTAON
87 # define Q_XQUOTAON Q_QUOTAON
88 # endif /* Q_XQUOTAON */
89 # ifndef Q_XQUOTAOFF
90 # define Q_XQUOTAOFF Q_QUOTAOFF
91 # endif /* Q_XQUOTAOFF */
92 # ifndef Q_XGETQSTAT
93 # define Q_XGETQSTAT Q_GETQSTAT
94 # endif /* Q_XGETQSTAT */
95 # endif /* HAVE_XFS_QUOTA */
96 #endif /* Q_XGETQUOTA */
98 #ifdef HAVE_XFS_QUOTA
99 /* Linux has BBSIZE in <linux/xfs_fs.h>
100 * or <xfs/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 */
109 #ifndef BBSHIFT
110 #define BBSHIFT 9
111 #endif /* BBSHIFT */
112 #ifndef BBSIZE
113 #define BBSIZE (1<<BBSHIFT)
114 #endif /* BBSIZE */
116 #endif /* HAVE_XFS_QUOTA */
118 #ifdef LINUX
119 # ifndef QUOTABLOCK_SIZE
120 # define QUOTABLOCK_SIZE 1024
121 # endif
122 /* end LINUX */
123 #elif defined(IRIX6)
124 # ifndef QUOTABLOCK_SIZE
125 # define QUOTABLOCK_SIZE BBSIZE
126 # endif
127 /* end IRIX6 */
128 #else /* HPUP,... */
129 # ifndef QUOTABLOCK_SIZE
130 # define QUOTABLOCK_SIZE DEV_BSIZE
131 # endif
132 #endif /* HPUP,... */
134 #if !defined(QUOTAFILENAME) && defined(QFILENAME)
135 #define QUOTAFILENAME QFILENAME
136 #endif
138 #ifdef INITQFNAMES
139 #define USERQUOTAFILE_EXTENSION ".user"
140 #else
141 #define USERQUOTAFILE_EXTENSION ""
142 #endif
144 /* this check should be before the QCMD fake! */
145 #if defined(QCMD)&&defined(GRPQUOTA)
146 #define HAVE_GROUP_QUOTA
147 #endif
149 /* on some systems we have to fake this up ...*/
150 #ifndef QCMD
151 #define QCMD(cmd,type) (cmd)
152 #endif /* QCMD */
155 #ifdef HAVE_DQB_FSOFTLIMIT
156 #define dqb_isoftlimit dqb_fsoftlimit
157 #define dqb_ihardlimit dqb_fhardlimit
158 #define dqb_curinodes dqb_curfiles
159 #endif
161 /* maybe we can add a configure test for HAVE_CADDR_T,
162 * but it's not needed
164 #ifdef HAVE_CADDR_T
165 #define CADDR_T caddr_t
166 #else /* CADDR_T */
167 #define CADDR_T void*
168 #endif /* CADDR_T */
170 #if defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT)
171 #include <mntent.h>
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)
175 #include <devnm.h>
176 #endif /* defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) */
178 #endif /* HAVE_SYS_QUOTAS */
181 #ifndef QUOTABLOCK_SIZE
182 #define QUOTABLOCK_SIZE 1024
183 #endif
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 #define SMB_QUOTAS_SET_NO_LIMIT(dp) \
194 (dp)->softlimit = SMB_QUOTAS_NO_LIMIT;\
195 (dp)->hardlimit = SMB_QUOTAS_NO_LIMIT;\
196 (dp)->isoftlimit = SMB_QUOTAS_NO_LIMIT;\
197 (dp)->ihardlimit = SMB_QUOTAS_NO_LIMIT;\
200 #define SMB_QUOTAS_SET_NO_SPACE(dp) \
202 (dp)->softlimit = SMB_QUOTAS_NO_SPACE;\
203 (dp)->hardlimit = SMB_QUOTAS_NO_SPACE;\
204 (dp)->isoftlimit = SMB_QUOTAS_NO_SPACE;\
205 (dp)->ihardlimit = SMB_QUOTAS_NO_SPACE;\
208 typedef struct _SMB_DISK_QUOTA {
209 enum SMB_QUOTA_TYPE qtype;
210 SMB_BIG_UINT bsize;
211 SMB_BIG_UINT hardlimit; /* In bsize units. */
212 SMB_BIG_UINT softlimit; /* In bsize units. */
213 SMB_BIG_UINT curblocks; /* In bsize units. */
214 SMB_BIG_UINT ihardlimit; /* inode hard limit. */
215 SMB_BIG_UINT isoftlimit; /* inode soft limit. */
216 SMB_BIG_UINT curinodes; /* Current used inodes. */
217 uint32 qflags;
218 } SMB_DISK_QUOTA;
220 #endif /*_SYSQUOTAS_H */