Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makefs Handle > 2GB images. Thanks to Greg Troxel f...
details: https://anonhg.NetBSD.org/src/rev/20d4612cffb4
branches: trunk
changeset: 758225:20d4612cffb4
user: christos <christos%NetBSD.org@localhost>
date: Wed Oct 27 18:51:34 2010 +0000
description:
Handle > 2GB images. Thanks to Greg Troxel for testing!
diffstat:
usr.sbin/makefs/cd9660.c | 37 ++++++++++++-----------
usr.sbin/makefs/cd9660.h | 49 +++++++++++++++----------------
usr.sbin/makefs/cd9660/cd9660_debug.c | 11 +++---
usr.sbin/makefs/cd9660/cd9660_eltorito.c | 6 +-
4 files changed, 51 insertions(+), 52 deletions(-)
diffs (278 lines):
diff -r eec7bf85c5f6 -r 20d4612cffb4 usr.sbin/makefs/cd9660.c
--- a/usr.sbin/makefs/cd9660.c Wed Oct 27 18:29:46 2010 +0000
+++ b/usr.sbin/makefs/cd9660.c Wed Oct 27 18:51:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660.c,v 1.26 2009/01/16 18:02:24 pooka Exp $ */
+/* $NetBSD: cd9660.c,v 1.27 2010/10/27 18:51:34 christos Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660.c,v 1.26 2009/01/16 18:02:24 pooka Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.27 2010/10/27 18:51:34 christos Exp $");
#endif /* !__lint */
#include <string.h>
@@ -158,7 +158,7 @@
#endif
static int cd9660_convert_filename(const char *, char *, int);
static void cd9660_populate_dot_records(cd9660node *);
-static int cd9660_compute_offsets(cd9660node *, int);
+static int64_t cd9660_compute_offsets(cd9660node *, int64_t);
#if 0
static int cd9660_copy_stat_info(cd9660node *, cd9660node *, int);
#endif
@@ -451,11 +451,11 @@
cd9660_makefs(const char *image, const char *dir, fsnode *root,
fsinfo_t *fsopts)
{
- int startoffset;
+ int64_t startoffset;
int numDirectories;
- int pathTableSectors;
- int firstAvailableSector;
- int totalSpace;
+ uint64_t pathTableSectors;
+ int64_t firstAvailableSector;
+ int64_t totalSpace;
int error;
cd9660node *real_root;
@@ -563,7 +563,7 @@
diskStructure.primaryBigEndianTableSector + pathTableSectors;
if (diskStructure.verbose_level > 0)
printf("cd9660_makefs: Path table conversion complete. "
- "Each table is %i bytes, or %i sectors.\n",
+ "Each table is %i bytes, or %" PRIu64 " sectors.\n",
diskStructure.pathTableLength, pathTableSectors);
startoffset = diskStructure.sectorSize*diskStructure.dataFirstSector;
@@ -592,11 +592,12 @@
/* Debugging output */
if (diskStructure.verbose_level > 0) {
printf("cd9660_makefs: Sectors 0-15 reserved\n");
- printf("cd9660_makefs: Primary path tables starts in sector %i\n",
- diskStructure.primaryLittleEndianTableSector);
- printf("cd9660_makefs: File data starts in sector %i\n",
- diskStructure.dataFirstSector);
- printf("cd9660_makefs: Total sectors: %i\n",diskStructure.totalSectors);
+ printf("cd9660_makefs: Primary path tables starts in sector %"
+ PRId64 "\n", diskStructure.primaryLittleEndianTableSector);
+ printf("cd9660_makefs: File data starts in sector %"
+ PRId64 "\n", diskStructure.dataFirstSector);
+ printf("cd9660_makefs: Total sectors: %"
+ PRId64 "\n", diskStructure.totalSectors);
}
/*
@@ -1822,19 +1823,19 @@
* @returns int The total size of files and directory entries (should be
* a multiple of sector size)
*/
-static int
-cd9660_compute_offsets(cd9660node *node, int startOffset)
+static int64_t
+cd9660_compute_offsets(cd9660node *node, int64_t startOffset)
{
/*
* This function needs to compute the size of directory records and
* runs, file lengths, and set the appropriate variables both in
* cd9660node and isoDirEntry
*/
- int used_bytes = 0;
- int current_sector_usage = 0;
+ int64_t used_bytes = 0;
+ int64_t current_sector_usage = 0;
cd9660node *child;
fsinode *inode;
- int r;
+ int64_t r;
assert(node != NULL);
diff -r eec7bf85c5f6 -r 20d4612cffb4 usr.sbin/makefs/cd9660.h
--- a/usr.sbin/makefs/cd9660.h Wed Oct 27 18:29:46 2010 +0000
+++ b/usr.sbin/makefs/cd9660.h Wed Oct 27 18:51:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660.h,v 1.14 2010/10/22 00:49:15 christos Exp $ */
+/* $NetBSD: cd9660.h,v 1.15 2010/10/27 18:51:34 christos Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -181,10 +181,7 @@
*/
int64_t fileDataLength;
- /*
- * XXXfvdl sectors are int
- */
- int fileSectorsUsed;
+ int64_t fileSectorsUsed;
int fileRecordSize;/*copy of a variable, int for quicker calculations*/
/* Old name, used for renaming - needs to be optimized but low priority */
@@ -196,21 +193,21 @@
/* For Rock Ridge */
struct _cd9660node *rr_real_parent, *rr_relocated;
- int susp_entry_size;
- int susp_dot_entry_size;
- int susp_dot_dot_entry_size;
+ int64_t susp_entry_size;
+ int64_t susp_dot_entry_size;
+ int64_t susp_dot_dot_entry_size;
/* Continuation area stuff */
- int susp_entry_ce_start;
- int susp_dot_ce_start;
- int susp_dot_dot_ce_start;
+ int64_t susp_entry_ce_start;
+ int64_t susp_dot_ce_start;
+ int64_t susp_dot_dot_ce_start;
- int susp_entry_ce_length;
- int susp_dot_ce_length;
- int susp_dot_dot_ce_length;
+ int64_t susp_entry_ce_length;
+ int64_t susp_dot_ce_length;
+ int64_t susp_dot_dot_ce_length;
/* Data to put at the end of the System Use field */
- int su_tail_size;
+ int64_t su_tail_size;
char *su_tail_data;
/*** PATH TABLE STUFF ***/
@@ -234,7 +231,7 @@
typedef struct _volume_descriptor
{
u_char *volumeDescriptorData; /*ALWAYS 2048 bytes long*/
- int sector;
+ int64_t sector;
struct _volume_descriptor *next;
} volume_descriptor;
@@ -251,22 +248,22 @@
/* Important sector numbers here */
/* primaryDescriptor.type_l_path_table*/
- int primaryBigEndianTableSector;
+ int64_t primaryBigEndianTableSector;
/* primaryDescriptor.type_m_path_table*/
- int primaryLittleEndianTableSector;
+ int64_t primaryLittleEndianTableSector;
/* primaryDescriptor.opt_type_l_path_table*/
- int secondaryBigEndianTableSector;
+ int64_t secondaryBigEndianTableSector;
/* primaryDescriptor.opt_type_m_path_table*/
- int secondaryLittleEndianTableSector;
+ int64_t secondaryLittleEndianTableSector;
/* primaryDescriptor.path_table_size*/
int pathTableLength;
- int dataFirstSector;
+ int64_t dataFirstSector;
- int totalSectors;
+ int64_t totalSectors;
/* OPTIONS GO HERE */
int isoLevel;
@@ -278,9 +275,9 @@
int keep_bad_images;
/* SUSP options and variables */
- int susp_continuation_area_start_sector;
- int susp_continuation_area_size;
- int susp_continuation_area_current_free;
+ int64_t susp_continuation_area_start_sector;
+ int64_t susp_continuation_area_size;
+ int64_t susp_continuation_area_current_free;
int rock_ridge_enabled;
/* Other Rock Ridge Variables */
@@ -304,7 +301,7 @@
char *generic_bootimage;
int is_bootable;/* Default to 0 */
- int boot_catalog_sector;
+ int64_t boot_catalog_sector;
boot_volume_descriptor *boot_descriptor;
char * boot_image_directory;
diff -r eec7bf85c5f6 -r 20d4612cffb4 usr.sbin/makefs/cd9660/cd9660_debug.c
--- a/usr.sbin/makefs/cd9660/cd9660_debug.c Wed Oct 27 18:29:46 2010 +0000
+++ b/usr.sbin/makefs/cd9660/cd9660_debug.c Wed Oct 27 18:51:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_debug.c,v 1.10 2010/10/22 00:49:15 christos Exp $ */
+/* $NetBSD: cd9660_debug.c,v 1.11 2010/10/27 18:51:35 christos Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -40,7 +40,7 @@
#include <sys/param.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_debug.c,v 1.10 2010/10/22 00:49:15 christos Exp $");
+__RCSID("$NetBSD: cd9660_debug.c,v 1.11 2010/10/27 18:51:35 christos Exp $");
#endif /* !__lint */
#if !HAVE_NBTOOL_CONFIG_H
@@ -105,12 +105,12 @@
printf("..(%i)\n",
isonum_733(node->isoDirRecord->extent));
} else if (node->isoDirRecord->name[0]=='\0') {
- printf("(ROOT) (%i to %i)\n",
+ printf("(ROOT) (%" PRIu32 " to %" PRId64 ")\n",
node->fileDataSector,
node->fileDataSector +
node->fileSectorsUsed - 1);
} else {
- printf("%s (%s) (%i to %i)\n",
+ printf("%s (%s) (%" PRIu32 " to %" PRId64 ")\n",
node->isoDirRecord->name,
(node->isoDirRecord->flags[0]
& ISO_FLAG_DIRECTORY) ? "DIR" : "FILE",
@@ -160,7 +160,8 @@
while (tmp != NULL) {
memset(temp, 0, CD9660_SECTOR_SIZE);
memcpy(temp, tmp->volumeDescriptorData + 1, 5);
- printf("Volume descriptor in sector %i: type %i, ID %s\n",
+ printf("Volume descriptor in sector %" PRId64
+ ": type %i, ID %s\n",
tmp->sector, tmp->volumeDescriptorData[0], temp);
switch(tmp->volumeDescriptorData[0]) {
case 0:/*boot record*/
diff -r eec7bf85c5f6 -r 20d4612cffb4 usr.sbin/makefs/cd9660/cd9660_eltorito.c
--- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c Wed Oct 27 18:29:46 2010 +0000
+++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c Wed Oct 27 18:51:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_eltorito.c,v 1.13 2010/10/22 00:49:15 christos Exp $ */
+/* $NetBSD: cd9660_eltorito.c,v 1.14 2010/10/27 18:51:35 christos Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_eltorito.c,v 1.13 2010/10/22 00:49:15 christos Exp $");
+__RCSID("$NetBSD: cd9660_eltorito.c,v 1.14 2010/10/27 18:51:35 christos Exp $");
#endif /* !__lint */
#ifdef DEBUG
@@ -511,7 +511,7 @@
err(1, "fseeko");
if (diskStructure.verbose_level > 0) {
- printf("Writing boot catalog to sector %d\n",
+ printf("Writing boot catalog to sector %" PRId64 "\n",
diskStructure.boot_catalog_sector);
}
LIST_FOREACH(e, &diskStructure.boot_entries, ll_struct) {
Home |
Main Index |
Thread Index |
Old Index