tests/quota: tidy up includes of sysquotas 4B
[kamenim/samba-autobuild/.git] / tests / sysquotas.c
1 /* this test should find out what quota api is available on the os */
2
3  int autoconf_quota(void);
4
5 #if defined(HAVE_QUOTACTL_4A)
6 /* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */
7
8 #ifdef HAVE_SYS_TYPES_H
9 #include <sys/types.h>
10 #endif
11
12 #ifdef HAVE_ASM_TYPES_H
13 #include <asm/types.h>
14 #endif
15
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
26
27 #ifdef HPUX
28 /* HPUX has no prototype for quotactl but we test compile with strict
29    error checks, which would fail without function prototype */
30 extern int quotactl(int cmd, const char *special, uid_t uid, void *addr);
31 #endif
32
33 #ifndef SYS_DQBLK
34 #define SYS_DQBLK dqblk
35 #endif
36
37  int autoconf_quota(void);
38
39  int autoconf_quota(void)
40 {
41         int ret = -1;
42         struct SYS_DQBLK D;
43
44         ret = quotactl(Q_GETQUOTA,"/dev/hda1",0,(void *)&D);
45
46         return ret;
47 }
48
49 #elif defined(HAVE_QUOTACTL_4B)
50 /* int quotactl(const char *path, int cmd, int id, char *addr); */
51
52 #ifdef HAVE_SYS_TYPES_H
53 #include <sys/types.h>
54 #endif
55
56 #ifdef HAVE_SYS_QUOTA_H
57 #include <sys/quota.h>
58 #endif
59
60 #ifdef HAVE_UFS_UFS_QUOTA_H
61 #include <ufs/ufs/quota.h>
62 #endif
63
64  int autoconf_quota(void)
65 {
66         int ret = -1;
67         struct dqblk D;
68
69         ret = quotactl("/",Q_GETQUOTA,0,(char *) &D);
70
71         return ret;
72 }
73
74 #elif defined(HAVE_QUOTACTL_2)
75
76 #error HAVE_QUOTACTL_2 not implemented
77
78 #else
79
80 #error Unknow QUOTACTL prototype
81
82 #endif
83
84  int main(void)
85 {
86         autoconf_quota();
87         return 0;
88 }