source: branches/samba-3.0/source/include/samba_linux_quota.h@ 140

Last change on this file since 140 was 1, checked in by Paul Smedley, 19 years ago

Initial code import

File size: 10.7 KB
Line 
1#ifndef _SAMBA_LINUX_QUOTA_H_
2#define _SAMBA_LINUX_QUOTA_H_
3/*
4 Unix SMB/CIFS implementation.
5 Copyright (C) Andrew Tridgell 1994-2002
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22/*
23 This file is needed because Quota support on Linux has
24 been broken since Linus kernel 2.4.x. It will only get
25 better (and this file be removed) when all the distributions
26 ship a glibc with a working quota.h file. This is very
27 bad. JRA.
28
29 Original file came from Christoph Hellwig <[email protected]>.
30 Massaged into one nasty include file (to stop us having to
31 add multiple files into Samba just for Linux braindamage)
32 by JRA.
33*/
34
35#undef QUOTABLOCK_SIZE
36
37#ifndef _QUOTAIO_LINUX_V1
38#define _QUOTAIO_LINUX_V1
39
40/*
41 * Headerfile for old quotafile format
42 */
43
44#include <sys/types.h>
45
46#define V1_DQBLK_SIZE_BITS 10
47#define V1_DQBLK_SIZE (1 << V1_DQBLK_SIZE_BITS) /* Size of one quota block in bytes in old format */
48
49#define V1_DQOFF(__id) ((loff_t) ((__id) * sizeof(struct v1_disk_dqblk)))
50
51/* Structure of quota on disk */
52struct v1_disk_dqblk {
53 u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
54 u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */
55 u_int32_t dqb_curblocks; /* current block count */
56 u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */
57 u_int32_t dqb_isoftlimit; /* preferred limit on inodes */
58 u_int32_t dqb_curinodes; /* current # allocated inodes */
59 time_t dqb_btime; /* time limit for excessive disk use */
60 time_t dqb_itime; /* time limit for excessive files */
61} __attribute__ ((packed));
62
63/* Structure used for communication with kernel */
64struct v1_kern_dqblk {
65 u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
66 u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */
67 u_int32_t dqb_curblocks; /* current block count */
68 u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */
69 u_int32_t dqb_isoftlimit; /* preferred inode limit */
70 u_int32_t dqb_curinodes; /* current # allocated inodes */
71 time_t dqb_btime; /* time limit for excessive disk use */
72 time_t dqb_itime; /* time limit for excessive files */
73};
74
75struct v1_dqstats {
76 u_int32_t lookups;
77 u_int32_t drops;
78 u_int32_t reads;
79 u_int32_t writes;
80 u_int32_t cache_hits;
81 u_int32_t allocated_dquots;
82 u_int32_t free_dquots;
83 u_int32_t syncs;
84};
85
86#ifndef Q_V1_GETQUOTA
87#define Q_V1_GETQUOTA 0x300
88#endif
89#ifndef Q_V1_SETQUOTA
90#define Q_V1_SETQUOTA 0x400
91#endif
92
93#endif /* _QUOTAIO_LINUX_V1 */
94
95/*
96 *
97 * Header file for disk format of new quotafile format
98 *
99 */
100
101#ifndef _QUOTAIO_LINUX_V2
102#define _QUOTAIO_LINUX_V2
103
104#include <sys/types.h>
105
106#ifndef _QUOTA_LINUX
107#define _QUOTA_LINUX
108
109#include <sys/types.h>
110
111typedef u_int32_t qid_t; /* Type in which we store ids in memory */
112typedef u_int64_t qsize_t; /* Type in which we store size limitations */
113
114#define MAXQUOTAS 2
115#define USRQUOTA 0 /* element used for user quotas */
116#define GRPQUOTA 1 /* element used for group quotas */
117
118/*
119 * Definitions for the default names of the quotas files.
120 */
121#define INITQFNAMES { \