summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-02-26 01:14:27 +0000
committerrwatson <rwatson@FreeBSD.org>2004-02-26 01:14:27 +0000
commitf0df387d8416e8fa18a3e6e923a4b45b5e8771d4 (patch)
treefc9111877d18382c6d76139cc79472cce73691e5 /sbin
parent1de257deb3229812024de5861eb0aaa41e471448 (diff)
downloadFreeBSD-src-f0df387d8416e8fa18a3e6e923a4b45b5e8771d4.zip
FreeBSD-src-f0df387d8416e8fa18a3e6e923a4b45b5e8771d4.tar.gz
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
Diffstat (limited to 'sbin')
-rw-r--r--sbin/newfs/mkfs.c2
-rw-r--r--sbin/newfs/newfs.84
-rw-r--r--sbin/newfs/newfs.c6
-rw-r--r--sbin/newfs/newfs.h1
4 files changed, 11 insertions, 2 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 2ca9508..4e7b514 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -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.
diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8
index da6ac1f..9a0350c 100644
--- a/sbin/newfs/newfs.8
+++ b/sbin/newfs/newfs.8
@@ -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.
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index aff266e..ab90cf4 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -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);
diff --git a/sbin/newfs/newfs.h b/sbin/newfs/newfs.h
index 1c82685..981701a 100644
--- a/sbin/newfs/newfs.h
+++ b/sbin/newfs/newfs.h
@@ -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*/
OpenPOWER on IntegriCloud