e014c21f8b7dcfc44f11997a579e3e5e25f99410
[tprouty/samba.git] / source3 / include / sysquotas.h
1 /* 
2     Unix SMB/CIFS implementation.
3     SYS QUOTA code constants
4     Copyright (C) Stefan (metze) Metzmacher     2003
5     
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 3 of the License, or
9     (at your option) any later version.
10     
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.
15     
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.
19 */
20  
21 #ifndef _SYSQUOTAS_H
22 #define _SYSQUOTAS_H
23  
24 #ifdef HAVE_SYS_QUOTAS
25
26 #if defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT)
27 #include <mntent.h>
28 #define HAVE_MNTENT 1
29 /*#endif defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT) */
30 #elif defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM)
31 #include <devnm.h>
32 #endif /* defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) */
33
34 #endif /* HAVE_SYS_QUOTAS */
35
36
37 /**************************************************
38  Some stuff for the sys_quota api.
39  **************************************************/ 
40
41 #define SMB_QUOTAS_NO_LIMIT     ((SMB_BIG_UINT)(0))
42 #define SMB_QUOTAS_NO_SPACE     ((SMB_BIG_UINT)(1))
43
44 #define SMB_QUOTAS_SET_NO_LIMIT(dp) \
45 {\
46         (dp)->softlimit = SMB_QUOTAS_NO_LIMIT;\
47         (dp)->hardlimit = SMB_QUOTAS_NO_LIMIT;\
48         (dp)->isoftlimit = SMB_QUOTAS_NO_LIMIT;\
49         (dp)->ihardlimit = SMB_QUOTAS_NO_LIMIT;\
50 }
51
52 #define SMB_QUOTAS_SET_NO_SPACE(dp) \
53 {\
54         (dp)->softlimit = SMB_QUOTAS_NO_SPACE;\
55         (dp)->hardlimit = SMB_QUOTAS_NO_SPACE;\
56         (dp)->isoftlimit = SMB_QUOTAS_NO_SPACE;\
57         (dp)->ihardlimit = SMB_QUOTAS_NO_SPACE;\
58 }
59
60 typedef struct _SMB_DISK_QUOTA {
61         enum SMB_QUOTA_TYPE qtype;
62         SMB_BIG_UINT bsize;
63         SMB_BIG_UINT hardlimit; /* In bsize units. */
64         SMB_BIG_UINT softlimit; /* In bsize units. */
65         SMB_BIG_UINT curblocks; /* In bsize units. */
66         SMB_BIG_UINT ihardlimit; /* inode hard limit. */
67         SMB_BIG_UINT isoftlimit; /* inode soft limit. */
68         SMB_BIG_UINT curinodes; /* Current used inodes. */
69         uint32       qflags;
70 } SMB_DISK_QUOTA;
71
72 #ifndef QUOTABLOCK_SIZE
73 #define QUOTABLOCK_SIZE 1024
74 #endif
75
76 #endif /*_SYSQUOTAS_H */