Browse Source

* undelfs.c (undelfs_get_path): Constify first argument.
* vfs.h (struct vfs_class): Constify path. Fix all dependencies.

Pavel Roskin 21 years ago
parent
commit
091023c37a
9 changed files with 32 additions and 29 deletions
  1. 3 0
      vfs/ChangeLog
  2. 2 2
      vfs/direntry.c
  3. 14 16
      vfs/extfs.c
  4. 1 1
      vfs/local.c
  5. 1 1
      vfs/sfs.c
  6. 1 1
      vfs/smbfs.c
  7. 8 6
      vfs/undelfs.c
  8. 1 1
      vfs/vfs.h
  9. 1 1
      vfs/xdirentry.h

+ 3 - 0
vfs/ChangeLog

@@ -1,5 +1,8 @@
 2003-10-11  Pavel Roskin  <proski@gnu.org>
 
+	* undelfs.c (undelfs_get_path): Constify first argument.
+	* vfs.h (struct vfs_class): Constify path.  Fix all dependencies.
+
 	* vfs.c (vfs_release_path): New function, code taken from
 	_do_panel_cd().
 	(vfs_ncs_getid): Make static.

+ 2 - 2
vfs/direntry.c

@@ -522,7 +522,7 @@ return_success:
 }
 
 static char *
-vfs_s_get_path (vfs *me, char *inname, struct vfs_s_super **archive, int flags)
+vfs_s_get_path (vfs *me, const char *inname, struct vfs_s_super **archive, int flags)
 {
     char *buf = g_strdup( inname );
     char *res = vfs_s_get_path_mangle (me, buf, archive, flags);
@@ -1071,7 +1071,7 @@ vfs_s_setctl (vfs *me, char *path, int ctlop, char *arg)
 /* ----------------------------- Stamping support -------------------------- */
 
 vfsid
-vfs_s_getid (vfs *me, char *path, struct vfs_stamping **parent)
+vfs_s_getid (vfs *me, const char *path, struct vfs_stamping **parent)
 {
     vfs_s_super *archive;
     vfs *v;

+ 14 - 16
vfs/extfs.c

@@ -408,9 +408,6 @@ read_archive (int fstype, char *name, struct archive **pparc)
     return 0;
 }
 
-static char *get_path (char *inname, struct archive **archive, int is_dir,
-    int do_not_open);
-
 /* Returns path inside argument. Returned char* is inside inname, which is
  * mangled by this operation (so you must not free it's return value).
  */
@@ -473,6 +470,19 @@ get_path_mangle (char *inname, struct archive **archive, int is_dir,
     return local;
 }
 
+static char *
+get_path (const char *inname, struct archive **archive, int is_dir,
+	  int do_not_open)
+{
+    char *buf = g_strdup (inname);
+    char *res = get_path_mangle (buf, archive, is_dir, do_not_open);
+    char *res2 = NULL;
+    if (res)
+	res2 = g_strdup (res);
+    g_free (buf);
+    return res2;
+}
+
 /* Returns allocated path (without leading slash) inside the archive  */
 static char *get_path_from_entry (struct entry *entry)
 {
@@ -757,18 +767,6 @@ static int extfs_close (void *data)
 
 #define RECORDSIZE 512
 
-static char *get_path (char *inname, struct archive **archive, int is_dir,
-    int do_not_open)
-{
-    char *buf = g_strdup (inname);
-    char *res = get_path_mangle( buf, archive, is_dir, do_not_open );
-    char *res2 = NULL;
-    if (res)
-        res2 = g_strdup(res);
-    g_free(buf);
-    return res2;
-}
-
 static struct entry*
 __find_entry (struct entry *dir, char *name, 
 		     struct loop_protect *list, int make_dirs, int make_file)
@@ -1133,7 +1131,7 @@ static int extfs_lseek (void *data, off_t offset, int whence)
     return lseek (file->local_handle, offset, whence);
 }
 
-static vfsid extfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
+static vfsid extfs_getid (vfs *me, const char *path, struct vfs_stamping **parent)
 {
     struct archive *archive;
     vfs *v;

+ 1 - 1
vfs/local.c

@@ -252,7 +252,7 @@ local_rmdir (vfs *me, char *path)
 }
 
 static vfsid
-local_getid (vfs *me, char *path, struct vfs_stamping **parent)
+local_getid (vfs *me, const char *path, struct vfs_stamping **parent)
 {
     *parent = NULL;
     return (vfsid) -1; /* We do not free local fs stuff at all */

+ 1 - 1
vfs/sfs.c

@@ -205,7 +205,7 @@ static int sfs_readlink (vfs *me, char *path, char *buf, int size)
 }
 
 static vfsid
-sfs_getid (vfs *me, char *path, struct vfs_stamping **parent)
+sfs_getid (vfs *me, const char *path, struct vfs_stamping **parent)
 {				/* FIXME: what should I do? */
     vfs *v;
     vfsid id;

+ 1 - 1
vfs/smbfs.c

@@ -1665,7 +1665,7 @@ smbfs_link (vfs *me, char *p1, char *p2)
  * out of them
  */
 static vfsid
-smbfs_getid (vfs *me, char *p, struct vfs_stamping **parent)
+smbfs_getid (vfs *me, const char *p, struct vfs_stamping **parent)
 {
     *parent = NULL;
     DEBUG (3, ("smbfs_getid(p:%s)\n", p));

+ 8 - 6
vfs/undelfs.c

@@ -98,9 +98,9 @@ undelfs_shutdown (void)
 }
 
 static void
-undelfs_get_path (char *dirname, char **ext2_fname, char **file)
+undelfs_get_path (const char *dirname, char **ext2_fname, char **file)
 {
-    char *p;
+    const char *p;
 
     /* To look like filesystem, we have virtual directories
        /#undel:XXX, which have no subdirectories. XXX is replaced with
@@ -129,10 +129,12 @@ undelfs_get_path (char *dirname, char **ext2_fname, char **file)
     
     while (p > dirname){
 	if (*p == '/'){
+	    char *tmp;
+
 	    *file = g_strdup (p+1);
-	    *p = 0;
-	    *ext2_fname = g_strconcat ("/dev/", dirname, NULL);
-	    *p = '/';
+	    tmp = g_strndup (dirname, p - dirname);
+	    *ext2_fname = g_strconcat ("/dev/", tmp, NULL);
+	    g_free (tmp);
 	    return;
 	}
 	p--;
@@ -627,7 +629,7 @@ undelfs_lseek(void *vfs_info, off_t offset, int whence)
 }
 
 static vfsid
-undelfs_getid(vfs *me, char *path, struct vfs_stamping **parent)
+undelfs_getid(vfs *me, const char *path, struct vfs_stamping **parent)
 {
     char *ext2_fname, *file;
 

+ 1 - 1
vfs/vfs.h

@@ -64,7 +64,7 @@ struct vfs_class {
     int (*lseek) (void *vfs_info, off_t offset, int whence);
     int (*mknod) (vfs *me, char *path, int mode, int dev);
 
-    vfsid (*getid) (vfs *me, char *path, struct vfs_stamping ** parent);
+    vfsid (*getid) (vfs *me, const char *path, struct vfs_stamping ** parent);
 
     int (*nothingisopen) (vfsid id);
     void (*free) (vfsid id);

+ 1 - 1
vfs/xdirentry.h

@@ -226,7 +226,7 @@ void vfs_s_dump(vfs *me, char *prefix, vfs_s_inode *ino);
 char *vfs_s_getlocalcopy (vfs *me, char *path);
 
 /* stamping support */
-vfsid vfs_s_getid (vfs *me, char *path, struct vfs_stamping **parent);
+vfsid vfs_s_getid (vfs *me, const char *path, struct vfs_stamping **parent);
 int vfs_s_nothingisopen (vfsid id);
 void vfs_s_free (vfsid id);
 int vfs_s_setctl (vfs *me, char *path, int ctlop, char *arg);