r6369: update release notes
[Samba.git] / source / tests / sysquotas.c
blob48a34feb13e8703ba0e42a6d0a99ecd3670273f7
1 /* this test should find out what quota api is available on the os */
3 int autoconf_quota(void);
5 #if defined(HAVE_QUOTACTL_4A)
6 /* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */
8 #ifdef HAVE_SYS_TYPES_H
9 #include <sys/types.h>
10 #endif
12 #ifdef HAVE_ASM_TYPES_H
13 #include <asm/types.h>
14 #endif
16 #if defined(HAVE_LINUX_QUOTA_H)
17 # include <linux/quota.h>
18 # if defined(HAVE_STRUCT_IF_DQBLK)
19 # define SYS_DQBLK if_dqblk
20 # elif defined(HAVE_STRUCT_MEM_DQBLK)
21 # define SYS_DQBLK mem_dqblk
22 # endif
23 #elif defined(HAVE_SYS_QUOTA_H)
24 # include <sys/quota.h>
25 #endif
27 #ifndef SYS_DQBLK
28 #define SYS_DQBLK dqblk
29 #endif
31 int autoconf_quota(void)
33 int ret = -1;
34 struct SYS_DQBLK D;
36 ret = quotactl(Q_GETQUOTA,"/dev/hda1",0,(void *)&D);
38 return ret;
41 #elif defined(HAVE_QUOTACTL_4B)
42 /* int quotactl(const char *path, int cmd, int id, char *addr); */
44 #ifdef HAVE_SYS_QUOTA_H
45 #include <sys/quota.h>
46 #else /* *BSD */
47 #include <sys/types.h>
48 #include <ufs/ufs/quota.h>
49 #include <machine/param.h>
50 #endif
52 int autoconf_quota(void)
54 int ret = -1;
55 struct dqblk D;
57 ret = quotactl("/",Q_GETQUOTA,0,(char *) &D);
59 return ret;
62 #elif defined(HAVE_QUOTACTL_3)
63 /* int quotactl (char *spec, int request, char *arg); */
65 #ifdef HAVE_SYS_TYPES_H
66 #include <sys/types.h>
67 #endif
68 #ifdef HAVE_SYS_QUOTA_H
69 #include <sys/quota.h>
70 #endif
72 int autoconf_quota(void)
74 int ret = -1;
75 struct q_request request;
77 ret = quotactl("/", Q_GETQUOTA, &request);
79 return ret;
82 #elif defined(HAVE_QUOTACTL_2)
84 #error HAVE_QUOTACTL_2 not implemented
86 #else
88 #error Unknow QUOTACTL prototype
90 #endif
92 int main(void)
94 autoconf_quota();
95 return 0;