1/* this test should find out what quota api is available on the os */ 2 3#if defined(HAVE_QUOTACTL_4A) 4/* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */ 5 6#ifdef HAVE_SYS_TYPES_H 7#include <sys/types.h> 8#endif 9 10#ifdef HAVE_ASM_TYPES_H 11#include <asm/types.h> 12#endif 13 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 24 25#ifndef SYS_DQBLK 26#define SYS_DQBLK dqblk 27#endif 28 29 int autoconf_quota(void) 30{ 31 int ret = -1; 32 struct SYS_DQBLK D; 33 34 ret = quotactl(Q_GETQUOTA,"/dev/hda1",0,(void *)&D); 35 36 return ret; 37} 38 39#elif defined(HAVE_QUOTACTL_4B) 40/* int quotactl(const char *path, int cmd, int id, char *addr); */ 41 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 49 50 int autoconf_quota(void) 51{ 52 int ret = -1; 53 struct dqblk D; 54 55 ret = quotactl("/",Q_GETQUOTA,0,(char *) &D); 56 57 return ret; 58} 59 60#elif defined(HAVE_QUOTACTL_3) 61/* int quotactl (char *spec, int request, char *arg); */ 62 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 69 70 int autoconf_quota(void) 71{ 72 int ret = -1; 73 struct q_request request; 74 75 ret = quotactl("/", Q_GETQUOTA, &request); 76 77 return ret; 78} 79 80#elif defined(HAVE_QUOTACTL_2) 81 82#error HAVE_QUOTACTL_2 not implemented 83 84#else 85 86#error Unknow QUOTACTL prototype 87 88#endif 89 90 int main(void) 91{ 92 autoconf_quota(); 93 return 0; 94} 95