* direnty.c (vfs_s_new_entry): Revert last changes.

(vfs_s_generate_entry): Likewise.
        (vfs_s_find_entry_linear): Likewise.
        (vfs_s_find_inode): Likewise.
        * xdirentry.h: likewise.
This commit is contained in:
Andrew V. Samoilov 2004-09-22 05:50:45 +00:00
parent c5fd73d92b
commit c524515308
3 changed files with 22 additions and 26 deletions

View File

@ -1,3 +1,11 @@
2004-09-22 Pavel S. Shirshov <pavelsh@mail.ru>
* direnty.c (vfs_s_new_entry): Revert last changes.
(vfs_s_generate_entry): Likewise.
(vfs_s_find_entry_linear): Likewise.
(vfs_s_find_inode): Likewise.
* xdirentry.h: likewise.
2004-09-19 Roland Illig <roland.illig@gmx.de> 2004-09-19 Roland Illig <roland.illig@gmx.de>
* direntry.c: Added const qualifier to function declarations and * direntry.c: Added const qualifier to function declarations and

View File

@ -61,7 +61,7 @@ vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *i
} }
struct vfs_s_entry * struct vfs_s_entry *
vfs_s_new_entry (struct vfs_class *me, const char *name, struct vfs_s_inode *inode) vfs_s_new_entry (struct vfs_class *me, char *name, struct vfs_s_inode *inode)
{ {
struct vfs_s_entry *entry; struct vfs_s_entry *entry;
@ -164,7 +164,7 @@ vfs_s_default_stat (struct vfs_class *me, mode_t mode)
} }
struct vfs_s_entry * struct vfs_s_entry *
vfs_s_generate_entry (struct vfs_class *me, const char *name, struct vfs_s_inode *parent, mode_t mode) vfs_s_generate_entry (struct vfs_class *me, char *name, struct vfs_s_inode *parent, mode_t mode)
{ {
struct vfs_s_inode *inode; struct vfs_s_inode *inode;
struct stat *st; struct stat *st;
@ -238,11 +238,10 @@ vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry,
*/ */
static struct vfs_s_entry * static struct vfs_s_entry *
vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root, vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
const char *a_path, int follow, int flags) char *path, int follow, int flags)
{ {
size_t pseg; size_t pseg;
struct vfs_s_entry *ent = NULL; struct vfs_s_entry *ent = NULL;
char *path = g_strdup (a_path);
canonicalize_pathname (path); canonicalize_pathname (path);
@ -250,10 +249,8 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
while (*path == PATH_SEP) /* Strip leading '/' */ while (*path == PATH_SEP) /* Strip leading '/' */
path++; path++;
if (!path[0]) { if (!path[0])
g_free (path);
return ent; return ent;
}
for (pseg = 0; path[pseg] && path[pseg] != PATH_SEP; pseg++); for (pseg = 0; path[pseg] && path[pseg] != PATH_SEP; pseg++);
@ -276,11 +273,10 @@ vfs_s_find_entry_tree (struct vfs_class *me, struct vfs_s_inode *root,
PATH_SEP) ? LINK_FOLLOW : PATH_SEP) ? LINK_FOLLOW :
follow); follow);
if (!ent) if (!ent)
goto cleanup; return NULL;
root = ent->ino; root = ent->ino;
} }
cleanup:
g_free (path);
return NULL; return NULL;
} }
@ -303,11 +299,9 @@ split_dir_name (struct vfs_class *me, char *path, char **dir, char **name, char
static struct vfs_s_entry * static struct vfs_s_entry *
vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root, vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
const char *a_path, int follow, int flags) char *path, int follow, int flags)
{ {
struct vfs_s_entry *ent = NULL; struct vfs_s_entry *ent = NULL;
char *path = g_strdup (a_path);
struct vfs_s_entry *retval = NULL;
if (root->super->root != root) if (root->super->root != root)
vfs_die ("We have to use _real_ root. Always. Sorry."); vfs_die ("We have to use _real_ root. Always. Sorry.");
@ -323,9 +317,7 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
flags | FL_DIR); flags | FL_DIR);
if (save) if (save)
*save = PATH_SEP; *save = PATH_SEP;
retval = vfs_s_find_entry_tree (me, ino, name, follow, flags); return vfs_s_find_entry_tree (me, ino, name, follow, flags);
g_free (path);
return retval;
} }
for (ent = root->subdir; ent != NULL; ent = ent->next) for (ent = root->subdir; ent != NULL; ent = ent->next)
@ -349,7 +341,6 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
ent = vfs_s_new_entry (me, path, ino); ent = vfs_s_new_entry (me, path, ino);
if ((MEDATA->dir_load) (me, ino, path) == -1) { if ((MEDATA->dir_load) (me, ino, path) == -1) {
vfs_s_free_entry (me, ent); vfs_s_free_entry (me, ent);
g_free (path);
return NULL; return NULL;
} }
vfs_s_insert_entry (me, root, ent); vfs_s_insert_entry (me, root, ent);
@ -362,18 +353,15 @@ vfs_s_find_entry_linear (struct vfs_class *me, struct vfs_s_inode *root,
vfs_die ("find_linear: success but directory is not there\n"); vfs_die ("find_linear: success but directory is not there\n");
#if 0 #if 0
if (!vfs_s_resolve_symlink (me, ent, follow)) { if (!vfs_s_resolve_symlink (me, ent, follow))
g_free (path);
return NULL; return NULL;
}
#endif #endif
g_free (path);
return ent; return ent;
} }
struct vfs_s_inode * struct vfs_s_inode *
vfs_s_find_inode (struct vfs_class *me, const struct vfs_s_super *super, vfs_s_find_inode (struct vfs_class *me, const struct vfs_s_super *super,
const char *path, int follow, int flags) char *path, int follow, int flags)
{ {
struct vfs_s_entry *ent; struct vfs_s_entry *ent;
if (!(MEDATA->flags & VFS_S_REMOTE) && (!*path)) if (!(MEDATA->flags & VFS_S_REMOTE) && (!*path))

View File

@ -140,7 +140,7 @@ struct vfs_s_subclass {
struct vfs_s_entry *(*find_entry) (struct vfs_class *me, struct vfs_s_entry *(*find_entry) (struct vfs_class *me,
struct vfs_s_inode *root, struct vfs_s_inode *root,
const char *path, int follow, int flags); char *path, int follow, int flags);
int (*dir_load) (struct vfs_class *me, struct vfs_s_inode *ino, int (*dir_load) (struct vfs_class *me, struct vfs_s_inode *ino,
char *path); char *path);
int (*dir_uptodate) (struct vfs_class *me, struct vfs_s_inode *ino); int (*dir_uptodate) (struct vfs_class *me, struct vfs_s_inode *ino);
@ -159,19 +159,19 @@ struct vfs_s_subclass {
struct vfs_s_inode *vfs_s_new_inode (struct vfs_class *me, struct vfs_s_inode *vfs_s_new_inode (struct vfs_class *me,
struct vfs_s_super *super, struct vfs_s_super *super,
struct stat *initstat); struct stat *initstat);
struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, const char *name, struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, char *name,
struct vfs_s_inode *inode); struct vfs_s_inode *inode);
void vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent); void vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent);
void vfs_s_insert_entry (struct vfs_class *me, struct vfs_s_inode *dir, void vfs_s_insert_entry (struct vfs_class *me, struct vfs_s_inode *dir,
struct vfs_s_entry *ent); struct vfs_s_entry *ent);
struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode); struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode);
struct vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, const char *name, struct vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, char *name,
struct vfs_s_inode *parent, struct vfs_s_inode *parent,
mode_t mode); mode_t mode);
struct vfs_s_inode *vfs_s_find_inode (struct vfs_class *me, struct vfs_s_inode *vfs_s_find_inode (struct vfs_class *me,
const struct vfs_s_super *super, const struct vfs_s_super *super,
const char *path, int follow, int flags); char *path, int follow, int flags);
struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me, struct vfs_s_inode *vfs_s_find_root (struct vfs_class *me,
struct vfs_s_entry *entry); struct vfs_s_entry *entry);