Remove useless fsip_fs_free(). Delegate freeing of private data to its plugin
PATCH 1/1 Remove useless fsip_fs_free(). Delegate freeing of private data to its plugin
# HG changeset patch
# User [email protected]
# 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 <[email protected]>
tools/libfsimage/common/fsimage.c +1 -1
@@ -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); }
tools/libfsimage/common/fsimage_grub.c +2 -0
@@ -193,6 +193,7 @@ static intstatic int fsig_umount (fsi_t *fsi) { +free (fsi->f_data);return (0 ); }
@@ -250,6 +251,7 @@ static intstatic int fsig_close (fsi_file_t *ffi) { +free (ffi->ff_data);fsip_file_free (ffi);return (0 ); }
tools/libfsimage/common/fsimage_plugin.c +0 -8
@@ -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 @@ voidvoid fsip_file_free (fsi_file_t *ffi) { -free (ffi->ff_data);free (ffi); }
tools/libfsimage/common/fsimage_plugin.h +2 -3
@@ -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 *);
tools/libfsimage/common/mapfile-GNU +1 -2
@@ -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;
tools/libfsimage/common/mapfile-SunOS +1 -2
@@ -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;
tools/libfsimage/ext2fs-lib/ext2fs-lib.c +2 -0
@@ -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 ); }