Add a "-l" flag to newfs, which sets the FS_MULTILABEL flag. This
permits users of newfs to set the multilabel flag on UFS1 and UFS2 file systems from inception without using tunefs. Obtained from: TrustedBSD Project Sponsored by: DARPA, McAfee Research
This commit is contained in:
parent
47934cef8f
commit
ce20d788fa
@ -139,6 +139,8 @@ mkfs(struct partition *pp, char *fsys)
|
|||||||
sblock.fs_flags |= FS_DOSOFTDEP;
|
sblock.fs_flags |= FS_DOSOFTDEP;
|
||||||
if (Lflag)
|
if (Lflag)
|
||||||
strlcpy(sblock.fs_volname, volumelabel, MAXVOLLEN);
|
strlcpy(sblock.fs_volname, volumelabel, MAXVOLLEN);
|
||||||
|
if (lflag)
|
||||||
|
sblock.fs_flags |= FS_MULTILABEL;
|
||||||
/*
|
/*
|
||||||
* Validate the given file system size.
|
* Validate the given file system size.
|
||||||
* Verify that its last block can actually be accessed.
|
* Verify that its last block can actually be accessed.
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
.Nd construct a new UFS1/UFS2 file system
|
.Nd construct a new UFS1/UFS2 file system
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl NU
|
.Op Fl NUl
|
||||||
.Op Fl L Ar volname
|
.Op Fl L Ar volname
|
||||||
.Op Fl O Ar filesystem-type
|
.Op Fl O Ar filesystem-type
|
||||||
.Op Fl S Ar sector-size
|
.Op Fl S Ar sector-size
|
||||||
@ -149,6 +149,8 @@ If fewer inodes are desired, a larger number should be used;
|
|||||||
to create more inodes a smaller number should be given.
|
to create more inodes a smaller number should be given.
|
||||||
One inode is required for each distinct file, so this value effectively
|
One inode is required for each distinct file, so this value effectively
|
||||||
specifies the average file size on the file system.
|
specifies the average file size on the file system.
|
||||||
|
.It Fl l
|
||||||
|
Enables multilabel MAC on the new file system.
|
||||||
.It Fl m Ar free-space
|
.It Fl m Ar free-space
|
||||||
The percentage of space reserved from normal users; the minimum free
|
The percentage of space reserved from normal users; the minimum free
|
||||||
space threshold.
|
space threshold.
|
||||||
|
@ -120,6 +120,7 @@ int Oflag = 2; /* file system format (1 => UFS1, 2 => UFS2) */
|
|||||||
int Rflag; /* regression test */
|
int Rflag; /* regression test */
|
||||||
int Uflag; /* enable soft updates for file system */
|
int Uflag; /* enable soft updates for file system */
|
||||||
int Eflag = 0; /* exit in middle of newfs for testing */
|
int Eflag = 0; /* exit in middle of newfs for testing */
|
||||||
|
int lflag; /* enable multilabel for file system */
|
||||||
quad_t fssize; /* file system size */
|
quad_t fssize; /* file system size */
|
||||||
int sectorsize; /* bytes/sector */
|
int sectorsize; /* bytes/sector */
|
||||||
int realsectorsize; /* bytes/sector in hardware */
|
int realsectorsize; /* bytes/sector in hardware */
|
||||||
@ -157,7 +158,7 @@ main(int argc, char *argv[])
|
|||||||
off_t mediasize;
|
off_t mediasize;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv,
|
while ((ch = getopt(argc, argv,
|
||||||
"EL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:m:o:s:")) != -1)
|
"EL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:lm:o:s:")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'E':
|
case 'E':
|
||||||
Eflag++;
|
Eflag++;
|
||||||
@ -239,6 +240,9 @@ main(int argc, char *argv[])
|
|||||||
if ((density = atoi(optarg)) <= 0)
|
if ((density = atoi(optarg)) <= 0)
|
||||||
errx(1, "%s: bad bytes per inode", optarg);
|
errx(1, "%s: bad bytes per inode", optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
lflag = 1;
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
if ((minfree = atoi(optarg)) < 0 || minfree > 99)
|
if ((minfree = atoi(optarg)) < 0 || minfree > 99)
|
||||||
errx(1, "%s: bad free space %%", optarg);
|
errx(1, "%s: bad free space %%", optarg);
|
||||||
|
@ -53,6 +53,7 @@ extern int Oflag; /* build UFS1 format file system */
|
|||||||
extern int Rflag; /* regression test */
|
extern int Rflag; /* regression test */
|
||||||
extern int Uflag; /* enable soft updates for file system */
|
extern int Uflag; /* enable soft updates for file system */
|
||||||
extern int Eflag; /* exit as if error, for testing */
|
extern int Eflag; /* exit as if error, for testing */
|
||||||
|
extern int lflag; /* enable multilabel MAC for file system */
|
||||||
extern quad_t fssize; /* file system size */
|
extern quad_t fssize; /* file system size */
|
||||||
extern int sectorsize; /* bytes/sector */
|
extern int sectorsize; /* bytes/sector */
|
||||||
extern int realsectorsize; /* bytes/sector in hardware*/
|
extern int realsectorsize; /* bytes/sector in hardware*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user