diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-10-09 20:58:11 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-10-09 20:58:11 +0000 |
commit | 9759adc4ffd2bc56cd09ca9c4c696502c327dce1 (patch) | |
tree | f486ae91b2c399cb25346721b963531b3ea81b30 /source3/tests | |
parent | ed0721787be864e00db04c91818f80384d14de12 (diff) | |
download | samba-9759adc4ffd2bc56cd09ca9c4c696502c327dce1.tar.gz samba-9759adc4ffd2bc56cd09ca9c4c696502c327dce1.tar.bz2 samba-9759adc4ffd2bc56cd09ca9c4c696502c327dce1.zip |
Move sysquotas autoconf tests to a seperate file.
Patch by Stefan Metzmacher <metze@metzemix.de>
(This used to be commit 9f6cd8177db9a88f681f28a8dca044595ddaae88)
Diffstat (limited to 'source3/tests')
-rw-r--r-- | source3/tests/sysquotas.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/source3/tests/sysquotas.c b/source3/tests/sysquotas.c new file mode 100644 index 0000000000..2aa643326c --- /dev/null +++ b/source3/tests/sysquotas.c @@ -0,0 +1,94 @@ +/* this test should find out what quota api is available on the os */ + +#if defined(HAVE_QUOTACTL_4A) +/* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */ + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef HAVE_ASM_TYPES_H +#include <asm/types.h> +#endif + +#if defined(HAVE_LINUX_QUOTA_H) +# include <linux/quota.h> +# if defined(HAVE_STRUCT_IF_DQBLK) +# define SYS_DQBLK if_dqblk +# elif defined(HAVE_STRUCT_MEM_DQBLK) +# define SYS_DQBLK mem_dqblk +# endif +#elif defined(HAVE_SYS_QUOTA_H) +# include <sys/quota.h> +#endif + +#ifndef SYS_DQBLK +#define SYS_DQBLK dqblk +#endif + + int autoconf_quota(void) +{ + int ret = -1; + struct SYS_DQBLK D; + + ret = quotactl(Q_GETQUOTA,"/dev/hda1",0,(void *)&D); + + return ret; +} + +#elif defined(HAVE_QUOTACTL_4B) +/* int quotactl(const char *path, int cmd, int id, char *addr); */ + +#ifdef HAVE_SYS_QUOTA_H +#include <sys/quota.h> +#else /* *BSD */ +#include <sys/types.h> +#include <ufs/ufs/quota.h> +#include <machine/param.h> +#endif + + int autoconf_quota(void) +{ + int ret = -1; + struct dqblk D; + + ret = quotactl("/",Q_GETQUOTA,0,(char *) &D); + + return ret; +} + +#elif defined(HAVE_QUOTACTL_3) +/* int quotactl (char *spec, int request, char *arg); */ + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_QUOTA_H +#include <sys/quota.h> +#endif + + int autoconf_quota(void) +{ + int ret = -1; + struct q_request request; + + ret = quotactl("/", Q_GETQUOTA, &request); + + return ret; +} + +#elif defined(HAVE_QUOTACTL_2) + +#error HAVE_QUOTACTL_2 not implemented + +#else + +#error Unknow QUOTACTL prototype + +#endif + + int main(void) +{ + autoconf_quota(); + return 0; +} |