Filesystem implementations may need optional arguments in terms of
PATCH 1/1 Filesystem implementations may need optional arguments in terms of
# HG changeset patch
# User [email protected]
# Date 1171033428 28800
# Node ID 465de696b9c64071a4e603439fd9dfbd39250a57
# Parent 4708ec13626af36ce5440daa627149cb35e68fd2 Filesystem implementations may need optional arguments in terms of what to mount. Add an options string to the libfsimage API.
Signed-off-by John Levon <[email protected]>
tools/libfsimage/common/fsimage.c +2 -2
@@ -36,7 +36,7 @@static pthread_mutex_t fsi_lock =PTHREAD_MUTEX_INITIALIZER ; -fsi_t *fsi_open_fsimage (const char *path,uint64_t off) +fsi_t *fsi_open_fsimage (const char *path,uint64_t off,const char *options) {fsi_t *fsi =NULL ;int fd;
@@ -53,7 +53,7 @@ fsi_t *fsi_open_fsimage(const char *path fsi->f_data =NULL ;pthread_mutex_lock (&fsi_lock); - err =find_plugin (fsi, path); + err =find_plugin (fsi, path, options);pthread_mutex_unlock (&fsi_lock);if (err !=0 ) goto fail;
tools/libfsimage/common/fsimage.h +1 -1
@@ -35,7 +35,7 @@ typedef struct fsi fsi_t;typedef struct fsi fsi_t ;typedef struct fsi_file fsi_file_t ; -fsi_t *fsi_open_fsimage (const char *,uint64_t ); +fsi_t *fsi_open_fsimage (const char *,uint64_t ,const char *);void fsi_close_fsimage (fsi_t *);int fsi_file_exists (fsi_t *,const char *);
tools/libfsimage/common/fsimage_grub.c +2 -2
@@ -161,7 +161,7 @@ fsig_substring(const char *s1, const cha }static int -fsig_mount (fsi_t *fsi,const char *path) +fsig_mount (fsi_t *fsi,const char *path,const char *options) {fsig_plugin_ops_t *ops = fsi->f_plugin->fp_data;fsi_file_t *ffi;
@@ -178,7 +178,7 @@ fsig_mount(fsi_t *fsi, const char *path)bzero (fsi->f_data,sizeof (fsig_data_t)); -if (!ops->fpo_mount (ffi)) { +if (!ops->fpo_mount (ffi, options)) {fsip_file_free (ffi);free (fsi->f_data); fsi->f_data =NULL ;
tools/libfsimage/common/fsimage_grub.h +1 -1
@@ -38,7 +38,7 @@ extern C {typedef struct fsig_plugin_ops {int fpo_version; -int (*fpo_mount)(fsi_file_t *); +int (*fpo_mount)(fsi_file_t *,const char *);int (*fpo_dir)(fsi_file_t *,char *);int (*fpo_read)(fsi_file_t *,char *,int ); }fsig_plugin_ops_t ;
tools/libfsimage/common/fsimage_plugin.c +2 -2
@@ -185,7 +185,7 @@ fail:return (ret); } -int find_plugin (fsi_t *fsi,const char *path) +int find_plugin (fsi_t *fsi,const char *path,const char *options) {fsi_plugin_t *fp;int ret =0 ;
@@ -195,7 +195,7 @@ int find_plugin(fsi_t *fsi, const char *for (fp = plugins; fp !=NULL ; fp = fp->fp_next) { fsi->f_plugin = fp; -if (fp->fp_ops->fpo_mount (fsi, path) ==0 ) +if (fp->fp_ops->fpo_mount (fsi, path, options) ==0 ) goto out; }
tools/libfsimage/common/fsimage_plugin.h +1 -1
@@ -38,7 +38,7 @@ typedef struct fsi_plugin fsi_plugin_t; typedef struct fsi_plugin_ops { int fpo_version; - int (*fpo_mount)(fsi_t *, const char *); + int (*fpo_mount)(fsi_t *, const char *, const char *); int (*fpo_umount)(fsi_t *); fsi_file_t *(*fpo_open)(fsi_t *, const char *); ssize_t (*fpo_read)(fsi_file_t *, void *, size_t);
tools/libfsimage/common/fsimage_priv.h +1 -1
@@ -53,7 +53,7 @@ struct fsi_file {void *ff_data; }; -int find_plugin (fsi_t *,const char *); +int find_plugin (fsi_t *,const char *,const char *); #ifdef __cplusplus };
tools/libfsimage/ext2fs-lib/ext2fs-lib.c +1 -1
@@ -27,7 +27,7 @@#include <inttypes.h> static int -ext2lib_mount (fsi_t *fsi,const char *name) +ext2lib_mount (fsi_t *fsi,const char *name,const char *options) {int err;char opts[30 ] ="" ;
tools/libfsimage/ext2fs/fsys_ext2fs.c +1 -1
@@ -321,7 +321,7 @@ ffz (unsigned long word)/* check filesystem types and read superblock into memory buffer */ int -ext2fs_mount (fsi_file_t *ffi) +ext2fs_mount (fsi_file_t *ffi,const char *options) {int retval =1 ;
tools/libfsimage/reiserfs/fsys_reiserfs.c +1 -1
@@ -633,7 +633,7 @@ journal_init (fsi_file_t *ffi)/* check filesystem types and read superblock into memory buffer */ int -reiserfs_mount (fsi_file_t *ffi) +reiserfs_mount (fsi_file_t *ffi,const char *options) {struct reiserfs_super_block super;int superblock =REISERFS_DISK_OFFSET_IN_BYTES >>SECTOR_BITS ;
tools/libfsimage/ufs/fsys_ufs.c +1 -1
@@ -44,7 +44,7 @@ static grub_daddr32_t sbmap(fsi_file_t */* read superblock and check fs magic */ int -ufs_mount (fsi_file_t *ffi) +ufs_mount (fsi_file_t *ffi,const char *options) { if (/*! IS_PC_SLICE_TYPE_SOLARIS(current_slice) || */ !devread(ffi, UFS_SBLOCK, 0, UFS_SBSIZE, (char *)SUPERBLOCK) ||
tools/pygrub/src/fsimage/fsimage.c +8 -6
@@ -260,19 +260,20 @@ static PyObject *static PyObject *fsimage_open (PyObject *o,PyObject *args,PyObject *kwargs) { -static char *kwlist[] = {"name" ,"offset" ,NULL }; -char * name; +static char *kwlist[] = {"name" ,"offset" ,"options" ,NULL }; +char *name; +char *options =NULL ;uint64_t offset =0 ;fsimage_fs_t *fs; -if (!PyArg_ParseTupleAndKeywords (args, kwargs,"s|L" , kwlist, - &name, &offset)) +if (!PyArg_ParseTupleAndKeywords (args, kwargs,"s|Ls" , kwlist, + &name, &offset, &options))return (NULL );if ((fs =PyObject_NEW (fsimage_fs_t, &fsimage_fs_type)) ==NULL )return (NULL ); -if ((fs->fs =fsi_open_fsimage (name, offset)) ==NULL ) { +if ((fs->fs =fsi_open_fsimage (name, offset, options)) ==NULL ) {PyErr_SetFromErrno (PyExc_IOError);return (NULL ); }
@@ -284,7 +285,8 @@ PyDoc_STRVAR(fsimage_open__doc__,"open(name, [offset=off]) - Open the given file as a filesystem image.\n" "\n" "name - name of file to open.\n" - "offset - offset of file system within file image.\n"); +"offset - offset of file system within file image.\n" + "options - mount options string.\n");static struct PyMethodDef fsimage_module_methods[] = { {"open" , (PyCFunction )fsimage_open,