mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
extfs: refactoring: rename some structure members...
to unify it with standard VFS structures. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
e86ba483c6
commit
81945d32ce
@ -83,7 +83,7 @@ struct inode
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
struct archive *archive; /* And this is an archive structure */
|
struct archive *archive; /* And this is an archive structure */
|
||||||
char *linkname;
|
char *linkname;
|
||||||
char *local_filename;
|
char *localname;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct entry
|
struct entry
|
||||||
@ -91,14 +91,14 @@ struct entry
|
|||||||
struct entry *next_in_dir;
|
struct entry *next_in_dir;
|
||||||
struct entry *dir;
|
struct entry *dir;
|
||||||
char *name;
|
char *name;
|
||||||
struct inode *inode;
|
struct inode *ino;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pseudofile
|
struct pseudofile
|
||||||
{
|
{
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
gboolean has_changed;
|
gboolean changed;
|
||||||
int local_handle;
|
int handle;
|
||||||
struct entry *entry;
|
struct entry *entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ struct archive
|
|||||||
struct stat local_stat;
|
struct stat local_stat;
|
||||||
dev_t rdev;
|
dev_t rdev;
|
||||||
int fd_usage;
|
int fd_usage;
|
||||||
ino_t inode_counter;
|
ino_t ino_usage;
|
||||||
struct entry *root_entry;
|
struct entry *root_entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -179,13 +179,13 @@ extfs_make_dots (struct entry *ent)
|
|||||||
{
|
{
|
||||||
struct entry *entry = g_new (struct entry, 1);
|
struct entry *entry = g_new (struct entry, 1);
|
||||||
struct entry *parentry = ent->dir;
|
struct entry *parentry = ent->dir;
|
||||||
struct inode *inode = ent->inode, *parent;
|
struct inode *inode = ent->ino, *parent;
|
||||||
|
|
||||||
parent = (parentry != NULL) ? parentry->inode : NULL;
|
parent = (parentry != NULL) ? parentry->ino : NULL;
|
||||||
entry->name = g_strdup (".");
|
entry->name = g_strdup (".");
|
||||||
entry->inode = inode;
|
entry->ino = inode;
|
||||||
entry->dir = ent;
|
entry->dir = ent;
|
||||||
inode->local_filename = NULL;
|
inode->localname = NULL;
|
||||||
inode->first_in_subdir = entry;
|
inode->first_in_subdir = entry;
|
||||||
inode->st.st_nlink++;
|
inode->st.st_nlink++;
|
||||||
|
|
||||||
@ -196,13 +196,13 @@ extfs_make_dots (struct entry *ent)
|
|||||||
entry->next_in_dir = NULL;
|
entry->next_in_dir = NULL;
|
||||||
if (parent != NULL)
|
if (parent != NULL)
|
||||||
{
|
{
|
||||||
entry->inode = parent;
|
entry->ino = parent;
|
||||||
entry->dir = parentry;
|
entry->dir = parentry;
|
||||||
parent->st.st_nlink++;
|
parent->st.st_nlink++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entry->inode = inode;
|
entry->ino = inode;
|
||||||
entry->dir = ent;
|
entry->dir = ent;
|
||||||
inode->st.st_nlink++;
|
inode->st.st_nlink++;
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ extfs_generate_entry (struct archive *archive,
|
|||||||
struct inode *inode, *parent;
|
struct inode *inode, *parent;
|
||||||
struct entry *entry;
|
struct entry *entry;
|
||||||
|
|
||||||
parent = (parentry != NULL) ? parentry->inode : NULL;
|
parent = (parentry != NULL) ? parentry->ino : NULL;
|
||||||
entry = g_new (struct entry, 1);
|
entry = g_new (struct entry, 1);
|
||||||
|
|
||||||
entry->name = g_strdup (name);
|
entry->name = g_strdup (name);
|
||||||
@ -230,11 +230,11 @@ extfs_generate_entry (struct archive *archive,
|
|||||||
parent->last_in_subdir = entry;
|
parent->last_in_subdir = entry;
|
||||||
}
|
}
|
||||||
inode = g_new (struct inode, 1);
|
inode = g_new (struct inode, 1);
|
||||||
entry->inode = inode;
|
entry->ino = inode;
|
||||||
inode->local_filename = NULL;
|
inode->localname = NULL;
|
||||||
inode->linkname = NULL;
|
inode->linkname = NULL;
|
||||||
inode->last_in_subdir = NULL;
|
inode->last_in_subdir = NULL;
|
||||||
inode->st.st_ino = archive->inode_counter++;
|
inode->st.st_ino = archive->ino_usage++;
|
||||||
inode->st.st_dev = archive->rdev;
|
inode->st.st_dev = archive->rdev;
|
||||||
inode->archive = archive;
|
inode->archive = archive;
|
||||||
myumask = umask (022);
|
myumask = umask (022);
|
||||||
@ -269,7 +269,7 @@ extfs_find_entry_int (struct entry *dir, const char *name, GSList * list,
|
|||||||
{
|
{
|
||||||
/* Handle absolute paths */
|
/* Handle absolute paths */
|
||||||
name = g_path_skip_root (name);
|
name = g_path_skip_root (name);
|
||||||
dir = dir->inode->archive->root_entry;
|
dir = dir->ino->archive->root_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
pent = dir;
|
pent = dir;
|
||||||
@ -297,7 +297,7 @@ extfs_find_entry_int (struct entry *dir, const char *name, GSList * list,
|
|||||||
*q = c;
|
*q = c;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!S_ISDIR (pent->inode->st.st_mode))
|
if (!S_ISDIR (pent->ino->st.st_mode))
|
||||||
{
|
{
|
||||||
*q = c;
|
*q = c;
|
||||||
notadir = TRUE;
|
notadir = TRUE;
|
||||||
@ -305,7 +305,7 @@ extfs_find_entry_int (struct entry *dir, const char *name, GSList * list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pdir = pent;
|
pdir = pent;
|
||||||
for (pent = pent->inode->first_in_subdir; pent != NULL; pent = pent->next_in_dir)
|
for (pent = pent->ino->first_in_subdir; pent != NULL; pent = pent->next_in_dir)
|
||||||
/* Hack: I keep the original semanthic unless
|
/* Hack: I keep the original semanthic unless
|
||||||
q+1 would break in the strchr */
|
q+1 would break in the strchr */
|
||||||
if (strcmp (pent->name, p) == 0)
|
if (strcmp (pent->name, p) == 0)
|
||||||
@ -313,7 +313,7 @@ extfs_find_entry_int (struct entry *dir, const char *name, GSList * list,
|
|||||||
if (q + 1 > name_end)
|
if (q + 1 > name_end)
|
||||||
{
|
{
|
||||||
*q = c;
|
*q = c;
|
||||||
notadir = !S_ISDIR (pent->inode->st.st_mode);
|
notadir = !S_ISDIR (pent->ino->st.st_mode);
|
||||||
return pent;
|
return pent;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -323,9 +323,9 @@ extfs_find_entry_int (struct entry *dir, const char *name, GSList * list,
|
|||||||
* non-existent directories
|
* non-existent directories
|
||||||
*/
|
*/
|
||||||
if (pent == NULL && make_dirs)
|
if (pent == NULL && make_dirs)
|
||||||
pent = extfs_generate_entry (dir->inode->archive, p, pdir, S_IFDIR | 0777);
|
pent = extfs_generate_entry (dir->ino->archive, p, pdir, S_IFDIR | 0777);
|
||||||
if (pent == NULL && make_file)
|
if (pent == NULL && make_file)
|
||||||
pent = extfs_generate_entry (dir->inode->archive, p, pdir, S_IFREG | 0666);
|
pent = extfs_generate_entry (dir->ino->archive, p, pdir, S_IFREG | 0666);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Next iteration */
|
/* Next iteration */
|
||||||
@ -466,7 +466,7 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc)
|
|||||||
mc_stat (local_name_vpath, ¤t_archive->local_stat);
|
mc_stat (local_name_vpath, ¤t_archive->local_stat);
|
||||||
vfs_path_free (local_name_vpath);
|
vfs_path_free (local_name_vpath);
|
||||||
}
|
}
|
||||||
current_archive->inode_counter = 0;
|
current_archive->ino_usage = 0;
|
||||||
current_archive->fd_usage = 0;
|
current_archive->fd_usage = 0;
|
||||||
current_archive->rdev = archive_counter++;
|
current_archive->rdev = archive_counter++;
|
||||||
first_archive = g_slist_prepend (first_archive, current_archive);
|
first_archive = g_slist_prepend (first_archive, current_archive);
|
||||||
@ -479,11 +479,11 @@ extfs_open_archive (int fstype, const char *name, struct archive **pparc)
|
|||||||
mode |= 0001;
|
mode |= 0001;
|
||||||
mode |= S_IFDIR;
|
mode |= S_IFDIR;
|
||||||
root_entry = extfs_generate_entry (current_archive, PATH_SEP_STR, NULL, mode);
|
root_entry = extfs_generate_entry (current_archive, PATH_SEP_STR, NULL, mode);
|
||||||
root_entry->inode->st.st_uid = mystat.st_uid;
|
root_entry->ino->st.st_uid = mystat.st_uid;
|
||||||
root_entry->inode->st.st_gid = mystat.st_gid;
|
root_entry->ino->st.st_gid = mystat.st_gid;
|
||||||
root_entry->inode->st.st_atime = mystat.st_atime;
|
root_entry->ino->st.st_atime = mystat.st_atime;
|
||||||
root_entry->inode->st.st_ctime = mystat.st_ctime;
|
root_entry->ino->st.st_ctime = mystat.st_ctime;
|
||||||
root_entry->inode->st.st_mtime = mystat.st_mtime;
|
root_entry->ino->st.st_mtime = mystat.st_mtime;
|
||||||
current_archive->root_entry = root_entry;
|
current_archive->root_entry = root_entry;
|
||||||
|
|
||||||
*pparc = current_archive;
|
*pparc = current_archive;
|
||||||
@ -563,10 +563,10 @@ extfs_read_archive (int fstype, const char *name, struct archive **pparc)
|
|||||||
entry->name = g_strdup (p);
|
entry->name = g_strdup (p);
|
||||||
entry->next_in_dir = NULL;
|
entry->next_in_dir = NULL;
|
||||||
entry->dir = pent;
|
entry->dir = pent;
|
||||||
if (pent->inode->last_in_subdir)
|
if (pent->ino->last_in_subdir)
|
||||||
{
|
{
|
||||||
pent->inode->last_in_subdir->next_in_dir = entry;
|
pent->ino->last_in_subdir->next_in_dir = entry;
|
||||||
pent->inode->last_in_subdir = entry;
|
pent->ino->last_in_subdir = entry;
|
||||||
}
|
}
|
||||||
if (!S_ISLNK (hstat.st_mode) && (current_link_name != NULL))
|
if (!S_ISLNK (hstat.st_mode) && (current_link_name != NULL))
|
||||||
{
|
{
|
||||||
@ -581,15 +581,15 @@ extfs_read_archive (int fstype, const char *name, struct archive **pparc)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->inode = pent->inode;
|
entry->ino = pent->ino;
|
||||||
pent->inode->st.st_nlink++;
|
pent->ino->st.st_nlink++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inode = g_new (struct inode, 1);
|
inode = g_new (struct inode, 1);
|
||||||
entry->inode = inode;
|
entry->ino = inode;
|
||||||
inode->local_filename = NULL;
|
inode->localname = NULL;
|
||||||
inode->st.st_ino = current_archive->inode_counter++;
|
inode->st.st_ino = current_archive->ino_usage++;
|
||||||
inode->st.st_nlink = 1;
|
inode->st.st_nlink = 1;
|
||||||
inode->st.st_dev = current_archive->rdev;
|
inode->st.st_dev = current_archive->rdev;
|
||||||
inode->archive = current_archive;
|
inode->archive = current_archive;
|
||||||
@ -755,7 +755,7 @@ extfs_resolve_symlinks_int (struct entry *entry, GSList * list)
|
|||||||
{
|
{
|
||||||
struct entry *pent = NULL;
|
struct entry *pent = NULL;
|
||||||
|
|
||||||
if (!S_ISLNK (entry->inode->st.st_mode))
|
if (!S_ISLNK (entry->ino->st.st_mode))
|
||||||
return entry;
|
return entry;
|
||||||
|
|
||||||
if (g_slist_find (list, entry) != NULL)
|
if (g_slist_find (list, entry) != NULL)
|
||||||
@ -768,7 +768,7 @@ extfs_resolve_symlinks_int (struct entry *entry, GSList * list)
|
|||||||
GSList *looping;
|
GSList *looping;
|
||||||
|
|
||||||
looping = g_slist_prepend (list, entry);
|
looping = g_slist_prepend (list, entry);
|
||||||
pent = extfs_find_entry_int (entry->dir, entry->inode->linkname, looping, FALSE, FALSE);
|
pent = extfs_find_entry_int (entry->dir, entry->ino->linkname, looping, FALSE, FALSE);
|
||||||
looping = g_slist_delete_link (looping, looping);
|
looping = g_slist_delete_link (looping, looping);
|
||||||
|
|
||||||
if (pent == NULL)
|
if (pent == NULL)
|
||||||
@ -921,10 +921,10 @@ extfs_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (S_ISDIR (entry->inode->st.st_mode))
|
if (S_ISDIR (entry->ino->st.st_mode))
|
||||||
ERRNOR (EISDIR, NULL);
|
ERRNOR (EISDIR, NULL);
|
||||||
|
|
||||||
if (entry->inode->local_filename == NULL)
|
if (entry->ino->localname == NULL)
|
||||||
{
|
{
|
||||||
vfs_path_t *local_filename_vpath;
|
vfs_path_t *local_filename_vpath;
|
||||||
const char *local_filename;
|
const char *local_filename;
|
||||||
@ -944,17 +944,17 @@ extfs_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||||||
my_errno = EIO;
|
my_errno = EIO;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
entry->inode->local_filename = g_strdup (local_filename);
|
entry->ino->localname = g_strdup (local_filename);
|
||||||
vfs_path_free (local_filename_vpath);
|
vfs_path_free (local_filename_vpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
local_handle = open (entry->inode->local_filename, NO_LINEAR (flags), mode);
|
local_handle = open (entry->ino->localname, NO_LINEAR (flags), mode);
|
||||||
|
|
||||||
if (local_handle == -1)
|
if (local_handle == -1)
|
||||||
{
|
{
|
||||||
/* file exists(may be). Need to drop O_CREAT flag and truncate file content */
|
/* file exists(may be). Need to drop O_CREAT flag and truncate file content */
|
||||||
flags = ~O_CREAT & (NO_LINEAR (flags) | O_TRUNC);
|
flags = ~O_CREAT & (NO_LINEAR (flags) | O_TRUNC);
|
||||||
local_handle = open (entry->inode->local_filename, flags, mode);
|
local_handle = open (entry->ino->localname, flags, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_handle == -1)
|
if (local_handle == -1)
|
||||||
@ -963,8 +963,8 @@ extfs_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||||||
extfs_info = g_new (struct pseudofile, 1);
|
extfs_info = g_new (struct pseudofile, 1);
|
||||||
extfs_info->archive = archive;
|
extfs_info->archive = archive;
|
||||||
extfs_info->entry = entry;
|
extfs_info->entry = entry;
|
||||||
extfs_info->has_changed = created;
|
extfs_info->changed = created;
|
||||||
extfs_info->local_handle = local_handle;
|
extfs_info->handle = local_handle;
|
||||||
|
|
||||||
/* i.e. we had no open files and now we have one */
|
/* i.e. we had no open files and now we have one */
|
||||||
vfs_rmstamp (vfs_extfs_ops, (vfsid) archive);
|
vfs_rmstamp (vfs_extfs_ops, (vfsid) archive);
|
||||||
@ -979,7 +979,7 @@ extfs_read (void *data, char *buffer, size_t count)
|
|||||||
{
|
{
|
||||||
struct pseudofile *file = (struct pseudofile *) data;
|
struct pseudofile *file = (struct pseudofile *) data;
|
||||||
|
|
||||||
return read (file->local_handle, buffer, count);
|
return read (file->handle, buffer, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -991,22 +991,22 @@ extfs_close (void *data)
|
|||||||
int errno_code = 0;
|
int errno_code = 0;
|
||||||
file = (struct pseudofile *) data;
|
file = (struct pseudofile *) data;
|
||||||
|
|
||||||
close (file->local_handle);
|
close (file->handle);
|
||||||
|
|
||||||
/* Commit the file if it has changed */
|
/* Commit the file if it has changed */
|
||||||
if (file->has_changed)
|
if (file->changed)
|
||||||
{
|
{
|
||||||
struct stat file_status;
|
struct stat file_status;
|
||||||
|
|
||||||
if (extfs_cmd (" copyin ", file->archive, file->entry, file->entry->inode->local_filename))
|
if (extfs_cmd (" copyin ", file->archive, file->entry, file->entry->ino->localname))
|
||||||
errno_code = EIO;
|
errno_code = EIO;
|
||||||
|
|
||||||
if (stat (file->entry->inode->local_filename, &file_status) != 0)
|
if (stat (file->entry->ino->localname, &file_status) != 0)
|
||||||
errno_code = EIO;
|
errno_code = EIO;
|
||||||
else
|
else
|
||||||
file->entry->inode->st.st_size = file_status.st_size;
|
file->entry->ino->st.st_size = file_status.st_size;
|
||||||
|
|
||||||
file->entry->inode->st.st_mtime = time (NULL);
|
file->entry->ino->st.st_mtime = time (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--file->archive->fd_usage == 0)
|
if (--file->archive->fd_usage == 0)
|
||||||
@ -1047,12 +1047,12 @@ extfs_opendir (const vfs_path_t * vpath)
|
|||||||
entry = extfs_resolve_symlinks (entry);
|
entry = extfs_resolve_symlinks (entry);
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!S_ISDIR (entry->inode->st.st_mode))
|
if (!S_ISDIR (entry->ino->st.st_mode))
|
||||||
ERRNOR (ENOTDIR, NULL);
|
ERRNOR (ENOTDIR, NULL);
|
||||||
|
|
||||||
info = g_new (struct entry *, 2);
|
info = g_new (struct entry *, 2);
|
||||||
info[0] = entry->inode->first_in_subdir;
|
info[0] = entry->ino->first_in_subdir;
|
||||||
info[1] = entry->inode->first_in_subdir;
|
info[1] = entry->ino->first_in_subdir;
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -1122,7 +1122,7 @@ extfs_internal_stat (const vfs_path_t * vpath, struct stat *buf, gboolean resolv
|
|||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
extfs_stat_move (buf, entry->inode);
|
extfs_stat_move (buf, entry->ino);
|
||||||
result = 0;
|
result = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
return result;
|
return result;
|
||||||
@ -1151,7 +1151,7 @@ extfs_fstat (void *data, struct stat *buf)
|
|||||||
{
|
{
|
||||||
struct pseudofile *file = (struct pseudofile *) data;
|
struct pseudofile *file = (struct pseudofile *) data;
|
||||||
|
|
||||||
extfs_stat_move (buf, file->entry->inode);
|
extfs_stat_move (buf, file->entry->ino);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1172,7 +1172,7 @@ extfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
|||||||
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!S_ISLNK (entry->inode->st.st_mode))
|
if (!S_ISLNK (entry->ino->st.st_mode))
|
||||||
{
|
{
|
||||||
const vfs_path_element_t *path_element;
|
const vfs_path_element_t *path_element;
|
||||||
|
|
||||||
@ -1180,12 +1180,12 @@ extfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
|||||||
path_element->class->verrno = EINVAL;
|
path_element->class->verrno = EINVAL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
len = strlen (entry->inode->linkname);
|
len = strlen (entry->ino->linkname);
|
||||||
if (size < len)
|
if (size < len)
|
||||||
len = size;
|
len = size;
|
||||||
/* readlink() does not append a NUL character to buf */
|
/* readlink() does not append a NUL character to buf */
|
||||||
result = len;
|
result = len;
|
||||||
memcpy (buf, entry->inode->linkname, result);
|
memcpy (buf, entry->ino->linkname, result);
|
||||||
cleanup:
|
cleanup:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1218,8 +1218,8 @@ extfs_write (void *data, const char *buf, size_t nbyte)
|
|||||||
{
|
{
|
||||||
struct pseudofile *file = (struct pseudofile *) data;
|
struct pseudofile *file = (struct pseudofile *) data;
|
||||||
|
|
||||||
file->has_changed = TRUE;
|
file->changed = TRUE;
|
||||||
return write (file->local_handle, buf, nbyte);
|
return write (file->handle, buf, nbyte);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -1241,7 +1241,7 @@ extfs_unlink (const vfs_path_t * vpath)
|
|||||||
entry = extfs_resolve_symlinks (entry);
|
entry = extfs_resolve_symlinks (entry);
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (S_ISDIR (entry->inode->st.st_mode))
|
if (S_ISDIR (entry->ino->st.st_mode))
|
||||||
{
|
{
|
||||||
const vfs_path_element_t *path_element;
|
const vfs_path_element_t *path_element;
|
||||||
|
|
||||||
@ -1289,7 +1289,7 @@ extfs_mkdir (const vfs_path_t * vpath, mode_t mode)
|
|||||||
entry = extfs_resolve_symlinks (entry);
|
entry = extfs_resolve_symlinks (entry);
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!S_ISDIR (entry->inode->st.st_mode))
|
if (!S_ISDIR (entry->ino->st.st_mode))
|
||||||
{
|
{
|
||||||
path_element->class->verrno = ENOTDIR;
|
path_element->class->verrno = ENOTDIR;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1325,7 +1325,7 @@ extfs_rmdir (const vfs_path_t * vpath)
|
|||||||
entry = extfs_resolve_symlinks (entry);
|
entry = extfs_resolve_symlinks (entry);
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!S_ISDIR (entry->inode->st.st_mode))
|
if (!S_ISDIR (entry->ino->st.st_mode))
|
||||||
{
|
{
|
||||||
const vfs_path_element_t *path_element;
|
const vfs_path_element_t *path_element;
|
||||||
|
|
||||||
@ -1363,7 +1363,7 @@ extfs_chdir (const vfs_path_t * vpath)
|
|||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
entry = extfs_resolve_symlinks (entry);
|
entry = extfs_resolve_symlinks (entry);
|
||||||
if ((entry == NULL) || (!S_ISDIR (entry->inode->st.st_mode)))
|
if ((entry == NULL) || (!S_ISDIR (entry->ino->st.st_mode)))
|
||||||
return -1;
|
return -1;
|
||||||
my_errno = 0;
|
my_errno = 0;
|
||||||
return 0;
|
return 0;
|
||||||
@ -1376,7 +1376,7 @@ extfs_lseek (void *data, off_t offset, int whence)
|
|||||||
{
|
{
|
||||||
struct pseudofile *file = (struct pseudofile *) data;
|
struct pseudofile *file = (struct pseudofile *) data;
|
||||||
|
|
||||||
return lseek (file->local_handle, offset, whence);
|
return lseek (file->handle, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -1407,21 +1407,21 @@ extfs_nothingisopen (vfsid id)
|
|||||||
static void
|
static void
|
||||||
extfs_remove_entry (struct entry *e)
|
extfs_remove_entry (struct entry *e)
|
||||||
{
|
{
|
||||||
int i = --e->inode->st.st_nlink;
|
int i = --e->ino->st.st_nlink;
|
||||||
struct entry *pe, *ent, *prev;
|
struct entry *pe, *ent, *prev;
|
||||||
|
|
||||||
if (S_ISDIR (e->inode->st.st_mode) && e->inode->first_in_subdir != NULL)
|
if (S_ISDIR (e->ino->st.st_mode) && e->ino->first_in_subdir != NULL)
|
||||||
{
|
{
|
||||||
struct entry *f = e->inode->first_in_subdir;
|
struct entry *f = e->ino->first_in_subdir;
|
||||||
e->inode->first_in_subdir = NULL;
|
e->ino->first_in_subdir = NULL;
|
||||||
extfs_remove_entry (f);
|
extfs_remove_entry (f);
|
||||||
}
|
}
|
||||||
pe = e->dir;
|
pe = e->dir;
|
||||||
if (e == pe->inode->first_in_subdir)
|
if (e == pe->ino->first_in_subdir)
|
||||||
pe->inode->first_in_subdir = e->next_in_dir;
|
pe->ino->first_in_subdir = e->next_in_dir;
|
||||||
|
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
for (ent = pe->inode->first_in_subdir; ent && ent->next_in_dir; ent = ent->next_in_dir)
|
for (ent = pe->ino->first_in_subdir; ent && ent->next_in_dir; ent = ent->next_in_dir)
|
||||||
if (e == ent->next_in_dir)
|
if (e == ent->next_in_dir)
|
||||||
{
|
{
|
||||||
prev = ent;
|
prev = ent;
|
||||||
@ -1429,18 +1429,18 @@ extfs_remove_entry (struct entry *e)
|
|||||||
}
|
}
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next_in_dir = e->next_in_dir;
|
prev->next_in_dir = e->next_in_dir;
|
||||||
if (e == pe->inode->last_in_subdir)
|
if (e == pe->ino->last_in_subdir)
|
||||||
pe->inode->last_in_subdir = prev;
|
pe->ino->last_in_subdir = prev;
|
||||||
|
|
||||||
if (i <= 0)
|
if (i <= 0)
|
||||||
{
|
{
|
||||||
if (e->inode->local_filename != NULL)
|
if (e->ino->localname != NULL)
|
||||||
{
|
{
|
||||||
unlink (e->inode->local_filename);
|
unlink (e->ino->localname);
|
||||||
g_free (e->inode->local_filename);
|
g_free (e->ino->localname);
|
||||||
}
|
}
|
||||||
g_free (e->inode->linkname);
|
g_free (e->ino->linkname);
|
||||||
g_free (e->inode);
|
g_free (e->ino);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (e->name);
|
g_free (e->name);
|
||||||
@ -1452,24 +1452,24 @@ extfs_remove_entry (struct entry *e)
|
|||||||
static void
|
static void
|
||||||
extfs_free_entry (struct entry *e)
|
extfs_free_entry (struct entry *e)
|
||||||
{
|
{
|
||||||
int i = --e->inode->st.st_nlink;
|
int i = --e->ino->st.st_nlink;
|
||||||
|
|
||||||
if (S_ISDIR (e->inode->st.st_mode) && e->inode->first_in_subdir != NULL)
|
if (S_ISDIR (e->ino->st.st_mode) && e->ino->first_in_subdir != NULL)
|
||||||
{
|
{
|
||||||
struct entry *f = e->inode->first_in_subdir;
|
struct entry *f = e->ino->first_in_subdir;
|
||||||
|
|
||||||
e->inode->first_in_subdir = NULL;
|
e->ino->first_in_subdir = NULL;
|
||||||
extfs_free_entry (f);
|
extfs_free_entry (f);
|
||||||
}
|
}
|
||||||
if (i <= 0)
|
if (i <= 0)
|
||||||
{
|
{
|
||||||
if (e->inode->local_filename != NULL)
|
if (e->ino->localname != NULL)
|
||||||
{
|
{
|
||||||
unlink (e->inode->local_filename);
|
unlink (e->ino->localname);
|
||||||
g_free (e->inode->local_filename);
|
g_free (e->ino->localname);
|
||||||
}
|
}
|
||||||
g_free (e->inode->linkname);
|
g_free (e->ino->linkname);
|
||||||
g_free (e->inode);
|
g_free (e->ino);
|
||||||
}
|
}
|
||||||
if (e->next_in_dir != NULL)
|
if (e->next_in_dir != NULL)
|
||||||
extfs_free_entry (e->next_in_dir);
|
extfs_free_entry (e->next_in_dir);
|
||||||
@ -1499,12 +1499,12 @@ extfs_getlocalcopy (const vfs_path_t * vpath)
|
|||||||
fp = (struct pseudofile *) extfs_open (vpath, O_RDONLY, 0);
|
fp = (struct pseudofile *) extfs_open (vpath, O_RDONLY, 0);
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (fp->entry->inode->local_filename == NULL)
|
if (fp->entry->ino->localname == NULL)
|
||||||
{
|
{
|
||||||
extfs_close ((void *) fp);
|
extfs_close ((void *) fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
p = vfs_path_from_str (fp->entry->inode->local_filename);
|
p = vfs_path_from_str (fp->entry->ino->localname);
|
||||||
fp->archive->fd_usage++;
|
fp->archive->fd_usage++;
|
||||||
extfs_close ((void *) fp);
|
extfs_close ((void *) fp);
|
||||||
return p;
|
return p;
|
||||||
@ -1521,11 +1521,11 @@ extfs_ungetlocalcopy (const vfs_path_t * vpath, const vfs_path_t * local, gboole
|
|||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (strcmp (fp->entry->inode->local_filename, vfs_path_get_last_path_str (local)) == 0)
|
if (strcmp (fp->entry->ino->localname, vfs_path_get_last_path_str (local)) == 0)
|
||||||
{
|
{
|
||||||
fp->archive->fd_usage--;
|
fp->archive->fd_usage--;
|
||||||
if (has_changed)
|
if (has_changed)
|
||||||
fp->has_changed = TRUE;
|
fp->changed = TRUE;
|
||||||
extfs_close ((void *) fp);
|
extfs_close ((void *) fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user