9 #if defined( sun ) && !defined( __svr4__ )
13 #endif /*sun __svr4__*/
15 #if defined(HAVE_SYS_VFS_H) || defined( sun ) || defined( ibm032 )
17 #endif /* HAVE_SYS_VFS_H || sun || ibm032 */
19 #if defined(_IBMR2) || defined(HAVE_STATFS_H)
20 #include <sys/statfs.h>
21 /* this might not be right. */
22 #define f_mntfromname f_fname
23 #endif /* _IBMR2 || HAVE_STATFS_H */
26 #define f_frsize f_fsize
28 /* temp fix, was: defined(HAVE_SYS_STATVFS) || defined(__svr4__) */
29 #if defined(__svr4__) || (defined(__NetBSD__) && (__NetBSD_Version__ >= 200040000))
30 #include <sys/statvfs.h>
31 #define statfs statvfs
32 #else /* HAVE_SYS_STATVFS || __svr4__ */
33 #define f_frsize f_bsize
34 #endif /* USE_STATVFS_H */
37 #if defined(__svr4__) || defined(HAVE_SYS_MNTTAB_H)
38 #include <sys/mnttab.h>
39 #endif /* __svr4__ || HAVE_SYS_MNTTAB_H */
41 #if defined(__DragonFly__)
42 #define dqblk ufs_dqblk
45 #if defined(HAVE_SYS_MOUNT_H) || defined(BSD4_4) || \
46 defined(linux) || defined(ultrix)
47 #include <sys/mount.h>
48 #endif /* HAVE_SYS_MOUNT_H || BSD4_4 || linux || ultrix */
50 #if defined(linux) || defined(HAVE_MNTENT_H)
52 #endif /* linux || HAVE_MNTENT_H */
55 #ifndef NO_QUOTA_SUPPORT
56 #if !defined(HAVE_LIBQUOTA)
58 #if !(defined(__svr4__) || defined(HAVE_DQB_BTIMELIMIT))
59 #define dqb_btimelimit dqb_btime
60 #endif /* ! __svr4__ || HAVE_DQB_BTIMELIMIT */
62 #if defined(linux) || defined(ultrix) || defined(HAVE_QUOTA_H)
63 #ifndef NEED_QUOTACTL_WRAPPER
64 /*#include <sys/quota.h>*/
65 /*long quotactl (int, const char *, unsigned int, caddr_t); */
66 /* extern long quotactl (int, const char *, long, caddr_t); */
68 #else /* ! NEED_QUOTACTL_WRAPPER */
69 #include <asm/types.h>
70 #include <asm/unistd.h>
71 #include <linux/quota.h>
72 #endif /* ! NEED_QUOTACTL_WRAPPER */
73 #endif /* linux || ultrix || HAVE_QUOTA_H */
76 #include <sys/fs/ufs_quota.h>
80 #include <ufs/ufs/quota.h>
83 #ifdef HAVE_UFS_QUOTA_H
84 #include <ufs/quota.h>
85 #endif /* HAVE_UFS_QUOTA_H */
88 #include <jfs/quota.h>
92 #include <sys/types.h>
94 #include "directory.h"
101 /* definitions from sys/quota.h */
102 #define USRQUOTA 0 /* element used for user quotas */
103 #define GRPQUOTA 1 /* element used for group quotas */
106 * Command definitions for the 'quotactl' system call.
107 * The commands are broken into a main command defined below
108 * and a subcommand that is used to convey the type of
109 * quota that is being manipulated (see above).
111 #define SUBCMDMASK 0x00ff
112 #define SUBCMDSHIFT 8
113 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
115 /* declare an internal version of the quota block struct */
116 typedef u_int64_t qsize_t; /* Type in which we store size limitations */
117 typedef u_int32_t qid_t; /* Type in which we store ids in memory */
121 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
122 qsize_t dqb_isoftlimit; /* preferred inode limit */
123 qsize_t dqb_curinodes; /* current # allocated inodes */
124 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
125 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
126 qsize_t dqb_curblocks; /* current block count */
127 time_t dqb_btime; /* time limit for excessive disk use */
128 time_t dqb_itime; /* time limit for excessive inode use */
131 /* API v1 command definitions */
132 #define Q_V1_GETQUOTA 0x0300
133 #define Q_V1_SYNC 0x0600
134 #define Q_V1_SETQLIM 0x0700
135 #define Q_V1_GETSTATS 0x0800
136 /* API v2 command definitions */
137 #define Q_V2_SYNC 0x0600
138 #define Q_V2_SETQLIM 0x0700
139 #define Q_V2_GETQUOTA 0x0D00
140 #define Q_V2_GETSTATS 0x1100
141 /* proc API command definitions */
142 #define Q_V3_SYNC 0x800001
143 #define Q_V3_GETQUOTA 0x800007
144 #define Q_V3_SETQUOTA 0x800008
146 /* Interface versions */
147 #define IFACE_UNSET 0
148 #define IFACE_VFSOLD 1
149 #define IFACE_VFSV0 2
150 #define IFACE_GENERIC 3
152 #define DEV_QBSIZE 1024
155 u_int64_t dqb_bhardlimit;
156 u_int64_t dqb_bsoftlimit;
157 u_int64_t dqb_curspace;
158 u_int64_t dqb_ihardlimit;
159 u_int64_t dqb_isoftlimit;
160 u_int64_t dqb_curinodes;
167 unsigned int dqb_ihardlimit;
168 unsigned int dqb_isoftlimit;
169 unsigned int dqb_curinodes;
170 unsigned int dqb_bhardlimit;
171 unsigned int dqb_bsoftlimit;
172 qsize_t dqb_curspace;
182 u_int32_t cache_hits;
183 u_int32_t allocated_dquots;
184 u_int32_t free_dquots;
190 u_int32_t dqb_bhardlimit;
191 u_int32_t dqb_bsoftlimit;
192 u_int32_t dqb_curblocks;
193 u_int32_t dqb_ihardlimit;
194 u_int32_t dqb_isoftlimit;
195 u_int32_t dqb_curinodes;
200 extern long quotactl (unsigned int, const char *, int, caddr_t);
206 extern int getnfsquota (struct vol *, const int, const uint32_t,
209 #endif /* ! HAVE_LIBQUOTA */
210 extern int uquota_getvolspace (const AFPObj *obj, struct vol *, VolSpace *, VolSpace *,
212 #endif /* NO_QUOTA_SUPPORT */
214 extern struct afp_options default_options;
216 extern int setdirunixmode (const struct vol *, const char *, mode_t);
217 extern int setdirmode (const struct vol *, const char *, mode_t);
218 extern int setdirowner (const struct vol *, const char *, const uid_t, const gid_t);
219 extern int setfilunixmode (const struct vol *, struct path*, const mode_t);
220 extern int setfilowner (const struct vol *, const uid_t, const gid_t, struct path*);
221 extern void accessmode (const AFPObj *obj, const struct vol *, char *, struct maccess *, struct dir *, struct stat *);
224 #define accessmode afsmode