From: Nathan Scott Date: Thu, 24 Mar 2005 05:05:35 +0000 (+0000) Subject: Switch over pagesize feature.c option, add a check for project quota. X-Git-Tag: v1.1.0~738 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=5ed0f19a49014951b53f4110ee47ee40e13cd94f Switch over pagesize feature.c option, add a check for project quota. Merge of master-melb:xfs-cmds:21941a by kenmcd. --- diff --git a/008 b/008 index d63b908d..7ef47f8f 100755 --- a/008 +++ b/008 @@ -44,7 +44,7 @@ echo "QA output created by $seq" here=`pwd` tmp=/tmp/$$ status=0 # success is the default! -pgsize=`$here/src/feature -p` +pgsize=`$here/src/feature -s` trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() diff --git a/084 b/084 index d1f859f2..8f00df3c 100755 --- a/084 +++ b/084 @@ -57,7 +57,7 @@ _filter_resv() -e 's/[0-9][0-9]* bytes/NUM bytes/g' } -pgsize=`$here/src/feature -p` +pgsize=`$here/src/feature -s` # -i == number of iterations # -l == bytes to leak on each iteration diff --git a/091 b/091 index 659b0eab..94f6bcd2 100755 --- a/091 +++ b/091 @@ -70,7 +70,7 @@ run_fsx() fi } -psize=`$here/src/feature -p` +psize=`$here/src/feature -s` bsize=512 # 2.4 Linux kernels support bsize aligned direct I/O only kernel=`uname -r | sed -e 's/\(2\..\).*/\1/'` diff --git a/src/feature.c b/src/feature.c index 49a2c33c..88e8a943 100644 --- a/src/feature.c +++ b/src/feature.c @@ -36,13 +36,15 @@ * -t test for working rlimit/ftruncate64 (via libc) * -q test for quota support (kernel compile option) * -u test for user quota enforcement support (mount option) + * -p test for project quota enforcement support (mount option) * -g test for group quota enforcement support (mount option) * -U test for user quota accounting support (mount option) * -G test for group quota accounting support (mount option) + * -P test for project quota accounting support (mount option) * Return code: 0 is true, anything else is error/not supported * * Test for machine features - * -p report pagesize + * -s report pagesize * -w report bits per long */ @@ -64,14 +66,19 @@ #define GRPQUOTA 1 #endif +#ifndef PRJQUOTA +#define PRJQUOTA 2 +#endif + int verbose = 0; void usage(void) { - fprintf(stderr, "Usage: feature [-v] - \n"); + fprintf(stderr, "Usage: feature [-v] - \n"); fprintf(stderr, " feature [-v] -c \n"); fprintf(stderr, " feature [-v] -t \n"); + fprintf(stderr, " feature -s | -w\n"); exit(1); } @@ -116,7 +123,7 @@ int hastruncate64(char *filename) { struct rlimit64 rlimit64; - off64_t bigoff = 4294967307; /* > 2^32 */ + off64_t bigoff = 4294967307LL; /* > 2^32 */ struct stat64 bigst; int fd; @@ -191,10 +198,14 @@ hasxfsquota(int type, int q, char *device) return (0); else if (q == XFS_QUOTA_GDQ_ENFD && qstat.qs_flags & XFS_QUOTA_GDQ_ENFD) return (0); + else if (q == XFS_QUOTA_PDQ_ENFD && qstat.qs_flags & XFS_QUOTA_PDQ_ENFD) + return (0); else if (q == XFS_QUOTA_UDQ_ACCT && qstat.qs_flags & XFS_QUOTA_UDQ_ACCT) return (0); else if (q == XFS_QUOTA_GDQ_ACCT && qstat.qs_flags & XFS_QUOTA_GDQ_ACCT) return (0); + else if (q == XFS_QUOTA_PDQ_ACCT && qstat.qs_flags & XFS_QUOTA_PDQ_ACCT) + return (0); if (verbose) fprintf(stderr, "quota type (%d) not available\n", q); return (1); @@ -209,13 +220,15 @@ main(int argc, char **argv) int gflag = 0; int Gflag = 0; int pflag = 0; + int Pflag = 0; int qflag = 0; + int sflag = 0; int uflag = 0; int Uflag = 0; int wflag = 0; char *fs = NULL; - while ((c = getopt(argc, argv, "ctgGpquUvw")) != EOF) { + while ((c = getopt(argc, argv, "ctgGpPqsuUvw")) != EOF) { switch (c) { case 'c': cflag++; @@ -232,9 +245,15 @@ main(int argc, char **argv) case 'p': pflag++; break; + case 'P': + Pflag++; + break; case 'q': qflag++; break; + case 's': + sflag++; + break; case 'u': uflag++; break; @@ -253,11 +272,11 @@ main(int argc, char **argv) } /* filesystem features */ - if (cflag || tflag || uflag || gflag || qflag || Uflag || Gflag) { + if (cflag|tflag|uflag|gflag|pflag|qflag|Uflag|Gflag|Pflag) { if (optind != argc-1) /* need a device */ usage(); fs = argv[argc-1]; - } else if (wflag || pflag) { + } else if (wflag || sflag) { if (optind != argc) usage(); } else @@ -271,14 +290,18 @@ main(int argc, char **argv) return(hasxfsquota(0, 0, fs)); if (gflag) return(hasxfsquota(GRPQUOTA, XFS_QUOTA_GDQ_ENFD, fs)); + if (pflag) + return(hasxfsquota(PRJQUOTA, XFS_QUOTA_PDQ_ENFD, fs)); if (uflag) return(hasxfsquota(USRQUOTA, XFS_QUOTA_UDQ_ENFD, fs)); if (Gflag) return(hasxfsquota(GRPQUOTA, XFS_QUOTA_GDQ_ACCT, fs)); + if (Pflag) + return(hasxfsquota(PRJQUOTA, XFS_QUOTA_PDQ_ACCT, fs)); if (Uflag) return(hasxfsquota(USRQUOTA, XFS_QUOTA_UDQ_ACCT, fs)); - if (pflag) { + if (sflag) { printf("%d\n", getpagesize()); exit(0); }