[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] Filesystem implementations may need optional arguments in terms of
# HG changeset patch # User john.levon@xxxxxxx # Date 1171946682 28800 # Node ID ed4fc73b01e5faaadb929eb39c498e9f88a93e18 # Parent e8a7491ed4c57d4d82642dd954b8909d9065b377 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 <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 @@ -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; diff --git a/tools/libfsimage/common/fsimage.h b/tools/libfsimage/common/fsimage.h --- a/tools/libfsimage/common/fsimage.h +++ b/tools/libfsimage/common/fsimage.h @@ -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 *); 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 @@ -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; diff --git a/tools/libfsimage/common/fsimage_grub.h b/tools/libfsimage/common/fsimage_grub.h --- a/tools/libfsimage/common/fsimage_grub.h +++ b/tools/libfsimage/common/fsimage_grub.h @@ -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; 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 @@ -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; } 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 @@ -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); diff --git a/tools/libfsimage/common/fsimage_priv.h b/tools/libfsimage/common/fsimage_priv.h --- a/tools/libfsimage/common/fsimage_priv.h +++ b/tools/libfsimage/common/fsimage_priv.h @@ -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 }; 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 @@ -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] = ""; diff --git a/tools/libfsimage/ext2fs/fsys_ext2fs.c b/tools/libfsimage/ext2fs/fsys_ext2fs.c --- a/tools/libfsimage/ext2fs/fsys_ext2fs.c +++ b/tools/libfsimage/ext2fs/fsys_ext2fs.c @@ -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; diff --git a/tools/libfsimage/reiserfs/fsys_reiserfs.c b/tools/libfsimage/reiserfs/fsys_reiserfs.c --- a/tools/libfsimage/reiserfs/fsys_reiserfs.c +++ b/tools/libfsimage/reiserfs/fsys_reiserfs.c @@ -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; diff --git a/tools/libfsimage/ufs/fsys_ufs.c b/tools/libfsimage/ufs/fsys_ufs.c --- a/tools/libfsimage/ufs/fsys_ufs.c +++ b/tools/libfsimage/ufs/fsys_ufs.c @@ -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) || diff --git a/tools/pygrub/src/fsimage/fsimage.c b/tools/pygrub/src/fsimage/fsimage.c --- a/tools/pygrub/src/fsimage/fsimage.c +++ b/tools/pygrub/src/fsimage/fsimage.c @@ -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, _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |