From 12d2580ad7b80bdbae04b32e85abc375b332f0ab Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 9 Oct 2003 20:59:38 +0000 Subject: Move sysquotas autoconf tests to a seperate file in tests/ Patch by Stefan Metzmacher (This used to be commit cd3e4882fcf2437f4140557608e671284d0e92b4) --- source3/tests/sysquotas.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 source3/tests/sysquotas.c (limited to 'source3/tests') diff --git a/source3/tests/sysquotas.c b/source3/tests/sysquotas.c new file mode 100644 index 0000000000..e83f28e2d0 --- /dev/null +++ b/source3/tests/sysquotas.c @@ -0,0 +1,94 @@ +/* this test should find out what quota api is avalable 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 +#endif + +#ifdef HAVE_ASM_TYPES_H +#include +#endif + +#if defined(HAVE_LINUX_QUOTA_H) +# include +# 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 +#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 +#else /* *BSD */ +#include +#include +#include +#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 +#endif +#ifdef HAVE_SYS_QUOTA_H +#include +#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; +} -- cgit