Switch over pagesize feature.c option, add a check for project quota.

Merge of master-melb:xfs-cmds:21941a by kenmcd.
This commit is contained in:
Nathan Scott
2005-03-24 05:05:35 +00:00
parent 24211a43f8
commit 5ed0f19a49
4 changed files with 33 additions and 10 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ echo "QA output created by $seq"
here=`pwd` here=`pwd`
tmp=/tmp/$$ tmp=/tmp/$$
status=0 # success is the default! 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 trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup() _cleanup()
+1 -1
View File
@@ -57,7 +57,7 @@ _filter_resv()
-e 's/[0-9][0-9]* bytes/NUM bytes/g' -e 's/[0-9][0-9]* bytes/NUM bytes/g'
} }
pgsize=`$here/src/feature -p` pgsize=`$here/src/feature -s`
# -i == number of iterations # -i == number of iterations
# -l == bytes to leak on each iteration # -l == bytes to leak on each iteration
+1 -1
View File
@@ -70,7 +70,7 @@ run_fsx()
fi fi
} }
psize=`$here/src/feature -p` psize=`$here/src/feature -s`
bsize=512 bsize=512
# 2.4 Linux kernels support bsize aligned direct I/O only # 2.4 Linux kernels support bsize aligned direct I/O only
kernel=`uname -r | sed -e 's/\(2\..\).*/\1/'` kernel=`uname -r | sed -e 's/\(2\..\).*/\1/'`
+30 -7
View File
@@ -36,13 +36,15 @@
* -t test for working rlimit/ftruncate64 (via libc) * -t test for working rlimit/ftruncate64 (via libc)
* -q test for quota support (kernel compile option) * -q test for quota support (kernel compile option)
* -u test for user quota enforcement support (mount 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) * -g test for group quota enforcement support (mount option)
* -U test for user quota accounting support (mount option) * -U test for user quota accounting support (mount option)
* -G test for group 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 * Return code: 0 is true, anything else is error/not supported
* *
* Test for machine features * Test for machine features
* -p report pagesize * -s report pagesize
* -w report bits per long * -w report bits per long
*/ */
@@ -64,14 +66,19 @@
#define GRPQUOTA 1 #define GRPQUOTA 1
#endif #endif
#ifndef PRJQUOTA
#define PRJQUOTA 2
#endif
int verbose = 0; int verbose = 0;
void void
usage(void) usage(void)
{ {
fprintf(stderr, "Usage: feature [-v] -<q|u|g|U|G> <filesystem>\n"); fprintf(stderr, "Usage: feature [-v] -<q|u|g|p|U|G|P> <filesystem>\n");
fprintf(stderr, " feature [-v] -c <file>\n"); fprintf(stderr, " feature [-v] -c <file>\n");
fprintf(stderr, " feature [-v] -t <file>\n"); fprintf(stderr, " feature [-v] -t <file>\n");
fprintf(stderr, " feature -s | -w\n");
exit(1); exit(1);
} }
@@ -116,7 +123,7 @@ int
hastruncate64(char *filename) hastruncate64(char *filename)
{ {
struct rlimit64 rlimit64; struct rlimit64 rlimit64;
off64_t bigoff = 4294967307; /* > 2^32 */ off64_t bigoff = 4294967307LL; /* > 2^32 */
struct stat64 bigst; struct stat64 bigst;
int fd; int fd;
@@ -191,10 +198,14 @@ hasxfsquota(int type, int q, char *device)
return (0); return (0);
else if (q == XFS_QUOTA_GDQ_ENFD && qstat.qs_flags & XFS_QUOTA_GDQ_ENFD) else if (q == XFS_QUOTA_GDQ_ENFD && qstat.qs_flags & XFS_QUOTA_GDQ_ENFD)
return (0); 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) else if (q == XFS_QUOTA_UDQ_ACCT && qstat.qs_flags & XFS_QUOTA_UDQ_ACCT)
return (0); return (0);
else if (q == XFS_QUOTA_GDQ_ACCT && qstat.qs_flags & XFS_QUOTA_GDQ_ACCT) else if (q == XFS_QUOTA_GDQ_ACCT && qstat.qs_flags & XFS_QUOTA_GDQ_ACCT)
return (0); return (0);
else if (q == XFS_QUOTA_PDQ_ACCT && qstat.qs_flags & XFS_QUOTA_PDQ_ACCT)
return (0);
if (verbose) if (verbose)
fprintf(stderr, "quota type (%d) not available\n", q); fprintf(stderr, "quota type (%d) not available\n", q);
return (1); return (1);
@@ -209,13 +220,15 @@ main(int argc, char **argv)
int gflag = 0; int gflag = 0;
int Gflag = 0; int Gflag = 0;
int pflag = 0; int pflag = 0;
int Pflag = 0;
int qflag = 0; int qflag = 0;
int sflag = 0;
int uflag = 0; int uflag = 0;
int Uflag = 0; int Uflag = 0;
int wflag = 0; int wflag = 0;
char *fs = NULL; char *fs = NULL;
while ((c = getopt(argc, argv, "ctgGpquUvw")) != EOF) { while ((c = getopt(argc, argv, "ctgGpPqsuUvw")) != EOF) {
switch (c) { switch (c) {
case 'c': case 'c':
cflag++; cflag++;
@@ -232,9 +245,15 @@ main(int argc, char **argv)
case 'p': case 'p':
pflag++; pflag++;
break; break;
case 'P':
Pflag++;
break;
case 'q': case 'q':
qflag++; qflag++;
break; break;
case 's':
sflag++;
break;
case 'u': case 'u':
uflag++; uflag++;
break; break;
@@ -253,11 +272,11 @@ main(int argc, char **argv)
} }
/* filesystem features */ /* 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 */ if (optind != argc-1) /* need a device */
usage(); usage();
fs = argv[argc-1]; fs = argv[argc-1];
} else if (wflag || pflag) { } else if (wflag || sflag) {
if (optind != argc) if (optind != argc)
usage(); usage();
} else } else
@@ -271,14 +290,18 @@ main(int argc, char **argv)
return(hasxfsquota(0, 0, fs)); return(hasxfsquota(0, 0, fs));
if (gflag) if (gflag)
return(hasxfsquota(GRPQUOTA, XFS_QUOTA_GDQ_ENFD, fs)); return(hasxfsquota(GRPQUOTA, XFS_QUOTA_GDQ_ENFD, fs));
if (pflag)
return(hasxfsquota(PRJQUOTA, XFS_QUOTA_PDQ_ENFD, fs));
if (uflag) if (uflag)
return(hasxfsquota(USRQUOTA, XFS_QUOTA_UDQ_ENFD, fs)); return(hasxfsquota(USRQUOTA, XFS_QUOTA_UDQ_ENFD, fs));
if (Gflag) if (Gflag)
return(hasxfsquota(GRPQUOTA, XFS_QUOTA_GDQ_ACCT, fs)); return(hasxfsquota(GRPQUOTA, XFS_QUOTA_GDQ_ACCT, fs));
if (Pflag)
return(hasxfsquota(PRJQUOTA, XFS_QUOTA_PDQ_ACCT, fs));
if (Uflag) if (Uflag)
return(hasxfsquota(USRQUOTA, XFS_QUOTA_UDQ_ACCT, fs)); return(hasxfsquota(USRQUOTA, XFS_QUOTA_UDQ_ACCT, fs));
if (pflag) { if (sflag) {
printf("%d\n", getpagesize()); printf("%d\n", getpagesize());
exit(0); exit(0);
} }