1/* 2 Unix SMB/CIFS implementation. 3 NT 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 2 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 _NTQUOTAS_H 22#define _NTQUOTAS_H 23 24/* 25 * details for Quota Flags: 26 * 27 * 0x20 Log Limit: log if the user exceeds his Hard Quota 28 * 0x10 Log Warn: log if the user exceeds his Soft Quota 29 * 0x02 Deny Disk: deny disk access when the user exceeds his Hard Quota 30 * 0x01 Enable Quotas: enable quota for this fs 31 * 32 */ 33 34#define QUOTAS_ENABLED 0x0001 35#define QUOTAS_DENY_DISK 0x0002 36#define QUOTAS_LOG_VIOLATIONS 0x0004 37#define CONTENT_INDEX_DISABLED 0x0008 38#define QUOTAS_LOG_THRESHOLD 0x0010 39#define QUOTAS_LOG_LIMIT 0x0020 40#define LOG_VOLUME_THRESHOLD 0x0040 41#define LOG_VOLUME_LIMIT 0x0080 42#define QUOTAS_INCOMPLETE 0x0100 43#define QUOTAS_REBUILDING 0x0200 44#define QUOTAS_0400 0x0400 45#define QUOTAS_0800 0x0800 46#define QUOTAS_1000 0x1000 47#define QUOTAS_2000 0x2000 48#define QUOTAS_4000 0x4000 49#define QUOTAS_8000 0x8000 50 51#define SMB_NTQUOTAS_NO_LIMIT ((SMB_BIG_UINT)(-1)) 52#define SMB_NTQUOTAS_NO_ENTRY ((SMB_BIG_UINT)(-2)) 53#define SMB_NTQUOTAS_NO_SPACE ((SMB_BIG_UINT)(0)) 54#define SMB_NTQUOTAS_1_B (SMB_BIG_UINT)0x0000000000000001 55#define SMB_NTQUOTAS_1KB (SMB_BIG_UINT)0x0000000000000400 56#define SMB_NTQUOTAS_1MB (SMB_BIG_UINT)0x0000000000100000 57#define SMB_NTQUOTAS_1GB (SMB_BIG_UINT)0x0000000040000000 58#define SMB_NTQUOTAS_1TB (SMB_BIG_UINT)0x0000010000000000 59#define SMB_NTQUOTAS_1PB (SMB_BIG_UINT)0x0004000000000000 60#define SMB_NTQUOTAS_1EB (SMB_BIG_UINT)0x1000000000000000 61 62enum SMB_QUOTA_TYPE { 63 SMB_INVALID_QUOTA_TYPE = -1, 64 SMB_USER_FS_QUOTA_TYPE = 1, 65 SMB_USER_QUOTA_TYPE = 2, 66 SMB_GROUP_FS_QUOTA_TYPE = 3,/* not used yet */ 67 SMB_GROUP_QUOTA_TYPE = 4 /* not in use yet, maybe for disk_free queries */ 68}; 69 70typedef struct _SMB_NTQUOTA_STRUCT { 71 enum SMB_QUOTA_TYPE qtype; 72 SMB_BIG_UINT usedspace; 73 SMB_BIG_UINT softlim; 74 SMB_BIG_UINT hardlim; 75 uint32 qflags; 76 DOM_SID sid; 77} SMB_NTQUOTA_STRUCT; 78 79typedef struct _SMB_NTQUOTA_LIST { 80 struct _SMB_NTQUOTA_LIST *prev,*next; 81 TALLOC_CTX *mem_ctx; 82 uid_t uid; 83 SMB_NTQUOTA_STRUCT *quotas; 84} SMB_NTQUOTA_LIST; 85 86typedef struct _SMB_NTQUOTA_HANDLE { 87 BOOL valid; 88 SMB_NTQUOTA_LIST *quota_list; 89 SMB_NTQUOTA_LIST *tmp_list; 90} SMB_NTQUOTA_HANDLE; 91 92#define CHECK_NTQUOTA_HANDLE_OK(fsp,conn) (FNUM_OK(fsp,conn) &&\ 93 (fsp)->fake_file_handle &&\ 94 ((fsp)->fake_file_handle->type == FAKE_FILE_TYPE_QUOTA) &&\ 95 (fsp)->fake_file_handle->pd) 96 97#endif /*_NTQUOTAS_H */ 98