Copying empty files to extfs
- From: Pavel Roskin <proski gnu org>
- To: <mc-devel gnome org>
- Subject: Copying empty files to extfs
- Date: Tue, 7 Aug 2001 18:48:37 -0400 (EDT)
Hello!
extfs_open() didn't set the `has_changed' flag on the extfs archive.
Only extfs_write() did. That's why empty files could not be copied to
extfs (e.g. into zip archives).
Actually, there were three "flavors" of `has_changed' in three different
structures, but only one of them was used. Two others were present only
to confuse me :-)
I'm applying the following patch.
---------------------------------------
--- ChangeLog
+++ ChangeLog
@@ -1 +1,9 @@
+2001-08-07 Pavel Roskin <proski gnu org>
+
+ * extfs.h (struct entry): Remove unused `has_changed' field.
+ It's only written but never read.
+ (struct inode): Likewise.
+ * extfs.c: All dependencies changed.
+ (extfs_open): Mark file as changed if it's open for writing.
+
2001-08-07 Oskar Liljeblad <osk hem passagen se>
--- extfs.c
+++ extfs.c
@@ -84,7 +84,6 @@ static void make_dot_doubledot (struct e
parent = (parentry != NULL) ? parentry->inode : NULL;
entry->name = g_strdup (".");
- entry->has_changed = 0;
entry->inode = inode;
entry->dir = ent;
inode->local_filename = NULL;
@@ -94,7 +93,6 @@ static void make_dot_doubledot (struct e
entry->next_in_dir = g_new (struct entry, 1);
entry=entry->next_in_dir;
entry->name = g_strdup ("..");
- entry->has_changed = 0;
inode->last_in_subdir = entry;
entry->next_in_dir = NULL;
if (parent != NULL) {
@@ -119,7 +117,6 @@ static struct entry *generate_entry (str
entry = g_new (struct entry, 1);
entry->name = g_strdup (name);
- entry->has_changed = 0;
entry->next_in_dir = NULL;
entry->dir = parentry;
if (parent != NULL) {
@@ -128,7 +125,6 @@ static struct entry *generate_entry (str
}
inode = g_new (struct inode, 1);
entry->inode = inode;
- inode->has_changed = 0;
inode->local_filename = NULL;
inode->linkname = 0;
inode->inode = (archive->__inode_counter)++;
@@ -305,7 +301,6 @@ static int read_archive (int fstype, cha
}
entry = g_new (struct entry, 1);
entry->name = g_strdup (p);
- entry->has_changed = 0;
entry->next_in_dir = NULL;
entry->dir = pent;
if (pent != NULL) {
@@ -330,7 +325,6 @@ static int read_archive (int fstype, cha
inode = g_new (struct inode, 1);
entry->inode = inode;
inode->local_filename = NULL;
- inode->has_changed = 0;
inode->inode = (current_archive->__inode_counter)++;
inode->nlink = 1;
inode->dev = current_archive->rdev;
@@ -637,7 +631,7 @@ static void *extfs_open (vfs *me, char *
extfs_info = g_new (struct pseudofile, 1);
extfs_info->archive = archive;
extfs_info->entry = entry;
- extfs_info->has_changed = 0;
+ extfs_info->has_changed = do_create;
extfs_info->local_handle = local_handle;
/* i.e. we had no open files and now we have one */
@@ -1292,7 +1286,6 @@ static int extfs_ungetlocalcopy (vfs *me
if (fp == NULL)
return 0;
if (!strcmp (fp->entry->inode->local_filename, local)) {
- fp->entry->inode->has_changed = has_changed;
fp->archive->fd_usage--;
extfs_close ((void *) fp);
return 0;
--- extfs.h
+++ extfs.h
@@ -23,7 +23,6 @@
struct inode;
struct entry {
- int has_changed;
struct entry *next_in_dir;
struct entry *dir;
char *name;
@@ -33,7 +32,6 @@
struct archive;
struct inode {
- int has_changed;
nlink_t nlink;
struct entry *first_in_subdir; /* only used if this is a directory */
struct entry *last_in_subdir;
---------------------------------------
--
Regards,
Pavel Roskin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]