1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
/* this test should find out what quota api is available on the os */
int autoconf_quota(void);
#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 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;
}
|