| 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, see <http://www.gnu.org/licenses/>.
 | 
|---|
| 18 | */
 | 
|---|
| 19 |  
 | 
|---|
| 20 | #ifndef _SYSQUOTAS_H
 | 
|---|
| 21 | #define _SYSQUOTAS_H
 | 
|---|
| 22 |  
 | 
|---|
| 23 | #ifdef HAVE_SYS_QUOTAS
 | 
|---|
| 24 | 
 | 
|---|
| 25 | #if defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT)
 | 
|---|
| 26 | #include <mntent.h>
 | 
|---|
| 27 | #define HAVE_MNTENT 1
 | 
|---|
| 28 | /*#endif defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT) */
 | 
|---|
| 29 | #elif defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM)
 | 
|---|
| 30 | #include <devnm.h>
 | 
|---|
| 31 | #endif /* defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) */
 | 
|---|
| 32 | 
 | 
|---|
| 33 | #endif /* HAVE_SYS_QUOTAS */
 | 
|---|
| 34 | 
 | 
|---|
| 35 | 
 | 
|---|
| 36 | /**************************************************
 | 
|---|
| 37 |  Some stuff for the sys_quota api.
 | 
|---|
| 38 |  **************************************************/ 
 | 
|---|
| 39 | 
 | 
|---|
| 40 | #define SMB_QUOTAS_NO_LIMIT     ((uint64_t)(0))
 | 
|---|
| 41 | #define SMB_QUOTAS_NO_SPACE     ((uint64_t)(1))
 | 
|---|
| 42 | 
 | 
|---|
| 43 | #define SMB_QUOTAS_SET_NO_LIMIT(dp) \
 | 
|---|
| 44 | {\
 | 
|---|
| 45 |         (dp)->softlimit = SMB_QUOTAS_NO_LIMIT;\
 | 
|---|
| 46 |         (dp)->hardlimit = SMB_QUOTAS_NO_LIMIT;\
 | 
|---|
| 47 |         (dp)->isoftlimit = SMB_QUOTAS_NO_LIMIT;\
 | 
|---|
| 48 |         (dp)->ihardlimit = SMB_QUOTAS_NO_LIMIT;\
 | 
|---|
| 49 | }
 | 
|---|
| 50 | 
 | 
|---|
| 51 | #define SMB_QUOTAS_SET_NO_SPACE(dp) \
 | 
|---|
| 52 | {\
 | 
|---|
| 53 |         (dp)->softlimit = SMB_QUOTAS_NO_SPACE;\
 | 
|---|
| 54 |         (dp)->hardlimit = SMB_QUOTAS_NO_SPACE;\
 | 
|---|
| 55 |         (dp)->isoftlimit = SMB_QUOTAS_NO_SPACE;\
 | 
|---|
| 56 |         (dp)->ihardlimit = SMB_QUOTAS_NO_SPACE;\
 | 
|---|
| 57 | }
 | 
|---|
| 58 | 
 | 
|---|
| 59 | typedef struct _SMB_DISK_QUOTA {
 | 
|---|
| 60 |         enum SMB_QUOTA_TYPE qtype;
 | 
|---|
| 61 |         uint64_t bsize;
 | 
|---|
| 62 |         uint64_t hardlimit; /* In bsize units. */
 | 
|---|
| 63 |         uint64_t softlimit; /* In bsize units. */
 | 
|---|
| 64 |         uint64_t curblocks; /* In bsize units. */
 | 
|---|
| 65 |         uint64_t ihardlimit; /* inode hard limit. */
 | 
|---|
| 66 |         uint64_t isoftlimit; /* inode soft limit. */
 | 
|---|
| 67 |         uint64_t curinodes; /* Current used inodes. */
 | 
|---|
| 68 |         uint32_t       qflags;
 | 
|---|
| 69 | } SMB_DISK_QUOTA;
 | 
|---|
| 70 | 
 | 
|---|
| 71 | #ifndef QUOTABLOCK_SIZE
 | 
|---|
| 72 | #define QUOTABLOCK_SIZE 1024
 | 
|---|
| 73 | #endif
 | 
|---|
| 74 | 
 | 
|---|
| 75 | #endif /*_SYSQUOTAS_H */
 | 
|---|