Apply the changes that Derrell Lipman supplied ...
[Samba/gebeck_regimport.git] / source3 / tests / sysquotas.c
blob2aa643326c0622925a0c1a7fb8b250bdde405f91
1 /* this test should find out what quota api is available on the os */
3 #if defined(HAVE_QUOTACTL_4A)
4 /* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */
6 #ifdef HAVE_SYS_TYPES_H
7 #include <sys/types.h>
8 #endif
10 #ifdef HAVE_ASM_TYPES_H
11 #include <asm/types.h>
12 #endif
14 #if defined(HAVE_LINUX_QUOTA_H)
15 # include <linux/quota.h>
16 # if defined(HAVE_STRUCT_IF_DQBLK)
17 # define SYS_DQBLK if_dqblk
18 # elif defined(HAVE_STRUCT_MEM_DQBLK)
19 # define SYS_DQBLK mem_dqblk
20 # endif
21 #elif defined(HAVE_SYS_QUOTA_H)
22 # include <sys/quota.h>
23 #endif
25 #ifndef SYS_DQBLK
26 #define SYS_DQBLK dqblk
27 #endif
29 int autoconf_quota(void)
31 int ret = -1;
32 struct SYS_DQBLK D;
34 ret = quotactl(Q_GETQUOTA,"/dev/hda1",0,(void *)&D);
36 return ret;
39 #elif defined(HAVE_QUOTACTL_4B)
40 /* int quotactl(const char *path, int cmd, int id, char *addr); */
42 #ifdef HAVE_SYS_QUOTA_H
43 #include <sys/quota.h>
44 #else /* *BSD */
45 #include <sys/types.h>
46 #include <ufs/ufs/quota.h>
47 #include <machine/param.h>
48 #endif
50 int autoconf_quota(void)
52 int ret = -1;
53 struct dqblk D;
55 ret = quotactl("/",Q_GETQUOTA,0,(char *) &D);
57 return ret;
60 #elif defined(HAVE_QUOTACTL_3)
61 /* int quotactl (char *spec, int request, char *arg); */
63 #ifdef HAVE_SYS_TYPES_H
64 #include <sys/types.h>
65 #endif
66 #ifdef HAVE_SYS_QUOTA_H
67 #include <sys/quota.h>
68 #endif
70 int autoconf_quota(void)
72 int ret = -1;
73 struct q_request request;
75 ret = quotactl("/", Q_GETQUOTA, &request);
77 return ret;
80 #elif defined(HAVE_QUOTACTL_2)
82 #error HAVE_QUOTACTL_2 not implemented
84 #else
86 #error Unknow QUOTACTL prototype
88 #endif
90 int main(void)
92 autoconf_quota();
93 return 0;