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:
Robert Watson 2004-02-26 01:14:27 +00:00
parent 47934cef8f
commit ce20d788fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126254
4 changed files with 11 additions and 2 deletions

View File

@ -139,6 +139,8 @@ mkfs(struct partition *pp, char *fsys)
sblock.fs_flags |= FS_DOSOFTDEP;
if (Lflag)
strlcpy(sblock.fs_volname, volumelabel, MAXVOLLEN);
if (lflag)
sblock.fs_flags |= FS_MULTILABEL;
/*
* Validate the given file system size.
* Verify that its last block can actually be accessed.

View File

@ -40,7 +40,7 @@
.Nd construct a new UFS1/UFS2 file system
.Sh SYNOPSIS
.Nm
.Op Fl NU
.Op Fl NUl
.Op Fl L Ar volname
.Op Fl O Ar filesystem-type
.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.
One inode is required for each distinct file, so this value effectively
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
The percentage of space reserved from normal users; the minimum free
space threshold.

View File

@ -120,6 +120,7 @@ int Oflag = 2; /* file system format (1 => UFS1, 2 => UFS2) */
int Rflag; /* regression test */
int Uflag; /* enable soft updates for file system */
int Eflag = 0; /* exit in middle of newfs for testing */
int lflag; /* enable multilabel for file system */
quad_t fssize; /* file system size */
int sectorsize; /* bytes/sector */
int realsectorsize; /* bytes/sector in hardware */
@ -157,7 +158,7 @@ main(int argc, char *argv[])
off_t mediasize;
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) {
case 'E':
Eflag++;
@ -239,6 +240,9 @@ main(int argc, char *argv[])
if ((density = atoi(optarg)) <= 0)
errx(1, "%s: bad bytes per inode", optarg);
break;
case 'l':
lflag = 1;
break;
case 'm':
if ((minfree = atoi(optarg)) < 0 || minfree > 99)
errx(1, "%s: bad free space %%", optarg);

View File

@ -53,6 +53,7 @@ extern int Oflag; /* build UFS1 format file system */
extern int Rflag; /* regression test */
extern int Uflag; /* enable soft updates for file system */
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 int sectorsize; /* bytes/sector */
extern int realsectorsize; /* bytes/sector in hardware*/