summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2011-10-09 16:22:31 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2011-10-09 16:22:31 +0000
commit058bef5f51167b4a2259f0995270ce777c197980 (patch)
tree95f5b2876f2cec7ffeded00be768203d6d682ffe /usr.sbin
parent187fe92b28e9f1274f337c7d4597e2934db396d0 (diff)
downloadFreeBSD-src-058bef5f51167b4a2259f0995270ce777c197980.zip
FreeBSD-src-058bef5f51167b4a2259f0995270ce777c197980.tar.gz
Add support to makefs(8) to add UFS labels to images.
Submitted by: avg MFC after: 3 days
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/makefs/ffs.c3
-rw-r--r--usr.sbin/makefs/ffs.h4
-rw-r--r--usr.sbin/makefs/ffs/mkfs.c4
-rw-r--r--usr.sbin/makefs/makefs.82
4 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index f833cf5..26843b6 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -236,6 +236,9 @@ ffs_parse_opts(const char *option, fsinfo_t *fsopts)
goto leave_ffs_parse_opts;
}
rv = 1;
+ } else if (strcmp(var, "label") == 0) {
+ strlcpy(ffs_opts->label, val, sizeof(ffs_opts->label));
+ rv = 1;
} else
rv = set_option(ffs_options, var, val);
diff --git a/usr.sbin/makefs/ffs.h b/usr.sbin/makefs/ffs.h
index 42611a4..65cfbd0 100644
--- a/usr.sbin/makefs/ffs.h
+++ b/usr.sbin/makefs/ffs.h
@@ -40,7 +40,11 @@
#ifndef _FFS_H
#define _FFS_H
+#include <ufs/ufs/dinode.h>
+#include <ufs/ffs/fs.h>
+
typedef struct {
+ char label[MAXVOLLEN]; /* volume name/label */
int bsize; /* block size */
int fsize; /* fragment size */
int cpg; /* cylinders per group */
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c
index 924ab6c..f99ecab 100644
--- a/usr.sbin/makefs/ffs/mkfs.c
+++ b/usr.sbin/makefs/ffs/mkfs.c
@@ -139,7 +139,9 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
avgfpdir = ffs_opts->avgfpdir;
bbsize = BBSIZE;
sbsize = SBLOCKSIZE;
-
+
+ strlcpy(sblock.fs_volname, ffs_opts->label, sizeof(sblock.fs_volname));
+
if (Oflag == 0) {
sblock.fs_old_inodefmt = FS_42INODEFMT;
sblock.fs_maxsymlinklen = 0;
diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8
index 9fe5c01..500827b 100644
--- a/usr.sbin/makefs/makefs.8
+++ b/usr.sbin/makefs/makefs.8
@@ -242,6 +242,8 @@ Block size.
Bytes per inode.
.It Sy fsize
Fragment size.
+.It Sy label
+Label name of the image.
.It Sy maxbpg
Maximum blocks per file in a cylinder group.
.It Sy minfree
OpenPOWER on IntegriCloud