svn commit: r226275 - in stable/9/usr.sbin/makefs: . ffs

Nathan Whitehorn nwhitehorn at FreeBSD.org
Wed Oct 12 01:57:00 UTC 2011


Author: nwhitehorn
Date: Wed Oct 12 01:57:00 2011
New Revision: 226275
URL: http://svn.freebsd.org/changeset/base/226275

Log:
  Add support to makefs(8) to add UFS labels to images.
  
  Submitted by:	avg
  Approved by:	re (kib)

Modified:
  stable/9/usr.sbin/makefs/ffs.c
  stable/9/usr.sbin/makefs/ffs.h
  stable/9/usr.sbin/makefs/ffs/mkfs.c
  stable/9/usr.sbin/makefs/makefs.8
Directory Properties:
  stable/9/usr.sbin/makefs/   (props changed)

Modified: stable/9/usr.sbin/makefs/ffs.c
==============================================================================
--- stable/9/usr.sbin/makefs/ffs.c	Wed Oct 12 01:19:12 2011	(r226274)
+++ stable/9/usr.sbin/makefs/ffs.c	Wed Oct 12 01:57:00 2011	(r226275)
@@ -236,6 +236,9 @@ ffs_parse_opts(const char *option, fsinf
 			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);
 

Modified: stable/9/usr.sbin/makefs/ffs.h
==============================================================================
--- stable/9/usr.sbin/makefs/ffs.h	Wed Oct 12 01:19:12 2011	(r226274)
+++ stable/9/usr.sbin/makefs/ffs.h	Wed Oct 12 01:57:00 2011	(r226275)
@@ -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 */

Modified: stable/9/usr.sbin/makefs/ffs/mkfs.c
==============================================================================
--- stable/9/usr.sbin/makefs/ffs/mkfs.c	Wed Oct 12 01:19:12 2011	(r226274)
+++ stable/9/usr.sbin/makefs/ffs/mkfs.c	Wed Oct 12 01:57:00 2011	(r226275)
@@ -139,7 +139,9 @@ ffs_mkfs(const char *fsys, const fsinfo_
 	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;

Modified: stable/9/usr.sbin/makefs/makefs.8
==============================================================================
--- stable/9/usr.sbin/makefs/makefs.8	Wed Oct 12 01:19:12 2011	(r226274)
+++ stable/9/usr.sbin/makefs/makefs.8	Wed Oct 12 01:57:00 2011	(r226275)
@@ -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


More information about the svn-src-stable-9 mailing list