WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Remove useless fsip_fs_free(). Delegate freeing of p

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Remove useless fsip_fs_free(). Delegate freeing of private data to its plugin
From: john.levon@xxxxxxx
Date: Tue, 16 Jan 2007 10:57:42 -0700
Delivery-date: Tue, 16 Jan 2007 10:57:24 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User john.levon@xxxxxxx
# Date 1168973660 28800
# Node ID 0ab4d48cf7dc4ad9a5dc2aecb2898111ff27527e
# Parent  029c45513e40a5a94fe5a553001f79bd4bbf9f57
Remove useless fsip_fs_free(). Delegate freeing of private data to its plugin
users. Miscellaneous tidy.

Signed-off-by: John Levon <john.levon@xxxxxxx>

diff --git a/tools/libfsimage/common/fsimage.c 
b/tools/libfsimage/common/fsimage.c
--- a/tools/libfsimage/common/fsimage.c
+++ b/tools/libfsimage/common/fsimage.c
@@ -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);
 }
 
diff --git a/tools/libfsimage/common/fsimage_grub.c 
b/tools/libfsimage/common/fsimage_grub.c
--- a/tools/libfsimage/common/fsimage_grub.c
+++ b/tools/libfsimage/common/fsimage_grub.c
@@ -193,6 +193,7 @@ static int
 static int
 fsig_umount(fsi_t *fsi)
 {
+       free(fsi->f_data);
        return (0);
 }
 
@@ -250,6 +251,7 @@ static int
 static int
 fsig_close(fsi_file_t *ffi)
 {
+       free(ffi->ff_data);
        fsip_file_free(ffi);
        return (0);
 }
diff --git a/tools/libfsimage/common/fsimage_plugin.c 
b/tools/libfsimage/common/fsimage_plugin.c
--- a/tools/libfsimage/common/fsimage_plugin.c
+++ b/tools/libfsimage/common/fsimage_plugin.c
@@ -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 @@ void
 void
 fsip_file_free(fsi_file_t *ffi)
 {
-       free(ffi->ff_data);
        free(ffi);
 }
 
diff --git a/tools/libfsimage/common/fsimage_plugin.h 
b/tools/libfsimage/common/fsimage_plugin.h
--- a/tools/libfsimage/common/fsimage_plugin.h
+++ b/tools/libfsimage/common/fsimage_plugin.h
@@ -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 *);
 
diff --git a/tools/libfsimage/common/mapfile-GNU 
b/tools/libfsimage/common/mapfile-GNU
--- a/tools/libfsimage/common/mapfile-GNU
+++ b/tools/libfsimage/common/mapfile-GNU
@@ -1,5 +1,5 @@ VERSION {
 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;
diff --git a/tools/libfsimage/common/mapfile-SunOS 
b/tools/libfsimage/common/mapfile-SunOS
--- a/tools/libfsimage/common/mapfile-SunOS
+++ b/tools/libfsimage/common/mapfile-SunOS
@@ -1,4 +1,4 @@ libfsimage.so.1.1 {
-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;
diff --git a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c 
b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c
--- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c
+++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c
@@ -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);
 }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Remove useless fsip_fs_free(). Delegate freeing of private data to its plugin, john . levon <=