Module Name:    src
Committed By:   reinoud
Date:           Tue Aug  6 12:19:34 UTC 2013

Modified Files:
        src/usr.sbin/makefs: makefs.8 udf.c

Log Message:
Allow for the logical volume label to be specified as well as the physical
volume label. Also allow the volumeset name to be specified if desired. The
syntax follows the newfs_udf(8) syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/udf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.50 src/usr.sbin/makefs/makefs.8:1.51
--- src/usr.sbin/makefs/makefs.8:1.50	Tue Aug  6 12:12:51 2013
+++ src/usr.sbin/makefs/makefs.8	Tue Aug  6 12:19:34 2013
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.50 2013/08/06 12:12:51 wiz Exp $
+.\"	$NetBSD: makefs.8,v 1.51 2013/08/06 12:19:34 reinoud Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -397,10 +397,11 @@ Each of the options consists of a keywor
 .Pq Ql = ,
 and a value.
 The following keywords are supported:
+.Pp
 .Bl -tag -width optimization -compact
 .It Sy disctype
 This can have the following values:
-.Bl -tag -width dvdramXbdreXdiskXXX -compact
+.Bl -tag -width cdromXdvdromXbdromXXX -compact
 .It Sy cdrom , Sy dvdrom , Sy bdrom
 create a read-only fs
 .It Sy dvdram , Sy bdre , Sy disk
@@ -412,9 +413,17 @@ create a rewritable fs with sparing for 
 .El
 When an optical media is selected here, the sectorsize and the default disc
 size is assumed unless given explicitly.
-For rom images the disc size is the
-minimum needed.
+For rom images the disc size is the minimum needed.
 .El
+.Bl -tag -width optimization -compact
+.It Sy loglabel
+Set the logical volume label of the disc to the specified argument.
+.It Sy discid
+Set the physical volume label of the disc to the specified argument. Prepend
+the physical volume label with a volumeset label separated with a ':' if
+wanted. For strict conformance and interchange, don't set the volumeset label
+manually unless it has an unique hex number in the first 8 character
+positions.
 .Sh SEE ALSO
 .Xr strsuftoll 3 ,
 .Xr installboot 8 ,

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.7 src/usr.sbin/makefs/udf.c:1.8
--- src/usr.sbin/makefs/udf.c:1.7	Tue Aug  6 09:32:23 2013
+++ src/usr.sbin/makefs/udf.c	Tue Aug  6 12:19:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.7 2013/08/06 09:32:23 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.8 2013/08/06 12:19:34 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: udf.c,v 1.7 2013/08/06 09:32:23 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.8 2013/08/06 12:19:34 reinoud Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -288,9 +288,11 @@ udf_prep_opts(fsinfo_t *fsopts)
 	time_t now;
 
 	const option_t udf_options[] = {
-		OPT_STR('T', "disctype", "disc type (cdrom,dvdrom,bdrom,dvdram,bdre,disk,cdr,dvdr,bdr,cdrw,dvdrw)"),
-//		{ 'P', "progress", &display_progressbar, OPT_INT32, false, true,
-//		  "display progress bar" },
+		OPT_STR('T', "disctype", "disc type (cdrom,dvdrom,bdrom,"
+			"dvdram,bdre,disk,cdr,dvdr,bdr,cdrw,dvdrw)"),
+		OPT_STR('L', "loglabel", "\"logical volume name\""),
+		OPT_STR('P', "discid",   "[\"volset name\"':']"
+			"\"physical volume name\""),
 		{ .name = NULL }
 	};
 
@@ -347,7 +349,7 @@ udf_parse_opts(const char *option, fsinf
 	uint64_t stdsize;
 	uint32_t set_sectorsize;
 	const char *name, *desc;
-	char buf[1024];
+	char buffer[1024], *buf, *colon;
 	int i;
 
 	assert(option != NULL);
@@ -355,7 +357,7 @@ udf_parse_opts(const char *option, fsinf
 	if (debug & DEBUG_FS_PARSE_OPTS)
 		printf("udf_parse_opts: got `%s'\n", option);
 
-	i = set_option(udf_options, option, buf, sizeof(buf));
+	i = set_option(udf_options, option, buffer, sizeof(buffer));
 	if (i == -1)
 		return 0;
 
@@ -365,6 +367,7 @@ udf_parse_opts(const char *option, fsinf
 	set_sectorsize = 0;
 	stdsize = 0;
 
+	buf = buffer;
 	name = udf_options[i].name;
 	desc = udf_options[i].desc;
 	switch (udf_options[i].letter) {
@@ -404,6 +407,27 @@ udf_parse_opts(const char *option, fsinf
 		}
 		if (mmc_profile != 0x01)
 			set_sectorsize = 2048;
+		break;
+	case 'L':
+		if (context.logvol_name) free(context.logvol_name);
+		context.logvol_name = strdup(buf);
+		break;
+	case 'P':
+		if ((colon = strstr(buf, ":"))) {
+			if (context.volset_name)
+				free(context.volset_name);
+			*colon = 0;
+			context.volset_name = strdup(buf);
+			buf = colon+1;
+		}
+		if (context.primary_name)
+			free(context.primary_name);
+		if ((strstr(buf, ":"))) {
+			perror("primary name can't have ':' in its name");
+			return 0;
+		}
+		context.primary_name = strdup(buf);
+		break;
 	}
 	if (set_sectorsize)
 		fsopts->sectorsize = set_sectorsize;

Reply via email to