2 * $Id: unix.h,v 1.23 2010-04-12 14:28:47 franklahm Exp $
8 #ifdef HAVE_SYS_CDEFS_H
10 #endif /* HAVE_SYS_CDEFS_H */
11 #include <netatalk/endian.h>
15 #if defined( sun ) && !defined( __svr4__ )
19 #endif /*sun __svr4__*/
21 #if defined(HAVE_SYS_VFS_H) || defined( sun ) || defined( ibm032 )
23 #endif /* HAVE_SYS_VFS_H || sun || ibm032 */
25 #if defined(_IBMR2) || defined(HAVE_STATFS_H)
26 #include <sys/statfs.h>
27 /* this might not be right. */
28 #define f_mntfromname f_fname
29 #endif /* _IBMR2 || HAVE_STATFS_H */
32 #define f_frsize f_fsize
34 /* temp fix, was: defined(HAVE_SYS_STATVFS) || defined(__svr4__) */
35 #if defined(__svr4__) || (defined(__NetBSD__) && (__NetBSD_Version__ >= 200040000))
36 #include <sys/statvfs.h>
37 #define statfs statvfs
38 #else /* HAVE_SYS_STATVFS || __svr4__ */
39 #define f_frsize f_bsize
40 #endif /* USE_STATVFS_H */
43 #if defined(__svr4__) || defined(HAVE_SYS_MNTTAB_H)
44 #include <sys/mnttab.h>
45 #endif /* __svr4__ || HAVE_SYS_MNTTAB_H */
47 #if defined(__DragonFly__)
48 #define dqblk ufs_dqblk
51 #if defined(HAVE_SYS_MOUNT_H) || defined(BSD4_4) || \
52 defined(linux) || defined(ultrix)
53 #include <sys/mount.h>
54 #endif /* HAVE_SYS_MOUNT_H || BSD4_4 || linux || ultrix */
56 #if defined(linux) || defined(HAVE_MNTENT_H)
58 #endif /* linux || HAVE_MNTENT_H */
61 #ifndef NO_QUOTA_SUPPORT
62 #if !defined(HAVE_LIBQUOTA)
64 #if !(defined(__svr4__) || defined(HAVE_DQB_BTIMELIMIT))
65 #define dqb_btimelimit dqb_btime
66 #endif /* ! __svr4__ || HAVE_DQB_BTIMELIMIT */
68 #if defined(linux) || defined(ultrix) || defined(HAVE_QUOTA_H)
69 #ifndef NEED_QUOTACTL_WRAPPER
70 /*#include <sys/quota.h>*/
71 /*long quotactl (int, const char *, unsigned int, caddr_t); */
72 /* extern long quotactl (int, const char *, long, caddr_t); */
74 #else /* ! NEED_QUOTACTL_WRAPPER */
75 #include <asm/types.h>
76 #include <asm/unistd.h>
77 #include <linux/quota.h>
78 #endif /* ! NEED_QUOTACTL_WRAPPER */
79 #endif /* linux || ultrix || HAVE_QUOTA_H */
82 #include <sys/fs/ufs_quota.h>
86 #include <ufs/ufs/quota.h>
89 #ifdef HAVE_UFS_QUOTA_H
90 #include <ufs/quota.h>
91 #endif /* HAVE_UFS_QUOTA_H */
94 #include <jfs/quota.h>
98 #include <sys/types.h>
100 #include "directory.h"
107 /* definitions from sys/quota.h */
108 #define USRQUOTA 0 /* element used for user quotas */
109 #define GRPQUOTA 1 /* element used for group quotas */
112 * Command definitions for the 'quotactl' system call.
113 * The commands are broken into a main command defined below
114 * and a subcommand that is used to convey the type of
115 * quota that is being manipulated (see above).
117 #define SUBCMDMASK 0x00ff
118 #define SUBCMDSHIFT 8
119 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
121 /* declare an internal version of the quota block struct */
122 typedef u_int64_t qsize_t; /* Type in which we store size limitations */
123 typedef u_int32_t qid_t; /* Type in which we store ids in memory */
127 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
128 qsize_t dqb_isoftlimit; /* preferred inode limit */
129 qsize_t dqb_curinodes; /* current # allocated inodes */
130 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
131 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
132 qsize_t dqb_curblocks; /* current block count */
133 time_t dqb_btime; /* time limit for excessive disk use */
134 time_t dqb_itime; /* time limit for excessive inode use */
137 /* API v1 command definitions */
138 #define Q_V1_GETQUOTA 0x0300
139 #define Q_V1_SYNC 0x0600
140 #define Q_V1_SETQLIM 0x0700
141 #define Q_V1_GETSTATS 0x0800
142 /* API v2 command definitions */
143 #define Q_V2_SYNC 0x0600
144 #define Q_V2_SETQLIM 0x0700
145 #define Q_V2_GETQUOTA 0x0D00
146 #define Q_V2_GETSTATS 0x1100
147 /* proc API command definitions */
148 #define Q_V3_SYNC 0x800001
149 #define Q_V3_GETQUOTA 0x800007
150 #define Q_V3_SETQUOTA 0x800008
152 /* Interface versions */
153 #define IFACE_UNSET 0
154 #define IFACE_VFSOLD 1
155 #define IFACE_VFSV0 2
156 #define IFACE_GENERIC 3
158 #define DEV_QBSIZE 1024
161 u_int64_t dqb_bhardlimit;
162 u_int64_t dqb_bsoftlimit;
163 u_int64_t dqb_curspace;
164 u_int64_t dqb_ihardlimit;
165 u_int64_t dqb_isoftlimit;
166 u_int64_t dqb_curinodes;
173 unsigned int dqb_ihardlimit;
174 unsigned int dqb_isoftlimit;
175 unsigned int dqb_curinodes;
176 unsigned int dqb_bhardlimit;
177 unsigned int dqb_bsoftlimit;
178 qsize_t dqb_curspace;
188 u_int32_t cache_hits;
189 u_int32_t allocated_dquots;
190 u_int32_t free_dquots;
196 u_int32_t dqb_bhardlimit;
197 u_int32_t dqb_bsoftlimit;
198 u_int32_t dqb_curblocks;
199 u_int32_t dqb_ihardlimit;
200 u_int32_t dqb_isoftlimit;
201 u_int32_t dqb_curinodes;
206 extern long quotactl (unsigned int, const char *, int, caddr_t);
212 extern int getnfsquota (struct vol *, const int, const u_int32_t,
215 #endif /* ! HAVE_LIBQUOTA */
216 extern int uquota_getvolspace (struct vol *, VolSpace *, VolSpace *,
218 #endif /* NO_QUOTA_SUPPORT */
220 extern struct afp_options default_options;
222 extern int gmem (const gid_t);
223 extern int setdeskmode (const mode_t);
224 extern int setdirunixmode (const struct vol *, const char *, mode_t);
225 extern int setdirmode (const struct vol *, const char *, mode_t);
226 extern int setdeskowner (const uid_t, const gid_t);
227 extern int setdirowner (const struct vol *, const char *, const uid_t, const gid_t);
228 extern int setfilunixmode (const struct vol *, struct path*, const mode_t);
229 extern int setfilowner (const struct vol *, const uid_t, const gid_t, struct path*);
230 extern void accessmode (char *, struct maccess *, struct dir *, struct stat *);
233 #define accessmode afsmode