mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
Abstract out some common quota shell code, add project operation to fsstress.
Merge of master-melb:xfs-cmds:22099a by kenmcd.
This commit is contained in:
@@ -74,9 +74,7 @@ _require_scratch
|
||||
_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
|
||||
@@ -119,25 +117,7 @@ else
|
||||
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
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ known_hosts()
|
||||
EMAIL="nathans@larry"
|
||||
SCRATCH_MNT=/mnt/xfs0
|
||||
SCRATCH_DEV=/dev/sdb5
|
||||
#SCRATCH_RTDEV=/dev/sdc1
|
||||
#SCRATCH_RTDEV=/dev/md0
|
||||
SCRATCH_LOGDEV=/dev/sda11
|
||||
TEST_DIR=/mnt/xfs1
|
||||
TEST_DEV=/dev/sdc3
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#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
|
||||
@@ -52,6 +53,7 @@ typedef enum {
|
||||
OP_BULKSTAT,
|
||||
OP_BULKSTAT1,
|
||||
OP_CHOWN,
|
||||
OP_CHPROJ,
|
||||
OP_CREAT,
|
||||
OP_DREAD,
|
||||
OP_DWRITE,
|
||||
@@ -131,6 +133,7 @@ void attr_set_f(int, long);
|
||||
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);
|
||||
@@ -161,6 +164,7 @@ opdesc_t ops[] = {
|
||||
{ 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 },
|
||||
@@ -1621,6 +1625,38 @@ chown_f(int opno, long r)
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user