Introduce -a [enable|disable] and -l [enable|disable] flags to the tunefs
command, permitting it to set FS_ACLS and FS_MULTILABEL administrative flags on UFS file systems. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
This commit is contained in:
parent
05ff8976a7
commit
d2fd70cb76
@ -40,9 +40,11 @@
|
||||
.Nd tune up an existing file system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl a Cm enable | disable
|
||||
.Op Fl A
|
||||
.Op Fl e Ar maxbpg
|
||||
.Op Fl f Ar avgfilesize
|
||||
.Op Fl l Ar enable | disable
|
||||
.Op Fl m Ar minfree
|
||||
.Op Fl n Cm enable | disable
|
||||
.Op Fl o Cm space | time
|
||||
@ -63,6 +65,8 @@ it must be downgraded to read-only or unmounted.
|
||||
The parameters which are to be changed are indicated by the flags
|
||||
given below:
|
||||
.Bl -tag -width indent
|
||||
.It Fl a Cm enable | disable
|
||||
Turn on/off the administrative ACL enable flag.
|
||||
.It Fl A
|
||||
The file system has several backups of the super-block.
|
||||
Specifying
|
||||
@ -86,6 +90,8 @@ For file systems with exclusively large files,
|
||||
this parameter should be set higher.
|
||||
.It Fl f Ar avgfilesize
|
||||
Specify the expected average file size.
|
||||
.It Fl l Cm enable | disable
|
||||
Turn on/off MAC multilabel flag.
|
||||
.It Fl m Ar minfree
|
||||
Specify the percentage of space held back
|
||||
from normal users; the minimum free space threshold.
|
||||
|
@ -93,12 +93,12 @@ main(argc, argv)
|
||||
char *special;
|
||||
const char *name;
|
||||
struct stat st;
|
||||
int Aflag = 0, active = 0;
|
||||
int eflag = 0, fflag = 0, mflag = 0;
|
||||
int Aflag = 0, active = 0, aflag = 0;
|
||||
int eflag = 0, fflag = 0, lflag = 0, mflag = 0;
|
||||
int nflag = 0, oflag = 0, pflag = 0, sflag = 0;
|
||||
int evalue = 0, fvalue = 0;
|
||||
int mvalue = 0, ovalue = 0, svalue = 0;
|
||||
char *nvalue = NULL;
|
||||
char *avalue = NULL, *lvalue = NULL, *nvalue = NULL;
|
||||
struct fstab *fs;
|
||||
const char *chg[2];
|
||||
char device[MAXPATHLEN];
|
||||
@ -109,8 +109,18 @@ main(argc, argv)
|
||||
if (argc < 3)
|
||||
usage();
|
||||
found_arg = 0; /* at least one arg is required */
|
||||
while ((ch = getopt(argc, argv, "Ae:f:m:n:o:ps:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "a:Ae:f:l:m:n:o:ps:")) != -1)
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
found_arg = 1;
|
||||
name = "ACLs";
|
||||
avalue = optarg;
|
||||
if (strcmp(avalue, "enable") && strcmp(avalue, "disable")) {
|
||||
errx(10, "bad %s (options are %s)", name,
|
||||
"`enable' or `disable'");
|
||||
}
|
||||
aflag = 1;
|
||||
break;
|
||||
case 'A':
|
||||
found_arg = 1;
|
||||
Aflag++;
|
||||
@ -131,6 +141,16 @@ main(argc, argv)
|
||||
errx(10, "%s must be >= 1 (was %s)", name, optarg);
|
||||
fflag = 1;
|
||||
break;
|
||||
case 'l':
|
||||
found_arg = 1;
|
||||
name = "multilabel MAC file system";
|
||||
lvalue = optarg;
|
||||
if (strcmp(lvalue, "enable") && strcmp(lvalue, "disable")) {
|
||||
errx(10, "bad %s (options are %s)", name,
|
||||
"`enable' or `disable'");
|
||||
}
|
||||
lflag = 1;
|
||||
break;
|
||||
case 'm':
|
||||
found_arg = 1;
|
||||
name = "minimum percentage of free space";
|
||||
@ -213,6 +233,26 @@ main(argc, argv)
|
||||
printfs();
|
||||
exit(0);
|
||||
}
|
||||
if (aflag) {
|
||||
name = "ACLs";
|
||||
if (strcmp(avalue, "enable") == 0) {
|
||||
if (sblock.fs_flags & FS_ACLS) {
|
||||
warnx("%s remains unchanged as enabled", name);
|
||||
} else {
|
||||
sblock.fs_flags |= FS_ACLS;
|
||||
warnx("%s set", name);
|
||||
}
|
||||
} else if (strcmp(avalue, "disable") == 0) {
|
||||
if ((~sblock.fs_flags & FS_ACLS) ==
|
||||
FS_ACLS) {
|
||||
warnx("%s remains unchanged as disabled",
|
||||
name);
|
||||
} else {
|
||||
sblock.fs_flags &= ~FS_ACLS;
|
||||
warnx("%s set", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (eflag) {
|
||||
name = "maximum blocks per file in a cylinder group";
|
||||
if (sblock.fs_maxbpg == evalue) {
|
||||
@ -235,6 +275,26 @@ main(argc, argv)
|
||||
sblock.fs_avgfilesize = fvalue;
|
||||
}
|
||||
}
|
||||
if (lflag) {
|
||||
name = "multilabel";
|
||||
if (strcmp(lvalue, "enable") == 0) {
|
||||
if (sblock.fs_flags & FS_MULTILABEL) {
|
||||
warnx("%s remains unchanged as enabled", name);
|
||||
} else {
|
||||
sblock.fs_flags |= FS_MULTILABEL;
|
||||
warnx("%s set", name);
|
||||
}
|
||||
} else if (strcmp(lvalue, "disable") == 0) {
|
||||
if ((~sblock.fs_flags & FS_MULTILABEL) ==
|
||||
FS_MULTILABEL) {
|
||||
warnx("%s remains unchanged as disabled",
|
||||
name);
|
||||
} else {
|
||||
sblock.fs_flags &= ~FS_MULTILABEL;
|
||||
warnx("%s set", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mflag) {
|
||||
name = "minimum percentage of free space";
|
||||
if (sblock.fs_minfree == mvalue) {
|
||||
@ -317,9 +377,9 @@ void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n%s\n",
|
||||
"usage: tunefs [-A] [-e maxbpg] [-f avgfilesize] [-m minfree]",
|
||||
" [-n enable | disable] [-o space | time] [-p] [-s avgfpdir]",
|
||||
" special | filesystem");
|
||||
"usage: tunefs [-a enable | disable] [-A] [-e maxbpg] [-f avgfilesize]",
|
||||
" [-l enable | disable] [-m minfree] [-n enable | disable]",
|
||||
" [-o space | time] [-p] [-s avgfpdir] special | filesystem");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user