Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/newfs_udf Fix newfs(8) to compile again.
details: https://anonhg.NetBSD.org/src/rev/200660393975
branches: trunk
changeset: 789063:200660393975
user: reinoud <reinoud%NetBSD.org@localhost>
date: Mon Aug 05 20:52:08 2013 +0000
description:
Fix newfs(8) to compile again.
diffstat:
sbin/newfs_udf/newfs_udf.h | 4 ---
sbin/newfs_udf/udf_write.c | 60 ++++-----------------------------------------
sbin/newfs_udf/udf_write.h | 5 +++
3 files changed, 11 insertions(+), 58 deletions(-)
diffs (238 lines):
diff -r 13ee871effb4 -r 200660393975 sbin/newfs_udf/newfs_udf.h
--- a/sbin/newfs_udf/newfs_udf.h Mon Aug 05 18:49:58 2013 +0000
+++ b/sbin/newfs_udf/newfs_udf.h Mon Aug 05 20:52:08 2013 +0000
@@ -41,9 +41,7 @@
/* global variables describing disc and format requests */
extern int fd; /* device: file descriptor */
extern char *dev; /* device: name */
-#if !HAVE_NBTOOL_CONFIG_H
extern struct mmc_discinfo mmc_discinfo; /* device: disc info */
-#endif
extern char *format_str; /* format: string representation */
extern int format_flags; /* format: attribute flags */
@@ -61,9 +59,7 @@
/* prototypes */
int udf_write_sector(void *sector, uint32_t location);
-#if !HAVE_NBTOOL_CONFIG_H
int udf_update_trackinfo(struct mmc_discinfo *di, struct mmc_trackinfo *ti);
-#endif
/* tmp */
int writeout_write_queue(void);
diff -r 13ee871effb4 -r 200660393975 sbin/newfs_udf/udf_write.c
--- a/sbin/newfs_udf/udf_write.c Mon Aug 05 18:49:58 2013 +0000
+++ b/sbin/newfs_udf/udf_write.c Mon Aug 05 20:52:08 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_write.c,v 1.5 2013/08/05 17:12:04 joerg Exp $ */
+/* $NetBSD: udf_write.c,v 1.6 2013/08/05 20:52:08 reinoud Exp $ */
/*
* Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
@@ -30,9 +30,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: udf_write.c,v 1.5 2013/08/05 17:12:04 joerg Exp $");
-
-#define _EXPOSE_MMC
+__RCSID("$NetBSD: udf_write.c,v 1.6 2013/08/05 20:52:08 reinoud Exp $");
#include <stdio.h>
#include <stdlib.h>
@@ -43,8 +41,12 @@
#include <err.h>
#include <sys/types.h>
#include <sys/param.h>
+
#if !HAVE_NBTOOL_CONFIG_H
+#define _EXPOSE_MMC
#include <sys/cdio.h>
+#else
+#include "udf/cdio_mmc_structs.h"
#endif
#include "udf_create.h"
@@ -54,7 +56,6 @@
union dscrptr *terminator_dscr;
-
static int
udf_write_phys(void *blob, uint32_t location, uint32_t sects)
{
@@ -175,7 +176,6 @@
int
udf_derive_format(int req_enable, int req_disable, int force)
{
-#if !HAVE_NBTOOL_CONFIG_H
/* disc writability, formatted, appendable */
if ((mmc_discinfo.mmc_cur & MMC_CAP_RECORDABLE) == 0) {
(void)printf("Can't newfs readonly device\n");
@@ -199,10 +199,8 @@
return EROFS;
}
}
-#endif
/* determine UDF format */
-#if !HAVE_NBTOOL_CONFIG_H
format_flags = 0;
if (mmc_discinfo.mmc_cur & MMC_CAP_REWRITABLE) {
/* all rewritable media */
@@ -235,13 +233,6 @@
format_flags |= FORMAT_WORM;
}
}
-#else
- format_flags = FORMAT_REWRITABLE;
- if (context.min_udf >= 0x0250) {
- /* standard dictates meta as default */
- format_flags |= FORMAT_META;
- }
-#endif
/* enable/disable requests */
if (req_disable & FORMAT_META) {
@@ -257,7 +248,6 @@
/* determine partition/media access type */
media_accesstype = UDF_ACCESSTYPE_NOT_SPECIFIED;
-#if !HAVE_NBTOOL_CONFIG_H
if (mmc_discinfo.mmc_cur & MMC_CAP_REWRITABLE) {
media_accesstype = UDF_ACCESSTYPE_OVERWRITABLE;
if (mmc_discinfo.mmc_cur & MMC_CAP_ERASABLE)
@@ -268,9 +258,6 @@
}
if (mmc_discinfo.mmc_cur & MMC_CAP_PSEUDOOVERWRITE)
media_accesstype = UDF_ACCESSTYPE_PSEUDO_OVERWITE;
-#else
- media_accesstype = UDF_ACCESSTYPE_OVERWRITABLE;
-#endif
/* patch up media accesstype */
if (req_enable & FORMAT_READONLY) {
@@ -336,30 +323,21 @@
if (context.logvol_name == NULL)
context.logvol_name = strdup("anonymous");
if (context.primary_name == NULL) {
-#if !HAVE_NBTOOL_CONFIG_H
if (mmc_discinfo.disc_flags & MMC_DFLAGS_DISCIDVALID) {
primary_nr = mmc_discinfo.disc_id;
} else {
primary_nr = (uint32_t) random();
}
-#else
- primary_nr = (uint32_t) random();
-#endif
context.primary_name = calloc(32, 1);
sprintf(context.primary_name, "%08"PRIx32, primary_nr);
}
if (context.volset_name == NULL) {
-#if !HAVE_NBTOOL_CONFIG_H
if (mmc_discinfo.disc_flags & MMC_DFLAGS_BARCODEVALID) {
volset_nr = mmc_discinfo.disc_barcode;
} else {
volset_nr = (uint32_t) random();
volset_nr |= ((uint64_t) random()) << 32;
}
-#else
- volset_nr = (uint32_t) random();
- volset_nr |= ((uint64_t) random()) << 32;
-#endif
context.volset_name = calloc(128,1);
sprintf(context.volset_name, "%016"PRIx64, volset_nr);
}
@@ -467,11 +445,7 @@
{
union dscrptr *zero_dscr;
union dscrptr *dscr;
-#if !HAVE_NBTOOL_CONFIG_H
struct mmc_trackinfo ti;
-#else
- extern off_t sectors;
-#endif
uint32_t sparable_blocks;
uint32_t sector_size, blockingnr;
uint32_t cnt, loc, len;
@@ -479,29 +453,22 @@
int error, integrity_type;
int data_part, metadata_part;
-#if !HAVE_NBTOOL_CONFIG_H
/* init */
sector_size = mmc_discinfo.sector_size;
/* determine span/size */
ti.tracknr = mmc_discinfo.first_track_last_session;
error = udf_update_trackinfo(&mmc_discinfo, &ti);
-#else
- sector_size = 2048;
-#endif
if (error)
return error;
-#if !HAVE_NBTOOL_CONFIG_H
if (mmc_discinfo.sector_size < context.sector_size) {
fprintf(stderr, "Impossible to format: sectorsize too small\n");
return EIO;
}
-#endif
context.sector_size = sector_size;
/* determine blockingnr */
-#if !HAVE_NBTOOL_CONFIG_H
blockingnr = ti.packet_size;
if (blockingnr <= 1) {
/* paranoia on blockingnr */
@@ -554,17 +521,6 @@
ti.track_start, mmc_discinfo.last_possible_lba,
context.sector_size, blockingnr, sparable_blocks,
meta_fract);
-#else
- blockingnr = 32;
- wrtrack_skew = 0;
- sparable_blocks = 32;
-
- error = udf_calculate_disc_layout(format_flags, context.min_udf,
- wrtrack_skew,
- 0, sectors - 1,
- context.sector_size, blockingnr, sparable_blocks,
- meta_fract);
-#endif
/* cache partition for we need it often */
data_part = context.data_part;
@@ -596,11 +552,7 @@
if ((zero_dscr = calloc(1, context.sector_size)) == NULL)
return ENOMEM;
-#if !HAVE_NBTOOL_CONFIG_H
loc = (format_flags & FORMAT_TRACK512) ? layout.vds1 : ti.track_start;
-#else
- loc = (format_flags & FORMAT_TRACK512) ? layout.vds1 : 0;
-#endif
for (; loc < layout.part_start_lba; loc++) {
if ((error = udf_write_sector(zero_dscr, loc))) {
free(zero_dscr);
diff -r 13ee871effb4 -r 200660393975 sbin/newfs_udf/udf_write.h
--- a/sbin/newfs_udf/udf_write.h Mon Aug 05 18:49:58 2013 +0000
+++ b/sbin/newfs_udf/udf_write.h Mon Aug 05 20:52:08 2013 +0000
@@ -1,3 +1,5 @@
+/* $NetBSD: udf_write.h,v 1.4 2013/08/05 20:52:08 reinoud Exp $ */
+
/*
* Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
* All rights reserved.
@@ -29,7 +31,10 @@
#include "udf_create.h"
#if !HAVE_NBTOOL_CONFIG_H
+#define _EXPOSE_MMC
#include <sys/cdio.h>
+#else
+#include "udf/cdio_mmc_structs.h"
#endif
/* prototypes */
Home |
Main Index |
Thread Index |
Old Index