diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 2e4d2da95..3eb99ede7 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,11 @@ +2004-09-22 Pavel S. Shirshov + + * 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 * direntry.c: Added const qualifier to function declarations and diff --git a/vfs/direntry.c b/vfs/direntry.c index c7cf45002..a2aad9c12 100644 --- a/vfs/direntry.c +++ b/vfs/direntry.c @@ -61,7 +61,7 @@ vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *i } 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; @@ -164,7 +164,7 @@ 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_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 stat *st; @@ -238,11 +238,10 @@ vfs_s_resolve_symlink (struct vfs_class *me, struct vfs_s_entry *entry, */ static struct vfs_s_entry * 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; struct vfs_s_entry *ent = NULL; - char *path = g_strdup (a_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 '/' */ path++; - if (!path[0]) { - g_free (path); + if (!path[0]) return ent; - } 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 : follow); if (!ent) - goto cleanup; + return NULL; root = ent->ino; } -cleanup: - g_free (path); + 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 * 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; - char *path = g_strdup (a_path); - struct vfs_s_entry *retval = NULL; if (root->super->root != root) 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); if (save) *save = PATH_SEP; - retval = vfs_s_find_entry_tree (me, ino, name, follow, flags); - g_free (path); - return retval; + return vfs_s_find_entry_tree (me, ino, name, follow, flags); } 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); if ((MEDATA->dir_load) (me, ino, path) == -1) { vfs_s_free_entry (me, ent); - g_free (path); return NULL; } 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"); #if 0 - if (!vfs_s_resolve_symlink (me, ent, follow)) { - g_free (path); + if (!vfs_s_resolve_symlink (me, ent, follow)) return NULL; - } #endif - g_free (path); return ent; } struct vfs_s_inode * 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; if (!(MEDATA->flags & VFS_S_REMOTE) && (!*path)) diff --git a/vfs/xdirentry.h b/vfs/xdirentry.h index facdd8b80..152c76c06 100644 --- a/vfs/xdirentry.h +++ b/vfs/xdirentry.h @@ -140,7 +140,7 @@ struct vfs_s_subclass { struct vfs_s_entry *(*find_entry) (struct vfs_class *me, 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, char *path); 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_super *super, 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); 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, struct vfs_s_entry *ent); 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, mode_t mode); struct vfs_s_inode *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_inode *vfs_s_find_root (struct vfs_class *me, struct vfs_s_entry *entry);