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
63 #if !(defined(__svr4__) || defined(HAVE_DQB_BTIMELIMIT))
64 #define dqb_btimelimit dqb_btime
65 #endif /* ! __svr4__ || HAVE_DQB_BTIMELIMIT */
67 #if defined(linux) || defined(ultrix) || defined(HAVE_QUOTA_H)
68 #ifndef NEED_QUOTACTL_WRAPPER
69 /*#include <sys/quota.h>*/
70 /*long quotactl (int, const char *, unsigned int, caddr_t); */
71 /* extern long quotactl (int, const char *, long, caddr_t); */
73 #else /* ! NEED_QUOTACTL_WRAPPER */
74 #include <asm/types.h>
75 #include <asm/unistd.h>
76 #include <linux/quota.h>
77 #endif /* ! NEED_QUOTACTL_WRAPPER */
78 #endif /* linux || ultrix || HAVE_QUOTA_H */
81 #include <sys/fs/ufs_quota.h>
85 #include <ufs/ufs/quota.h>
88 #ifdef HAVE_UFS_QUOTA_H
89 #include <ufs/quota.h>
90 #endif /* HAVE_UFS_QUOTA_H */
93 #include <jfs/quota.h>
97 #include <sys/types.h>
99 #include "directory.h"
106 /* definitions from sys/quota.h */
107 #define USRQUOTA 0 /* element used for user quotas */
108 #define GRPQUOTA 1 /* element used for group quotas */
111 * Command definitions for the 'quotactl' system call.
112 * The commands are broken into a main command defined below
113 * and a subcommand that is used to convey the type of
114 * quota that is being manipulated (see above).
116 #define SUBCMDMASK 0x00ff
117 #define SUBCMDSHIFT 8
118 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
120 /* declare an internal version of the quota block struct */
121 typedef u_int64_t qsize_t; /* Type in which we store size limitations */
122 typedef u_int32_t qid_t; /* Type in which we store ids in memory */
126 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
127 qsize_t dqb_isoftlimit; /* preferred inode limit */
128 qsize_t dqb_curinodes; /* current # allocated inodes */
129 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
130 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
131 qsize_t dqb_curblocks; /* current block count */
132 time_t dqb_btime; /* time limit for excessive disk use */
133 time_t dqb_itime; /* time limit for excessive inode use */
136 /* API v1 command definitions */
137 #define Q_V1_GETQUOTA 0x0300
138 #define Q_V1_SYNC 0x0600
139 #define Q_V1_SETQLIM 0x0700
140 #define Q_V1_GETSTATS 0x0800
141 /* API v2 command definitions */
142 #define Q_V2_SYNC 0x0600
143 #define Q_V2_SETQLIM 0x0700
144 #define Q_V2_GETQUOTA 0x0D00
145 #define Q_V2_GETSTATS 0x1100
146 /* proc API command definitions */
147 #define Q_V3_SYNC 0x800001
148 #define Q_V3_GETQUOTA 0x800007
149 #define Q_V3_SETQUOTA 0x800008
151 /* Interface versions */
152 #define IFACE_UNSET 0
153 #define IFACE_VFSOLD 1
154 #define IFACE_VFSV0 2
155 #define IFACE_GENERIC 3
157 #define DEV_QBSIZE 1024
160 u_int64_t dqb_bhardlimit;
161 u_int64_t dqb_bsoftlimit;
162 u_int64_t dqb_curspace;
163 u_int64_t dqb_ihardlimit;
164 u_int64_t dqb_isoftlimit;
165 u_int64_t dqb_curinodes;
172 unsigned int dqb_ihardlimit;
173 unsigned int dqb_isoftlimit;
174 unsigned int dqb_curinodes;
175 unsigned int dqb_bhardlimit;
176 unsigned int dqb_bsoftlimit;
177 qsize_t dqb_curspace;
187 u_int32_t cache_hits;
188 u_int32_t allocated_dquots;
189 u_int32_t free_dquots;
195 u_int32_t dqb_bhardlimit;
196 u_int32_t dqb_bsoftlimit;
197 u_int32_t dqb_curblocks;
198 u_int32_t dqb_ihardlimit;
199 u_int32_t dqb_isoftlimit;
200 u_int32_t dqb_curinodes;
205 extern long quotactl (unsigned int, const char *, int, caddr_t);
211 extern int getnfsquota (struct vol *, const int, const u_int32_t,
214 extern int uquota_getvolspace (struct vol *, VolSpace *, VolSpace *,
216 #endif /* NO_QUOTA_SUPPORT */
218 extern struct afp_options default_options;
220 extern int gmem (const gid_t);
221 extern int setdeskmode (const mode_t);
222 extern int setdirunixmode (const struct vol *, const char *, mode_t);
223 extern int setdirmode (const struct vol *, const char *, mode_t);
224 extern int setdeskowner (const uid_t, const gid_t);
225 extern int setdirowner (const struct vol *, const char *, const uid_t, const gid_t);
226 extern int setfilunixmode (const struct vol *, struct path*, const mode_t);
227 extern int setfilowner (const struct vol *, const uid_t, const gid_t, struct path*);
228 extern void accessmode (char *, struct maccess *, struct dir *, struct stat *);
231 #define accessmode afsmode