s3: add sysquotas_4B support
[Samba/gebeck_regimport.git] / source3 / tests / sysquotas.c
blob53d3a67aa1bc73fefde5d81f1324f590428545b0
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 autoconf_quota(void)
35 int ret = -1;
36 struct SYS_DQBLK D;
38 ret = quotactl(Q_GETQUOTA,"/dev/hda1",0,(void *)&D);
40 return ret;
43 #elif defined(HAVE_QUOTACTL_4B)
44 /* int quotactl(const char *path, int cmd, int id, char *addr); */
46 #ifdef HAVE_SYS_TYPES_H
47 #include <sys/types.h>
48 #endif
50 #ifdef HAVE_SYS_QUOTA_H
51 #include <sys/quota.h>
52 #else /* *BSD */
53 #include <sys/types.h>
54 #include <ufs/ufs/quota.h>
55 #include <machine/param.h>
56 #endif
58 int autoconf_quota(void)
60 int ret = -1;
61 struct dqblk D;
63 ret = quotactl("/",Q_GETQUOTA,0,(char *) &D);
65 return ret;
68 #elif defined(HAVE_QUOTACTL_3)
69 /* int quotactl (char *spec, int request, char *arg); */
71 #ifdef HAVE_SYS_TYPES_H
72 #include <sys/types.h>
73 #endif
74 #ifdef HAVE_SYS_QUOTA_H
75 #include <sys/quota.h>
76 #endif
78 int autoconf_quota(void)
80 int ret = -1;
81 struct q_request request;
83 ret = quotactl("/", Q_GETQUOTA, &request);
85 return ret;
88 #elif defined(HAVE_QUOTACTL_2)
90 #error HAVE_QUOTACTL_2 not implemented
92 #else
94 #error Unknow QUOTACTL prototype
96 #endif
98 int main(void)
100 autoconf_quota();
101 return 0;