Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/newfs_udf Oops, forgot to export a_udf_version() that c...
details: https://anonhg.NetBSD.org/src/rev/c0ea3eed8a2d
branches: trunk
changeset: 789092:c0ea3eed8a2d
user: reinoud <reinoud%NetBSD.org@localhost>
date: Tue Aug 06 12:49:13 2013 +0000
description:
Oops, forgot to export a_udf_version() that checks if the input string is a
valid UDF version notation.
diffstat:
sbin/newfs_udf/newfs_udf.c | 57 +------------------------------------------
sbin/newfs_udf/udf_create.c | 60 +++++++++++++++++++++++++++++++++++++++++++-
sbin/newfs_udf/udf_create.h | 4 ++-
3 files changed, 62 insertions(+), 59 deletions(-)
diffs (172 lines):
diff -r 9f4af1af2301 -r c0ea3eed8a2d sbin/newfs_udf/newfs_udf.c
--- a/sbin/newfs_udf/newfs_udf.c Tue Aug 06 12:47:21 2013 +0000
+++ b/sbin/newfs_udf/newfs_udf.c Tue Aug 06 12:49:13 2013 +0000
@@ -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,63 +635,8 @@
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;
-}
-
/* --------------------------------------------------------------------- */
static void
diff -r 9f4af1af2301 -r c0ea3eed8a2d sbin/newfs_udf/udf_create.c
--- a/sbin/newfs_udf/udf_create.c Tue Aug 06 12:47:21 2013 +0000
+++ b/sbin/newfs_udf/udf_create.c Tue Aug 06 12:49:13 2013 +0000
@@ -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 @@
}
+/* 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)
{
diff -r 9f4af1af2301 -r c0ea3eed8a2d sbin/newfs_udf/udf_create.h
--- a/sbin/newfs_udf/udf_create.h Tue Aug 06 12:47:21 2013 +0000
+++ b/sbin/newfs_udf/udf_create.h Tue Aug 06 12:49:13 2013 +0000
@@ -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 @@
/* 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,
Home |
Main Index |
Thread Index |
Old Index