* direntry.c: Don't use vfs_local_fs directly, use VFSF_LOCAL.
* extfs.c: Likewise. * vfs.c (vfs_addstamp): Likewise. (vfs_init): Register vfs_local_fs like other classes.
Этот коммит содержится в:
родитель
523589cddc
Коммит
3fb8e46501
@ -1,5 +1,10 @@
|
||||
2003-10-11 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* direntry.c: Don't use vfs_local_fs directly, use VFSF_LOCAL.
|
||||
* extfs.c: Likewise.
|
||||
* vfs.c (vfs_addstamp): Likewise.
|
||||
(vfs_init): Register vfs_local_fs like other classes.
|
||||
|
||||
* direntry.c: Make more functions static. They are filled in in
|
||||
vfs_s_init_class() now and don't need to be exported.
|
||||
|
||||
|
@ -462,7 +462,7 @@ vfs_s_stamp_me (vfs *me, struct vfs_s_super *psup, char *fs_name)
|
||||
vfs *v;
|
||||
|
||||
v = vfs_get_class (fs_name);
|
||||
if (v == &vfs_local_ops){
|
||||
if (v->flags & VFSF_LOCAL){
|
||||
parent = NULL;
|
||||
} else {
|
||||
parent = g_new (struct vfs_stamping, 1);
|
||||
@ -887,7 +887,7 @@ vfs_s_close (void *fh)
|
||||
vfs *v;
|
||||
|
||||
v = vfs_get_class (FH_SUPER->name);
|
||||
if (v == &vfs_local_ops){
|
||||
if (v->flags & VFSF_LOCAL) {
|
||||
parent = NULL;
|
||||
} else {
|
||||
parent = g_new (struct vfs_stamping, 1);
|
||||
|
38
vfs/extfs.c
38
vfs/extfs.c
@ -453,7 +453,7 @@ get_path_mangle (char *inname, struct archive **archive, int is_dir,
|
||||
|
||||
if (archive_name) {
|
||||
v = vfs_get_class (archive_name);
|
||||
if (v == &vfs_local_ops) {
|
||||
if (v->flags & VFSF_LOCAL) {
|
||||
parent = NULL;
|
||||
} else {
|
||||
parent = g_new (struct vfs_stamping, 1);
|
||||
@ -718,22 +718,25 @@ static int extfs_read (void *data, char *buffer, int count)
|
||||
return read (file->local_handle, buffer, count);
|
||||
}
|
||||
|
||||
static int extfs_close (void *data)
|
||||
static int
|
||||
extfs_close (void *data)
|
||||
{
|
||||
struct pseudofile *file;
|
||||
int errno_code = 0;
|
||||
file = (struct pseudofile *)data;
|
||||
|
||||
int errno_code = 0;
|
||||
file = (struct pseudofile *) data;
|
||||
|
||||
close (file->local_handle);
|
||||
|
||||
/* Commit the file if it has changed */
|
||||
if (file->has_changed) {
|
||||
if (extfs_cmd (" copyin ", file->archive, file->entry,
|
||||
file->entry->inode->local_filename))
|
||||
if (extfs_cmd
|
||||
(" copyin ", file->archive, file->entry,
|
||||
file->entry->inode->local_filename))
|
||||
errno_code = EIO;
|
||||
{
|
||||
struct stat file_status;
|
||||
if (stat (file->entry->inode->local_filename, &file_status) != 0)
|
||||
if (stat (file->entry->inode->local_filename, &file_status) !=
|
||||
0)
|
||||
errno_code = EIO;
|
||||
else
|
||||
file->entry->inode->size = file_status.st_size;
|
||||
@ -744,23 +747,28 @@ static int extfs_close (void *data)
|
||||
|
||||
file->archive->fd_usage--;
|
||||
if (!file->archive->fd_usage) {
|
||||
struct vfs_stamping *parent;
|
||||
vfs *v;
|
||||
|
||||
if (!file->archive->name || !*file->archive->name || (v = vfs_get_class (file->archive->name)) == &vfs_local_ops) {
|
||||
struct vfs_stamping *parent;
|
||||
vfs *v;
|
||||
|
||||
if (!file->archive->name || !*file->archive->name
|
||||
|| (v =
|
||||
vfs_get_class (file->archive->name))->flags & VFSF_LOCAL) {
|
||||
parent = NULL;
|
||||
} else {
|
||||
parent = g_new (struct vfs_stamping, 1);
|
||||
parent->v = v;
|
||||
parent->next = 0;
|
||||
parent->id = (*v->getid) (v, file->archive->name, &(parent->parent));
|
||||
parent->id =
|
||||
(*v->getid) (v, file->archive->name, &(parent->parent));
|
||||
}
|
||||
vfs_add_noncurrent_stamps (&vfs_extfs_ops, (vfsid) (file->archive), parent);
|
||||
vfs_add_noncurrent_stamps (&vfs_extfs_ops, (vfsid) (file->archive),
|
||||
parent);
|
||||
vfs_rm_parents (parent);
|
||||
}
|
||||
|
||||
g_free (data);
|
||||
if (errno_code) ERRNOR (EIO, -1);
|
||||
if (errno_code)
|
||||
ERRNOR (EIO, -1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
13
vfs/vfs.c
13
vfs/vfs.c
@ -90,15 +90,11 @@ get_bucket (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vfs_local_ops needs to be the first one */
|
||||
static vfs *vfs_list = &vfs_local_ops;
|
||||
static vfs *vfs_list;
|
||||
|
||||
int
|
||||
vfs_register_class (vfs *vfs)
|
||||
vfs_register_class (struct vfs_class *vfs)
|
||||
{
|
||||
if (!vfs)
|
||||
vfs_die("You cannot register NULL.");
|
||||
|
||||
if (vfs->init) /* vfs has own initialization function */
|
||||
if (!(*vfs->init)(vfs)) /* but it failed */
|
||||
return 0;
|
||||
@ -279,7 +275,7 @@ vfs_timeouts ()
|
||||
static void
|
||||
vfs_addstamp (vfs *v, vfsid id, struct vfs_stamping *parent)
|
||||
{
|
||||
if (v != &vfs_local_ops && id != (vfsid)-1){
|
||||
if (!(v->flags & VFSF_LOCAL) && id != (vfsid)-1){
|
||||
struct vfs_stamping *stamp;
|
||||
struct vfs_stamping *last_stamp = NULL;
|
||||
|
||||
@ -1215,7 +1211,8 @@ vfs_init (void)
|
||||
current_mon = t->tm_mon;
|
||||
current_year = t->tm_year;
|
||||
|
||||
/* We do not want to register vfs_local_ops */
|
||||
/* vfs_local_ops needs to be the first one */
|
||||
vfs_register_class (&vfs_local_ops);
|
||||
|
||||
#ifdef USE_NETCODE
|
||||
tcp_init();
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user