~ubuntu-branches/ubuntu/breezy/quotatool/breezy

« back to all changes in this revision

Viewing changes to src/linux/linux_quota.h

  • Committer: Bazaar Package Importer
  • Author(s): Bas Zoetekouw
  • Date: 2005-05-11 11:24:21 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050511112421-o9o2ncth4ro9k08n
Tags: 1.4.7-1
* New upstream release
  - correctly detect XFS-enabled kernels (closes: #258289, #289812)
  - correctly display kBs instead of blocks in some cases
* Boosted Standards-Version to 3.6.1 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Mike Glover
 
3
 * mpg4@duluoz.net
 
4
 *
 
5
 * Johan Ekenberg
 
6
 * johan@ekenberg.se
 
7
 *
 
8
 * linux/quota.h
 
9
 * 
 
10
 * quota defs for linux
 
11
 * We don't use <linux/quota.h>
 
12
 */
 
13
 
 
14
#ifndef LINUX_QUOTA_H
 
15
#define LINUX_QUOTA_H
 
16
 
 
17
#include <sys/types.h>
 
18
#include "system.h"
 
19
 
 
20
typedef u_int32_t qid_t;        /* Type in which we store ids in memory */
 
21
typedef u_int64_t qsize_t;      /* Type in which we store size limitations */
 
22
 
 
23
#define MAXQUOTAS 2
 
24
#define USRQUOTA  0             /* element used for user quotas */
 
25
#define GRPQUOTA  1             /* element used for group quotas */
 
26
 
 
27
/*
 
28
 * Command definitions for the 'quotactl' system call.
 
29
 * The commands are broken into a main command defined below
 
30
 * and a subcommand that is used to convey the type of
 
31
 * quota that is being manipulated (see above).
 
32
 */
 
33
#define SUBCMDMASK  0x00ff
 
34
#define SUBCMDSHIFT 8
 
35
#define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
 
36
 
 
37
/* Interface versions */
 
38
#define IFACE_VFSOLD 1
 
39
#define IFACE_VFSV0 2
 
40
#define IFACE_GENERIC 3
 
41
 
 
42
/* _6_5_ are the older defs */
 
43
#define Q_6_5_SYNC     0x0600   /* sync disk copy of a filesystems quotas */
 
44
 
 
45
#if 0                           /* not used */
 
46
  #define Q_6_5_QUOTAOFF 0x0200 /* disable quotas */
 
47
  #define Q_6_5_QUOTAON  0x0100 /* enable quotas */
 
48
#endif
 
49
 
 
50
#define Q_SYNC     0x800001     /* sync disk copy of a filesystems quotas */
 
51
#if 0                           /* not used */
 
52
  #define Q_QUOTAON  0x800002     /* turn quotas on */
 
53
  #define Q_QUOTAOFF 0x800003     /* turn quotas off */
 
54
#endif
 
55
#define Q_GETFMT   0x800004     /* get quota format used on given filesystem */
 
56
#define Q_GETINFO  0x800005     /* get information about quota files */
 
57
#define Q_SETINFO  0x800006     /* set information about quota files */
 
58
#define Q_GETQUOTA 0x800007     /* get user quota structure */
 
59
#define Q_SETQUOTA 0x800008     /* set user quota structure */
 
60
 
 
61
/*
 
62
 * Quota structure used for communication with userspace via quotactl
 
63
 * Following flags are used to specify which fields are valid
 
64
 */
 
65
#define QIF_BLIMITS     1
 
66
#define QIF_SPACE       2
 
67
#define QIF_ILIMITS     4
 
68
#define QIF_INODES      8
 
69
#define QIF_BTIME       16
 
70
#define QIF_ITIME       32
 
71
#define QIF_LIMITS      (QIF_BLIMITS | QIF_ILIMITS)
 
72
#define QIF_USAGE       (QIF_SPACE | QIF_INODES)
 
73
#define QIF_TIMES       (QIF_BTIME | QIF_ITIME)
 
74
#define QIF_ALL         (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
 
75
 
 
76
 
 
77
/* The generic diskblock-struct: */
 
78
struct if_dqblk {
 
79
  u_int64_t dqb_bhardlimit;
 
80
  u_int64_t dqb_bsoftlimit;
 
81
  u_int64_t dqb_curspace;
 
82
  u_int64_t dqb_ihardlimit;
 
83
  u_int64_t dqb_isoftlimit;
 
84
  u_int64_t dqb_curinodes;
 
85
  u_int64_t dqb_btime;
 
86
  u_int64_t dqb_itime;
 
87
  u_int32_t dqb_valid;
 
88
};
 
89
 
 
90
/* version-specific info */
 
91
struct v1_mem_dqinfo {};
 
92
struct v2_mem_dqinfo {
 
93
  unsigned int dqi_blocks;
 
94
  unsigned int dqi_free_blk;
 
95
  unsigned int dqi_free_entry;
 
96
};
 
97
 
 
98
/* The generic diskinfo-struct: */
 
99
struct if_dqinfo {
 
100
  u_int64_t dqi_bgrace;
 
101
  u_int64_t dqi_igrace;
 
102
  u_int32_t dqi_flags;
 
103
  u_int32_t dqi_valid;
 
104
};
 
105
 
 
106
/* Ioctl for getting quota size */
 
107
#include <sys/ioctl.h>
 
108
#ifndef FIOQSIZE
 
109
        #if defined(__alpha__) || defined(__powerpc__) || defined(__sh__) || defined(__sparc__) || defined(__sparc64__)
 
110
                #define FIOQSIZE _IOR('f', 128, loff_t)
 
111
        #elif defined(__arm__) || defined(__mc68000__) || defined(__s390__)
 
112
                #define FIOQSIZE 0x545E
 
113
        #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__ia64__) || defined(__parisc__) || defined(__cris__) || defined(__hppa__)
 
114
                #define FIOQSIZE 0x5460
 
115
        #elif defined(__mips__) || defined(__mips64__)
 
116
                #define FIOQSIZE 0x6667
 
117
        #endif
 
118
#endif
 
119
 
 
120
long quotactl __P((int, const char *, qid_t, caddr_t));
 
121
 
 
122
/*
 
123
 * runtime detection of quota format
 
124
 */
 
125
 
 
126
/* Values for format handling */
 
127
#define QF_TOONEW -2            /* Quota format is too new to handle */
 
128
#define QF_ERROR -1             /* There was error while detecting format (maybe unknown format...) */
 
129
#define QF_VFSOLD 0             /* Old quota format */
 
130
#define QF_VFSV0 1              /* New quota format - version 0 */
 
131
#define QF_XFS 3                /* XFS quota */
 
132
 
 
133
#define KERN_KNOWN_QUOTA_VERSION (6*10000 + 5*100 + 0)
 
134
int kern_quota_format(fs_t *, int);
 
135
 
 
136
#include "dqblk_v1.h"
 
137
#include "dqblk_v2.h"
 
138
#include "xfs_quota.h"
 
139
 
 
140
#endif /* _QUOTA_ */
 
141
 
 
142
 
 
143
 
 
144
 
 
145
 
 
146
 
 
147
 
 
148
 
 
149
 
 
150
 
 
151
 
 
152
 
 
153