_require_quota
# setup a default run
-if [ -z "$MOUNT_OPTIONS" ]; then
- export MOUNT_OPTIONS="-o uquota"
-fi
+[ -z "$MOUNT_OPTIONS" ] && export MOUNT_OPTIONS="-o uquota"
blksoft=100
blkhard=500
QUOTA_FS=$SCRATCH_MNT
fi
-# setup exactly what it is we'll be testing
-enforce=1
-if src/feature -u $SCRATCH_DEV
-then
- type=u ; eval `_choose_uid`; ln -s $seq.usrquota $seq.out
-elif src/feature -g $SCRATCH_DEV
-then
- type=g ; eval `_choose_gid`; ln -s $seq.grpquota $seq.out
-elif src/feature -U $SCRATCH_DEV
-then
- type=u ; eval `_choose_uid`; ln -s $seq.uqnoenforce $seq.out
- enforce=0
-elif src/feature -G $SCRATCH_DEV
-then
- type=g ; eval `_choose_gid`; ln -s $seq.gqnoenforce $seq.out
- enforce=0
-else
- _notrun "No quota support at mount time"
-fi
+_qsetup
echo "Using output from '" `ls -l $seq.out` "'" >>$seq.full
echo "and using type=$type id=$id" >>$seq.full
#include <math.h>
#define XFS_ERRTAG_MAX 17
#define XFS_IDMODULO_MAX 32
+#define XFS_PROJIDMODULO_MAX 16
/* was (getpagesize()*32) BUT want it to be same
* on all platforms
OP_BULKSTAT,
OP_BULKSTAT1,
OP_CHOWN,
+ OP_CHPROJ,
OP_CREAT,
OP_DREAD,
OP_DWRITE,
void bulkstat_f(int, long);
void bulkstat1_f(int, long);
void chown_f(int, long);
+void chproj_f(int, long);
void creat_f(int, long);
void dread_f(int, long);
void dwrite_f(int, long);
{ OP_BULKSTAT, "bulkstat", bulkstat_f, 1, 0 },
{ OP_BULKSTAT1, "bulkstat1", bulkstat1_f, 1, 0 },
{ OP_CHOWN, "chown", chown_f, 3, 1 },
+ { OP_CHPROJ, "chproj", chproj_f, 1, 1 },
{ OP_CREAT, "creat", creat_f, 4, 1 },
{ OP_DREAD, "dread", dread_f, 4, 0 },
{ OP_DWRITE, "dwrite", dwrite_f, 4, 1 },
free_pathname(&f);
}
+void
+chproj_f(int opno, long r)
+{
+ int fd;
+ int e;
+ pathname_t f;
+ int nbits;
+ uint p;
+ int v;
+
+ init_pathname(&f);
+ if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
+ append_pathname(&f, ".");
+ fd = open_path(&f, O_RDWR);
+ e = fd < 0 ? errno : 0;
+ check_cwd();
+
+ p = (uid_t)random();
+ e = MIN(idmodulo, XFS_PROJIDMODULO_MAX);
+ nbits = (int)(random() % e);
+ p &= (1 << nbits) - 1;
+#if defined(__sgi__)
+ e = fchproj(fd, p);
+#else
+ e = xfsctl(f.path, fd, XFS_IOC_SETPROJID, &p);
+#endif
+ if (v)
+ printf("%d/%d: chproj %s %u %d\n", procid, opno, f.path, p, e);
+ free_pathname(&f);
+ close(fd);
+}
+
void
creat_f(int opno, long r)
{