direct-io.hg

changeset 13388:2ff7dedde1e3

Remove useless fsip_fs_free(). Delegate freeing of private data to its plugin
users. Miscellaneous tidy.

Signed-off-by: John Levon <john.levon@sun.com>
author john.levon@sun.com
date Tue Jan 16 10:54:20 2007 -0800 (2007-01-16)
parents fd2667419c53
children 8a397303fe09
files 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
line diff
     1.1 --- a/tools/libfsimage/common/fsimage.c	Tue Jan 16 14:04:12 2007 -0500
     1.2 +++ b/tools/libfsimage/common/fsimage.c	Tue Jan 16 10:54:20 2007 -0800
     1.3 @@ -74,7 +74,7 @@ void fsi_close_fsimage(fsi_t *fsi)
     1.4  	pthread_mutex_lock(&fsi_lock);
     1.5          fsi->f_plugin->fp_ops->fpo_umount(fsi);
     1.6          (void) close(fsi->f_fd);
     1.7 -	fsip_fs_free(fsi);
     1.8 +	free(fsi);
     1.9  	pthread_mutex_unlock(&fsi_lock);
    1.10  }
    1.11  
     2.1 --- a/tools/libfsimage/common/fsimage_grub.c	Tue Jan 16 14:04:12 2007 -0500
     2.2 +++ b/tools/libfsimage/common/fsimage_grub.c	Tue Jan 16 10:54:20 2007 -0800
     2.3 @@ -193,6 +193,7 @@ fsig_mount(fsi_t *fsi, const char *path)
     2.4  static int
     2.5  fsig_umount(fsi_t *fsi)
     2.6  {
     2.7 +	free(fsi->f_data);
     2.8  	return (0);
     2.9  }
    2.10  
    2.11 @@ -250,6 +251,7 @@ fsig_read(fsi_file_t *ffi, void *buf, si
    2.12  static int
    2.13  fsig_close(fsi_file_t *ffi)
    2.14  {
    2.15 +	free(ffi->ff_data);
    2.16  	fsip_file_free(ffi);
    2.17  	return (0);
    2.18  }
     3.1 --- a/tools/libfsimage/common/fsimage_plugin.c	Tue Jan 16 14:04:12 2007 -0500
     3.2 +++ b/tools/libfsimage/common/fsimage_plugin.c	Tue Jan 16 10:54:20 2007 -0800
     3.3 @@ -40,13 +40,6 @@ fsip_fs_set_data(fsi_t *fsi, void *data)
     3.4  	fsi->f_data = data;
     3.5  }
     3.6  
     3.7 -void
     3.8 -fsip_fs_free(fsi_t *fsi)
     3.9 -{
    3.10 -	free(fsi->f_data);
    3.11 -	free(fsi);
    3.12 -}
    3.13 -
    3.14  fsi_file_t *
    3.15  fsip_file_alloc(fsi_t *fsi, void *data)
    3.16  {
    3.17 @@ -64,7 +57,6 @@ fsip_file_alloc(fsi_t *fsi, void *data)
    3.18  void
    3.19  fsip_file_free(fsi_file_t *ffi)
    3.20  {
    3.21 -	free(ffi->ff_data);
    3.22  	free(ffi);
    3.23  }
    3.24  
     4.1 --- a/tools/libfsimage/common/fsimage_plugin.h	Tue Jan 16 14:04:12 2007 -0500
     4.2 +++ b/tools/libfsimage/common/fsimage_plugin.h	Tue Jan 16 10:54:20 2007 -0800
     4.3 @@ -50,11 +50,10 @@ typedef fsi_plugin_ops_t *
     4.4      (*fsi_plugin_init_t)(int, fsi_plugin_t *, const char **);
     4.5  
     4.6  void fsip_fs_set_data(fsi_t *, void *);
     4.7 -void fsip_fs_free(fsi_t *);
     4.8  fsi_file_t *fsip_file_alloc(fsi_t *, void *);
     4.9  void fsip_file_free(fsi_file_t *);
    4.10 -fsi_t * fsip_fs(fsi_file_t *ffi);
    4.11 -uint64_t fsip_fs_offset(fsi_t *fsi);
    4.12 +fsi_t *fsip_fs(fsi_file_t *);
    4.13 +uint64_t fsip_fs_offset(fsi_t *);
    4.14  void *fsip_fs_data(fsi_t *);
    4.15  void *fsip_file_data(fsi_file_t *);
    4.16  
     5.1 --- a/tools/libfsimage/common/mapfile-GNU	Tue Jan 16 14:04:12 2007 -0500
     5.2 +++ b/tools/libfsimage/common/mapfile-GNU	Tue Jan 16 10:54:20 2007 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  VERSION {
     5.5 -	libfsimage.so.1.1 {
     5.6 +	libfsimage.so.1.0 {
     5.7  		global:
     5.8  			fsi_open_fsimage;
     5.9  			fsi_close_fsimage;
    5.10 @@ -10,7 +10,6 @@ VERSION {
    5.11  			fsi_pread_file;
    5.12  	
    5.13  			fsip_fs_set_data;
    5.14 -			fsip_fs_free;
    5.15  			fsip_file_alloc;
    5.16  			fsip_file_free;
    5.17  			fsip_fs;
     6.1 --- a/tools/libfsimage/common/mapfile-SunOS	Tue Jan 16 14:04:12 2007 -0500
     6.2 +++ b/tools/libfsimage/common/mapfile-SunOS	Tue Jan 16 10:54:20 2007 -0800
     6.3 @@ -1,4 +1,4 @@
     6.4 -libfsimage.so.1.1 {
     6.5 +libfsimage.so.1.0 {
     6.6  	global:
     6.7  		fsi_open_fsimage;
     6.8  		fsi_close_fsimage;
     6.9 @@ -9,7 +9,6 @@ libfsimage.so.1.1 {
    6.10  		fsi_pread_file;
    6.11  
    6.12  		fsip_fs_set_data;
    6.13 -		fsip_fs_free;
    6.14  		fsip_file_alloc;
    6.15  		fsip_file_free;
    6.16  		fsip_fs;
     7.1 --- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c	Tue Jan 16 14:04:12 2007 -0500
     7.2 +++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c	Tue Jan 16 10:54:20 2007 -0800
     7.3 @@ -58,9 +58,11 @@ ext2lib_umount(fsi_t *fsi)
     7.4  {
     7.5  	ext2_filsys *fs = fsip_fs_data(fsi);
     7.6  	if (ext2fs_close(*fs) != 0) {
     7.7 +		free(fs);
     7.8  		errno = EINVAL;
     7.9  		return (-1);
    7.10  	}
    7.11 +	free(fs);
    7.12  	return (0);
    7.13  }
    7.14