cpio/cpio-2.6-lfs.patch
2006-03-25 17:40:51 +00:00

256 lines
9.3 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- cpio-2.6/src/util.c.lfs 2004-09-08 12:44:49.000000000 +0200
+++ cpio-2.6/src/util.c 2006-03-25 13:34:10.000000000 +0100
@@ -207,7 +207,7 @@
Exit with an error if end of file is reached. */
static int
-disk_fill_input_buffer (int in_des, int num_bytes)
+disk_fill_input_buffer (int in_des, off_t num_bytes)
{
in_buff = input_buffer;
num_bytes = (num_bytes < DISK_IO_BLOCK_SIZE) ? num_bytes : DISK_IO_BLOCK_SIZE;
@@ -227,10 +227,10 @@
When `out_buff' fills up, flush it to file descriptor OUT_DES. */
void
-tape_buffered_write (char *in_buf, int out_des, long num_bytes)
+tape_buffered_write (char *in_buf, int out_des, off_t num_bytes)
{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Room left in output buffer. */
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
+ off_t space_left; /* Room left in output buffer. */
while (bytes_left > 0)
{
@@ -254,10 +254,10 @@
When `out_buff' fills up, flush it to file descriptor OUT_DES. */
void
-disk_buffered_write (char *in_buf, int out_des, long num_bytes)
+disk_buffered_write (char *in_buf, int out_des, off_t num_bytes)
{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Room left in output buffer. */
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
+ off_t space_left; /* Room left in output buffer. */
while (bytes_left > 0)
{
@@ -282,10 +282,10 @@
When `in_buff' is exhausted, refill it from file descriptor IN_DES. */
void
-tape_buffered_read (char *in_buf, int in_des, long num_bytes)
+tape_buffered_read (char *in_buf, int in_des, off_t num_bytes)
{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Bytes to copy from input buffer. */
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
+ off_t space_left; /* Bytes to copy from input buffer. */
while (bytes_left > 0)
{
@@ -376,10 +376,10 @@
/* Skip the next NUM_BYTES bytes of file descriptor IN_DES. */
void
-tape_toss_input (int in_des, long num_bytes)
+tape_toss_input (int in_des, off_t num_bytes)
{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Bytes to copy from input buffer. */
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
+ off_t space_left; /* Bytes to copy from input buffer. */
while (bytes_left > 0)
{
@@ -404,12 +404,12 @@
}
static void
-write_nuls_to_file (long num_bytes, int out_des,
- void (*writer) (char *in_buf, int out_des, long num_bytes))
+write_nuls_to_file (off_t num_bytes, int out_des,
+ void (*writer) (char *in_buf, int out_des, off_t num_bytes))
{
- long blocks;
- long extra_bytes;
- long i;
+ off_t blocks;
+ off_t extra_bytes;
+ off_t i;
blocks = num_bytes / 512;
extra_bytes = num_bytes % 512;
@@ -428,7 +428,7 @@
NUM_BYTES is the number of bytes to copy. */
void
-copy_files_tape_to_disk (int in_des, int out_des, long num_bytes)
+copy_files_tape_to_disk (int in_des, int out_des, off_t num_bytes)
{
long size;
long k;
@@ -458,13 +458,13 @@
NUM_BYTES is the number of bytes to copy. */
void
-copy_files_disk_to_tape (int in_des, int out_des, long num_bytes,
+copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes,
char *filename)
{
long size;
long k;
int rc;
- long original_num_bytes;
+ off_t original_num_bytes;
original_num_bytes = num_bytes;
@@ -476,10 +476,10 @@
num_bytes : DISK_IO_BLOCK_SIZE))
{
if (rc > 0)
- error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
+ error (0, 0, _("File %s shrunk by %lld bytes, padding with zeros"),
filename, num_bytes);
else
- error (0, 0, _("Read error at byte %ld in file %s, padding with zeros"),
+ error (0, 0, _("Read error at byte %lld in file %s, padding with zeros"),
original_num_bytes - num_bytes, filename);
write_nuls_to_file (num_bytes, out_des, tape_buffered_write);
break;
@@ -505,12 +505,12 @@
NUM_BYTES is the number of bytes to copy. */
void
-copy_files_disk_to_disk (int in_des, int out_des, long num_bytes,
+copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes,
char *filename)
{
long size;
long k;
- long original_num_bytes;
+ off_t original_num_bytes;
int rc;
original_num_bytes = num_bytes;
@@ -520,10 +520,10 @@
if (rc = disk_fill_input_buffer (in_des, num_bytes))
{
if (rc > 0)
- error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
+ error (0, 0, _("File %s shrunk by %lld bytes, padding with zeros"),
filename, num_bytes);
else
- error (0, 0, _("Read error at byte %ld in file %s, padding with zeros"),
+ error (0, 0, _("Read error at byte %lld in file %s, padding with zeros"),
original_num_bytes - num_bytes, filename);
write_nuls_to_file (num_bytes, out_des, disk_buffered_write);
break;
@@ -544,7 +544,7 @@
/* Warn if file changed while it was being copied. */
void
-warn_if_file_changed (char *file_name, unsigned long old_file_size,
+warn_if_file_changed (char *file_name, off_t old_file_size,
unsigned long old_file_mtime)
{
struct stat new_file_stat;
@@ -696,8 +696,8 @@
temp = (temp + 1) % hash_size)
{
if (hash_table[temp]->inode == node_num
- && hash_table[start]->major_num == major_num
- && hash_table[start]->minor_num == minor_num)
+ && hash_table[temp]->major_num == major_num
+ && hash_table[temp]->minor_num == minor_num)
return hash_table[temp]->file_name;
}
}
--- cpio-2.6/src/copyin.c.lfs 2004-09-08 13:10:02.000000000 +0200
+++ cpio-2.6/src/copyin.c 2006-03-25 13:35:43.000000000 +0100
@@ -106,7 +106,7 @@
header type. */
static void
-tape_skip_padding (int in_file_des, int offset)
+tape_skip_padding (int in_file_des, off_t offset)
{
int pad;
@@ -911,7 +911,7 @@
printf ("%3u, %3u ", file_hdr->c_rdev_maj,
file_hdr->c_rdev_min);
else
- printf ("%8lu ", file_hdr->c_filesize);
+ printf ("%8llu ", file_hdr->c_filesize);
printf ("%s ", tbuf + 4);
@@ -1153,7 +1153,7 @@
tape_buffered_read (ascii_header, in_des, 70L);
ascii_header[70] = '\0';
sscanf (ascii_header,
- "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
+ "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11llo",
&dev, &file_hdr->c_ino,
&file_hdr->c_mode, &file_hdr->c_uid, &file_hdr->c_gid,
&file_hdr->c_nlink, &rdev, &file_hdr->c_mtime,
@@ -1211,7 +1211,7 @@
tape_buffered_read (ascii_header, in_des, 104L);
ascii_header[104] = '\0';
sscanf (ascii_header,
- "%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
+ "%8lx%8lx%8lx%8lx%8lx%8lx%8llx%8lx%8lx%8lx%8lx%8lx%8lx",
&file_hdr->c_ino, &file_hdr->c_mode, &file_hdr->c_uid,
&file_hdr->c_gid, &file_hdr->c_nlink, &file_hdr->c_mtime,
&file_hdr->c_filesize, &file_hdr->c_dev_maj, &file_hdr->c_dev_min,
--- cpio-2.6/src/extern.h.lfs 2004-09-08 12:49:57.000000000 +0200
+++ cpio-2.6/src/extern.h 2006-03-25 13:34:10.000000000 +0100
@@ -161,14 +161,14 @@
void tape_empty_output_buffer P_((int out_des));
void disk_empty_output_buffer P_((int out_des));
void swahw_array P_((char *ptr, int count));
-void tape_buffered_write P_((char *in_buf, int out_des, long num_bytes));
-void tape_buffered_read P_((char *in_buf, int in_des, long num_bytes));
+void tape_buffered_write P_((char *in_buf, int out_des, off_t num_bytes));
+void tape_buffered_read P_((char *in_buf, int in_des, off_t num_bytes));
int tape_buffered_peek P_((char *peek_buf, int in_des, int num_bytes));
-void tape_toss_input P_((int in_des, long num_bytes));
-void copy_files_tape_to_disk P_((int in_des, int out_des, long num_bytes));
-void copy_files_disk_to_tape P_((int in_des, int out_des, long num_bytes, char *filename));
-void copy_files_disk_to_disk P_((int in_des, int out_des, long num_bytes, char *filename));
-void warn_if_file_changed P_((char *file_name, unsigned long old_file_size,
+void tape_toss_input P_((int in_des, off_t num_bytes));
+void copy_files_tape_to_disk P_((int in_des, int out_des, off_t num_bytes));
+void copy_files_disk_to_tape P_((int in_des, int out_des, off_t num_bytes, char *filename));
+void copy_files_disk_to_disk P_((int in_des, int out_des, off_t num_bytes, char *filename));
+void warn_if_file_changed P_((char *file_name, off_t old_file_size,
unsigned long old_file_mtime));
void create_all_directories P_((char *name));
void prepare_append P_((int out_file_des));
--- cpio-2.6/src/cpiohdr.h.lfs 2003-11-21 15:48:13.000000000 +0100
+++ cpio-2.6/src/cpiohdr.h 2006-03-25 13:34:10.000000000 +0100
@@ -34,8 +34,8 @@
unsigned short c_mtimes[2];
unsigned short c_namesize;
unsigned short c_filesizes[2];
- unsigned long c_mtime; /* Long-aligned copy of `c_mtimes'. */
- unsigned long c_filesize; /* Long-aligned copy of `c_filesizes'. */
+ unsigned int c_mtime; /* aligned copy of `c_mtimes'. */
+ unsigned int c_filesize; /* aligned copy of `c_filesizes'. */
char *c_name;
};
@@ -76,7 +76,7 @@
unsigned long c_gid;
unsigned long c_nlink;
unsigned long c_mtime;
- unsigned long c_filesize;
+ off_t c_filesize;
long c_dev_maj;
long c_dev_min;
long c_rdev_maj;