aboutsummaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2004-02-26 01:14:27 +0000
committerRobert Watson <rwatson@FreeBSD.org>2004-02-26 01:14:27 +0000
commitce20d788fa43a006bd466bc2bf69ee9cf1651a6b (patch)
treefc9111877d18382c6d76139cc79472cce73691e5 /sbin
parent47934cef8f8eae0614799485658acebe190602f7 (diff)
downloadsrc-ce20d788fa43a006bd466bc2bf69ee9cf1651a6b.tar.gz
src-ce20d788fa43a006bd466bc2bf69ee9cf1651a6b.zip
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
Notes
Notes: svn path=/head/; revision=126254
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 2ca9508379ed..4e7b514f5016 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 da6ac1ff3864..9a0350c91950 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 aff266e7fa14..ab90cf48b682 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 1c82685518ba..981701aa7882 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*/