mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 17:29:28 +03:00
* extfs.h: Remove "extfsstat" from struct archive - it's unused
outside open_archive(). Adjust the dependencies. * extfs.c: Make hstat local variable.
This commit is contained in:
parent
271a2564fd
commit
03b1481cda
@ -1,5 +1,9 @@
|
|||||||
2002-12-05 Pavel Roskin <proski@gnu.org>
|
2002-12-05 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* extfs.h: Remove "extfsstat" from struct archive - it's unused
|
||||||
|
outside open_archive(). Adjust the dependencies.
|
||||||
|
* extfs.c: Make hstat local variable.
|
||||||
|
|
||||||
* sfs.c: Remove "uid" from struct cachedfile - it's unused now.
|
* sfs.c: Remove "uid" from struct cachedfile - it's unused now.
|
||||||
|
|
||||||
* vfs.h: Remove vfs_uid and vfs_gid. Fix all dependencies.
|
* vfs.h: Remove vfs_uid and vfs_gid. Fix all dependencies.
|
||||||
|
45
vfs/extfs.c
45
vfs/extfs.c
@ -85,7 +85,6 @@ static void remove_entry (struct entry *e);
|
|||||||
|
|
||||||
static struct archive *first_archive = NULL;
|
static struct archive *first_archive = NULL;
|
||||||
static int my_errno = 0;
|
static int my_errno = 0;
|
||||||
static struct stat hstat; /* Stat struct corresponding */
|
|
||||||
|
|
||||||
#define MAXEXTFS 32
|
#define MAXEXTFS 32
|
||||||
static char *extfs_prefixes [MAXEXTFS];
|
static char *extfs_prefixes [MAXEXTFS];
|
||||||
@ -199,7 +198,8 @@ static void free_archive (struct archive *archive)
|
|||||||
g_free (archive);
|
g_free (archive);
|
||||||
}
|
}
|
||||||
|
|
||||||
static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
static FILE *
|
||||||
|
open_archive (int fstype, char *name, struct archive **pparc)
|
||||||
{
|
{
|
||||||
static dev_t __extfs_no = 0;
|
static dev_t __extfs_no = 0;
|
||||||
FILE *result;
|
FILE *result;
|
||||||
@ -224,8 +224,9 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
|
mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
|
||||||
cmd = g_strconcat (mc_extfsdir, extfs_prefixes [fstype],
|
cmd =
|
||||||
" list ", local_name ? local_name : tmp, NULL);
|
g_strconcat (mc_extfsdir, extfs_prefixes[fstype], " list ",
|
||||||
|
local_name ? local_name : tmp, NULL);
|
||||||
if (tmp)
|
if (tmp)
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
g_free (mc_extfsdir);
|
g_free (mc_extfsdir);
|
||||||
@ -248,11 +249,10 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
mc_stat (local_name, ¤t_archive->local_stat);
|
mc_stat (local_name, ¤t_archive->local_stat);
|
||||||
current_archive->__inode_counter = 0;
|
current_archive->__inode_counter = 0;
|
||||||
current_archive->fd_usage = 0;
|
current_archive->fd_usage = 0;
|
||||||
current_archive->extfsstat = mystat;
|
|
||||||
current_archive->rdev = __extfs_no++;
|
current_archive->rdev = __extfs_no++;
|
||||||
current_archive->next = first_archive;
|
current_archive->next = first_archive;
|
||||||
first_archive = current_archive;
|
first_archive = current_archive;
|
||||||
mode = current_archive->extfsstat.st_mode & 07777;
|
mode = mystat.st_mode & 07777;
|
||||||
if (mode & 0400)
|
if (mode & 0400)
|
||||||
mode |= 0100;
|
mode |= 0100;
|
||||||
if (mode & 0040)
|
if (mode & 0040)
|
||||||
@ -261,11 +261,11 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
mode |= 0001;
|
mode |= 0001;
|
||||||
mode |= S_IFDIR;
|
mode |= S_IFDIR;
|
||||||
root_entry = generate_entry (current_archive, "/", NULL, mode);
|
root_entry = generate_entry (current_archive, "/", NULL, mode);
|
||||||
root_entry->inode->uid = current_archive->extfsstat.st_uid;
|
root_entry->inode->uid = mystat.st_uid;
|
||||||
root_entry->inode->gid = current_archive->extfsstat.st_gid;
|
root_entry->inode->gid = mystat.st_gid;
|
||||||
root_entry->inode->atime = current_archive->extfsstat.st_atime;
|
root_entry->inode->atime = mystat.st_atime;
|
||||||
root_entry->inode->ctime = current_archive->extfsstat.st_ctime;
|
root_entry->inode->ctime = mystat.st_ctime;
|
||||||
root_entry->inode->mtime = current_archive->extfsstat.st_mtime;
|
root_entry->inode->mtime = mystat.st_mtime;
|
||||||
current_archive->root_entry = root_entry;
|
current_archive->root_entry = root_entry;
|
||||||
current_archive->current_dir = root_entry;
|
current_archive->current_dir = root_entry;
|
||||||
|
|
||||||
@ -278,14 +278,14 @@ static FILE *open_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
* Main loop for reading an archive.
|
* Main loop for reading an archive.
|
||||||
* Returns 0 on success, -1 on error.
|
* Returns 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
static int read_archive (int fstype, char *name, struct archive **pparc)
|
static int
|
||||||
|
read_archive (int fstype, char *name, struct archive **pparc)
|
||||||
{
|
{
|
||||||
FILE *extfsd;
|
FILE *extfsd;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
struct archive *current_archive;
|
struct archive *current_archive;
|
||||||
char *current_file_name, *current_link_name;
|
char *current_file_name, *current_link_name;
|
||||||
|
|
||||||
|
|
||||||
if ((extfsd = open_archive (fstype, name, ¤t_archive)) == NULL) {
|
if ((extfsd = open_archive (fstype, name, ¤t_archive)) == NULL) {
|
||||||
message_3s (1, MSG_ERROR, _("Couldn't open %s archive\n%s"),
|
message_3s (1, MSG_ERROR, _("Couldn't open %s archive\n%s"),
|
||||||
extfs_prefixes[fstype], name);
|
extfs_prefixes[fstype], name);
|
||||||
@ -294,8 +294,11 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
|
|
||||||
buffer = g_malloc (4096);
|
buffer = g_malloc (4096);
|
||||||
while (fgets (buffer, 4096, extfsd) != NULL) {
|
while (fgets (buffer, 4096, extfsd) != NULL) {
|
||||||
|
struct stat hstat;
|
||||||
|
|
||||||
current_link_name = NULL;
|
current_link_name = NULL;
|
||||||
if (vfs_parse_ls_lga (buffer, &hstat, ¤t_file_name, ¤t_link_name)) {
|
if (vfs_parse_ls_lga
|
||||||
|
(buffer, &hstat, ¤t_file_name, ¤t_link_name)) {
|
||||||
struct entry *entry, *pent;
|
struct entry *entry, *pent;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
char *p, *q, *cfn = current_file_name;
|
char *p, *q, *cfn = current_file_name;
|
||||||
@ -314,8 +317,8 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
*(p++) = 0;
|
*(p++) = 0;
|
||||||
q = cfn;
|
q = cfn;
|
||||||
}
|
}
|
||||||
if (S_ISDIR (hstat.st_mode) &&
|
if (S_ISDIR (hstat.st_mode)
|
||||||
(!strcmp (p, ".") || !strcmp (p, "..")))
|
&& (!strcmp (p, ".") || !strcmp (p, "..")))
|
||||||
goto read_extfs_continue;
|
goto read_extfs_continue;
|
||||||
pent = find_entry (current_archive->root_entry, q, 1, 0);
|
pent = find_entry (current_archive->root_entry, q, 1, 0);
|
||||||
if (pent == NULL) {
|
if (pent == NULL) {
|
||||||
@ -336,12 +339,15 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!S_ISLNK (hstat.st_mode) && current_link_name != NULL) {
|
if (!S_ISLNK (hstat.st_mode) && current_link_name != NULL) {
|
||||||
pent = find_entry (current_archive->root_entry, current_link_name, 0, 0);
|
pent =
|
||||||
|
find_entry (current_archive->root_entry,
|
||||||
|
current_link_name, 0, 0);
|
||||||
if (pent == NULL) {
|
if (pent == NULL) {
|
||||||
/* FIXME: Should clean everything one day */
|
/* FIXME: Should clean everything one day */
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
pclose (extfsd);
|
pclose (extfsd);
|
||||||
close_error_pipe (1, _("Inconsistent extfs archive"));
|
close_error_pipe (1,
|
||||||
|
_("Inconsistent extfs archive"));
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
entry->inode = pent->inode;
|
entry->inode = pent->inode;
|
||||||
@ -367,7 +373,8 @@ static int read_archive (int fstype, char *name, struct archive **pparc)
|
|||||||
inode->mtime = hstat.st_mtime;
|
inode->mtime = hstat.st_mtime;
|
||||||
inode->atime = hstat.st_atime;
|
inode->atime = hstat.st_atime;
|
||||||
inode->ctime = hstat.st_ctime;
|
inode->ctime = hstat.st_ctime;
|
||||||
if (current_link_name != NULL && S_ISLNK (hstat.st_mode)) {
|
if (current_link_name != NULL
|
||||||
|
&& S_ISLNK (hstat.st_mode)) {
|
||||||
inode->linkname = current_link_name;
|
inode->linkname = current_link_name;
|
||||||
current_link_name = NULL;
|
current_link_name = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,7 +22,6 @@ struct archive {
|
|||||||
int fstype;
|
int fstype;
|
||||||
char *name;
|
char *name;
|
||||||
char *local_name;
|
char *local_name;
|
||||||
struct stat extfsstat;
|
|
||||||
struct stat local_stat;
|
struct stat local_stat;
|
||||||
dev_t rdev;
|
dev_t rdev;
|
||||||
int fd_usage;
|
int fd_usage;
|
||||||
|
Loading…
Reference in New Issue
Block a user