Module Name:    src
Committed By:   reinoud
Date:           Tue Aug  6 12:49:13 UTC 2013

Modified Files:
        src/sbin/newfs_udf: newfs_udf.c udf_create.c udf_create.h

Log Message:
Oops, forgot to export a_udf_version() that checks if the input string is a
valid UDF version notation.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/newfs_udf/newfs_udf.c
cvs rdiff -u -r1.20 -r1.21 src/sbin/newfs_udf/udf_create.c
cvs rdiff -u -r1.5 -r1.6 src/sbin/newfs_udf/udf_create.h

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

Modified files:

Index: src/sbin/newfs_udf/newfs_udf.c
diff -u src/sbin/newfs_udf/newfs_udf.c:1.15 src/sbin/newfs_udf/newfs_udf.c:1.16
--- src/sbin/newfs_udf/newfs_udf.c:1.15	Mon Aug  5 14:11:30 2013
+++ src/sbin/newfs_udf/newfs_udf.c	Tue Aug  6 12:49:13 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: newfs_udf.c,v 1.15 2013/08/05 14:11:30 reinoud Exp $ */
+/* $NetBSD: newfs_udf.c,v 1.16 2013/08/06 12:49:13 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
@@ -635,62 +635,7 @@ udf_do_newfs(void)
 	return error;
 }
 
-/* --------------------------------------------------------------------- */
-
-
-/* version can be specified as 0xabc or a.bc */
-static int
-parse_udfversion(const char *pos, uint32_t *version) {
-	int hex = 0;
-	char c1, c2, c3, c4;
-
-	*version = 0;
-	if (*pos == '0') {
-		pos++;
-		/* expect hex format */
-		hex = 1;
-		if (*pos++ != 'x')
-			return 1;
-	}
-
-	c1 = *pos++;
-	if (c1 < '0' || c1 > '9')
-		return 1;
-	c1 -= '0';
-
-	c2 = *pos++;
-	if (!hex) {
-		if (c2 != '.')
-			return 1;
-		c2 = *pos++;
-	}
-	if (c2 < '0' || c2 > '9')
-		return 1;
-	c2 -= '0';
-
-	c3 = *pos++;
-	if (c3 < '0' || c3 > '9')
-		return 1;
-	c3 -= '0';
-
-	c4 = *pos++;
-	if (c4 != 0)
-		return 1;
-
-	*version = c1 * 0x100 + c2 * 0x10 + c3;
-	return 0;
-}
-
-
-static int
-a_udf_version(const char *s, const char *id_type)
-{
-	uint32_t version;
 
-	if (parse_udfversion(s, &version))
-		errx(1, "unknown %s id %s; specify as hex or float", id_type, s);
-	return version;
-}
 
 /* --------------------------------------------------------------------- */
 

Index: src/sbin/newfs_udf/udf_create.c
diff -u src/sbin/newfs_udf/udf_create.c:1.20 src/sbin/newfs_udf/udf_create.c:1.21
--- src/sbin/newfs_udf/udf_create.c:1.20	Mon Aug  5 17:12:04 2013
+++ src/sbin/newfs_udf/udf_create.c	Tue Aug  6 12:49:13 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_create.c,v 1.20 2013/08/05 17:12:04 joerg Exp $ */
+/* $NetBSD: udf_create.c,v 1.21 2013/08/06 12:49:13 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: udf_create.c,v 1.20 2013/08/05 17:12:04 joerg Exp $");
+__RCSID("$NetBSD: udf_create.c,v 1.21 2013/08/06 12:49:13 reinoud Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -103,6 +103,62 @@ udf_init_create_context(void)
 }
 
 
+/* version can be specified as 0xabc or a.bc */
+static int
+parse_udfversion(const char *pos, uint32_t *version) {
+	int hex = 0;
+	char c1, c2, c3, c4;
+
+	*version = 0;
+	if (*pos == '0') {
+		pos++;
+		/* expect hex format */
+		hex = 1;
+		if (*pos++ != 'x')
+			return 1;
+	}
+
+	c1 = *pos++;
+	if (c1 < '0' || c1 > '9')
+		return 1;
+	c1 -= '0';
+
+	c2 = *pos++;
+	if (!hex) {
+		if (c2 != '.')
+			return 1;
+		c2 = *pos++;
+	}
+	if (c2 < '0' || c2 > '9')
+		return 1;
+	c2 -= '0';
+
+	c3 = *pos++;
+	if (c3 < '0' || c3 > '9')
+		return 1;
+	c3 -= '0';
+
+	c4 = *pos++;
+	if (c4 != 0)
+		return 1;
+
+	*version = c1 * 0x100 + c2 * 0x10 + c3;
+	return 0;
+}
+
+
+/* parse a given string for an udf version */
+int
+a_udf_version(const char *s, const char *id_type)
+{
+	uint32_t version;
+
+	if (parse_udfversion(s, &version))
+		errx(1, "unknown %s id %s; specify as hex or float", id_type, s);
+	return version;
+}
+
+
 static uint32_t
 udf_space_bitmap_len(uint32_t part_size)
 {

Index: src/sbin/newfs_udf/udf_create.h
diff -u src/sbin/newfs_udf/udf_create.h:1.5 src/sbin/newfs_udf/udf_create.h:1.6
--- src/sbin/newfs_udf/udf_create.h:1.5	Mon Aug  5 17:12:04 2013
+++ src/sbin/newfs_udf/udf_create.h	Tue Aug  6 12:49:13 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_create.h,v 1.5 2013/08/05 17:12:04 joerg Exp $ */
+/* $NetBSD: udf_create.h,v 1.6 2013/08/06 12:49:13 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -216,6 +216,8 @@ extern struct udf_disclayout     layout;
 
 /* prototypes */
 void udf_init_create_context(void);
+int a_udf_version(const char *s, const char *id_type);
+
 int udf_calculate_disc_layout(int format_flags, int min_udf,
 	uint32_t wrtrack_skew,
 	uint32_t first_lba, uint32_t last_lba,

Reply via email to