Re: extfs: make the open_archive stat() optional
- From: Standa Opichal <opichals seznam cz>
- To: Pavel Roskin <proski gnu org>
- Cc: mc-devel gnome org
- Subject: Re: extfs: make the open_archive stat() optional
- Date: Mon, 9 Dec 2002 11:04:31 +0100 (CET)
Hi there!
On Fri, 6 Dec 2002, Pavel Roskin wrote:
> The right solution would be to avoid mc_stat() in the "archiveless"
> filesystems.
Here is the patch. It checks the archive existence only when the extfs.ini
says that it should need it. But it sends the archive filename to the
script regardless to the 'archive need' setting.
BTW: I'm getting tired with the discussion and repeated patches I'm
sending.... You know what to do and don't want to do it yourself. It is a
matter of few line changes, but I really don't know what do you want.
I would better give it up and make my own mc that trying to get these
little change to the CVS code. My mtools are working here. You can always
add the needed checks to the patch I sent. It would be educative instead
of frustrating experience then.
Please, let me know if you are interested in the mtools extfs that makes
use of the archive name as a drive letter.
regards
STan
Index: extfs.c
===================================================================
RCS file: /cvs/gnome/mc/vfs/extfs.c,v
retrieving revision 1.64
diff -u -r1.64 extfs.c
--- extfs.c 8 Dec 2002 01:12:28 -0000 1.64
+++ extfs.c 9 Dec 2002 09:58:23 -0000
@@ -209,19 +209,29 @@
struct stat mystat;
struct archive *current_archive;
struct entry *root_entry;
- char *local_name = NULL, *tmp = 0;
- int uses_archive = extfs_need_archive[fstype];
+ char *local_name = NULL, *tmp = NULL;
- if (uses_archive) {
- if (mc_stat (name, &mystat) == -1)
+ /* if the archive is needed then check for its existance */
+ if (extfs_need_archive[fstype] && mc_stat (name, &mystat) == -1)
+ return NULL;
+ else
+ /* clear the mystat structure
+ * the later usage should be checked
+ * by testing the st_nlinks != 0
+ */
+ memset(&mystat, 0, sizeof(struct stat));
+
+ /* Send the archive name even when there is no
+ * need for it according to the extfs.ini configuration.
+ * This allows the archiveless scripts e.g. mtools to
+ * make use of the archive name
+ */
+ if (!vfs_file_is_local (name)) {
+ local_name = mc_getlocalcopy (name);
+ if (local_name == NULL)
return NULL;
- if (!vfs_file_is_local (name)) {
- local_name = mc_getlocalcopy (name);
- if (local_name == NULL)
- return NULL;
- }
- tmp = name_quote (name, 0);
}
+ tmp = name_quote (name, 0);
mc_extfsdir = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR);
cmd =
@@ -261,11 +271,16 @@
mode |= 0001;
mode |= S_IFDIR;
root_entry = generate_entry (current_archive, "/", NULL, mode);
- root_entry->inode->uid = mystat.st_uid;
- root_entry->inode->gid = mystat.st_gid;
- root_entry->inode->atime = mystat.st_atime;
- root_entry->inode->ctime = mystat.st_ctime;
- root_entry->inode->mtime = mystat.st_mtime;
+ if ( mystat.st_nlinks != 0 ) {
+ // ok the stat() was successful so get the archive properties
+ // else the root_entry contains the default values got from
+ // the generate_entry
+ root_entry->inode->uid = mystat.st_uid;
+ root_entry->inode->gid = mystat.st_gid;
+ root_entry->inode->atime = mystat.st_atime;
+ root_entry->inode->ctime = mystat.st_ctime;
+ root_entry->inode->mtime = mystat.st_mtime;
+ }
current_archive->root_entry = root_entry;
current_archive->current_dir = root_entry;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]