Remove useless fsip_fs_free(). Delegate freeing of private data to its plugin
authorjohn.levon@sun.com <john.levon@sun.com>
Tue, 16 Jan 2007 18:54:20 +0000 (10:54 -0800)
committerjohn.levon@sun.com <john.levon@sun.com>
Tue, 16 Jan 2007 18:54:20 +0000 (10:54 -0800)
users. Miscellaneous tidy.

Signed-off-by: John Levon <john.levon@sun.com>
tools/libfsimage/common/fsimage.c
tools/libfsimage/common/fsimage_grub.c
tools/libfsimage/common/fsimage_plugin.c
tools/libfsimage/common/fsimage_plugin.h
tools/libfsimage/common/mapfile-GNU
tools/libfsimage/common/mapfile-SunOS
tools/libfsimage/ext2fs-lib/ext2fs-lib.c

index a326fd7644301f302ed96d71c0743cb0b795204b..08262f81ced3505812c47ded73157c4079a81df6 100644 (file)
@@ -74,7 +74,7 @@ void fsi_close_fsimage(fsi_t *fsi)
        pthread_mutex_lock(&fsi_lock);
         fsi->f_plugin->fp_ops->fpo_umount(fsi);
         (void) close(fsi->f_fd);
-       fsip_fs_free(fsi);
+       free(fsi);
        pthread_mutex_unlock(&fsi_lock);
 }
 
index 252445f58e5e1742ab77cb36bfc30582731e4964..99481064a9047cb7f3eaf21257665ac5c1c2c155 100644 (file)
@@ -193,6 +193,7 @@ fsig_mount(fsi_t *fsi, const char *path)
 static int
 fsig_umount(fsi_t *fsi)
 {
+       free(fsi->f_data);
        return (0);
 }
 
@@ -250,6 +251,7 @@ fsig_read(fsi_file_t *ffi, void *buf, size_t nbytes)
 static int
 fsig_close(fsi_file_t *ffi)
 {
+       free(ffi->ff_data);
        fsip_file_free(ffi);
        return (0);
 }
index 71099ba2ffed194f96ac7140eab1badf2ebe761b..f9616481649ceb065f5469c4609abb648e0816c8 100644 (file)
@@ -40,13 +40,6 @@ fsip_fs_set_data(fsi_t *fsi, void *data)
        fsi->f_data = data;
 }
 
-void
-fsip_fs_free(fsi_t *fsi)
-{
-       free(fsi->f_data);
-       free(fsi);
-}
-
 fsi_file_t *
 fsip_file_alloc(fsi_t *fsi, void *data)
 {
@@ -64,7 +57,6 @@ fsip_file_alloc(fsi_t *fsi, void *data)
 void
 fsip_file_free(fsi_file_t *ffi)
 {
-       free(ffi->ff_data);
        free(ffi);
 }
 
index 4592e08be7719260d47b32d012ac787ffff8fb6d..f1c83fab9596aed7daa1347435011a9bb927bcce 100644 (file)
@@ -50,11 +50,10 @@ typedef fsi_plugin_ops_t *
     (*fsi_plugin_init_t)(int, fsi_plugin_t *, const char **);
 
 void fsip_fs_set_data(fsi_t *, void *);
-void fsip_fs_free(fsi_t *);
 fsi_file_t *fsip_file_alloc(fsi_t *, void *);
 void fsip_file_free(fsi_file_t *);
-fsi_t * fsip_fs(fsi_file_t *ffi);
-uint64_t fsip_fs_offset(fsi_t *fsi);
+fsi_t *fsip_fs(fsi_file_t *);
+uint64_t fsip_fs_offset(fsi_t *);
 void *fsip_fs_data(fsi_t *);
 void *fsip_file_data(fsi_file_t *);
 
index f15060cba4a8466555b206e04b019131bda2fc00..4bffdeafb0de96d9131c5f0015d80157c21a69c4 100644 (file)
@@ -1,5 +1,5 @@
 VERSION {
-       libfsimage.so.1.1 {
+       libfsimage.so.1.0 {
                global:
                        fsi_open_fsimage;
                        fsi_close_fsimage;
@@ -10,7 +10,6 @@ VERSION {
                        fsi_pread_file;
        
                        fsip_fs_set_data;
-                       fsip_fs_free;
                        fsip_file_alloc;
                        fsip_file_free;
                        fsip_fs;
index 1ea38bed04ef933aaa0a35d53317a9c65a1b6e34..63f17e1832324be2c546237a42436620175dcc85 100644 (file)
@@ -1,4 +1,4 @@
-libfsimage.so.1.1 {
+libfsimage.so.1.0 {
        global:
                fsi_open_fsimage;
                fsi_close_fsimage;
@@ -9,7 +9,6 @@ libfsimage.so.1.1 {
                fsi_pread_file;
 
                fsip_fs_set_data;
-               fsip_fs_free;
                fsip_file_alloc;
                fsip_file_free;
                fsip_fs;
index b6f60ce65f0dfc41451eaa14e91677f35c67d1c7..aa8e7a63f4c2f01fc51a4c9193a5ea90fe931147 100644 (file)
@@ -58,9 +58,11 @@ ext2lib_umount(fsi_t *fsi)
 {
        ext2_filsys *fs = fsip_fs_data(fsi);
        if (ext2fs_close(*fs) != 0) {
+               free(fs);
                errno = EINVAL;
                return (-1);
        }
+       free(fs);
        return (0);
 }