1 | /* $Id: quota.h,v 1.5 2001-04-26 16:44:58 ghudson Exp $ */ |
---|
2 | |
---|
3 | /* Copyright 1999 by the Massachusetts Institute of Technology. |
---|
4 | * |
---|
5 | * Permission to use, copy, modify, and distribute this |
---|
6 | * software and its documentation for any purpose and without |
---|
7 | * fee is hereby granted, provided that the above copyright |
---|
8 | * notice appear in all copies and that both that copyright |
---|
9 | * notice and this permission notice appear in supporting |
---|
10 | * documentation, and that the name of M.I.T. not be used in |
---|
11 | * advertising or publicity pertaining to distribution of the |
---|
12 | * software without specific, written prior permission. |
---|
13 | * M.I.T. makes no representations about the suitability of |
---|
14 | * this software for any purpose. It is provided "as is" |
---|
15 | * without express or implied warranty. |
---|
16 | */ |
---|
17 | |
---|
18 | /* Include the appropriate files to get the definition of a |
---|
19 | * struct dqblk (and the quotactl function). |
---|
20 | */ |
---|
21 | |
---|
22 | #ifdef IRIX |
---|
23 | #include <sys/types.h> |
---|
24 | #include <sys/quota.h> |
---|
25 | #endif |
---|
26 | |
---|
27 | #ifdef SOLARIS |
---|
28 | #include <sys/fs/ufs_quota.h> |
---|
29 | #endif |
---|
30 | |
---|
31 | #ifdef LINUX |
---|
32 | #include <sys/types.h> |
---|
33 | #include <sys/quota.h> |
---|
34 | #endif |
---|
35 | |
---|
36 | #ifdef NETBSD |
---|
37 | #include <sys/types.h> |
---|
38 | #include <ufs/ufs/quota.h> |
---|
39 | #define BSD_QUOTACTL |
---|
40 | #endif |
---|
41 | |
---|
42 | #ifdef OSF |
---|
43 | #include <sys/types.h> |
---|
44 | #include <sys/mount.h> |
---|
45 | #include <ufs/quota.h> |
---|
46 | #define BSD_QUOTACTL |
---|
47 | #endif |
---|
48 | |
---|
49 | |
---|
50 | /* Deal with structure element naming across OSes. */ |
---|
51 | |
---|
52 | #ifdef DQBLK_USES_INODES |
---|
53 | #define dqb_fsoftlimit dqb_isoftlimit |
---|
54 | #define dqb_fhardlimit dqb_ihardlimit |
---|
55 | #define dqb_curfiles dqb_curinodes |
---|
56 | #endif |
---|
57 | |
---|
58 | #ifdef DQBLK_USES_TIME |
---|
59 | #define dqb_btimelimit dqb_btime |
---|
60 | #ifdef DQBLK_USES_INODES |
---|
61 | #define dqb_ftimelimit dqb_itime |
---|
62 | #else |
---|
63 | #define dqb_ftimelimit dqb_ftime |
---|
64 | #endif |
---|
65 | #endif |
---|
66 | |
---|
67 | |
---|
68 | struct quota_fs { |
---|
69 | char *device; /* Device special file, or /afs pathname */ |
---|
70 | char *mount; /* Mountpoint */ |
---|
71 | char *type; /* Filesystem type */ |
---|
72 | int have_quota; /* User has a quota for this filesystem */ |
---|
73 | int have_blocks; /* Filesystem has block quotas */ |
---|
74 | int warn_blocks; /* User is near or over block quota */ |
---|
75 | int have_files; /* Filesystem has file quotas */ |
---|
76 | int warn_files; /* User is near or over file quota */ |
---|
77 | struct dqblk dqb; /* Quota details */ |
---|
78 | }; |
---|
79 | |
---|
80 | struct quota_fs *get_fslist(uid_t uid); |
---|
81 | |
---|
82 | int get_afs_quota(struct quota_fs *fs, uid_t uid, int verbose); |
---|
83 | int get_nfs_quota(struct quota_fs *fs, uid_t uid, int verbose); |
---|
84 | int get_local_quota(struct quota_fs *fs, uid_t uid, int verbose); |
---|
85 | |
---|
86 | void print_afs_warning(struct quota_fs *fs); |
---|
87 | void print_mounted_warning(struct quota_fs *fs); |
---|