[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Filesystem implementations may need optional arguments in terms of



# HG changeset patch
# User john.levon@xxxxxxx
# Date 1171946682 28800
# Node ID 89ca591a2c211caf487d20261692ef4a40170cf7
# Parent  b83cfb117bddc1f44be53bde49d86b5075bdaa2a
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>
---
 tools/libfsimage/common/fsimage.c         |    4 ++--
 tools/libfsimage/common/fsimage.h         |    2 +-
 tools/libfsimage/common/fsimage_grub.c    |    4 ++--
 tools/libfsimage/common/fsimage_grub.h    |    2 +-
 tools/libfsimage/common/fsimage_plugin.c  |    4 ++--
 tools/libfsimage/common/fsimage_plugin.h  |    2 +-
 tools/libfsimage/common/fsimage_priv.h    |    2 +-
 tools/libfsimage/ext2fs-lib/ext2fs-lib.c  |    2 +-
 tools/libfsimage/ext2fs/fsys_ext2fs.c     |    2 +-
 tools/libfsimage/reiserfs/fsys_reiserfs.c |    2 +-
 tools/libfsimage/ufs/fsys_ufs.c           |    2 +-
 tools/pygrub/src/fsimage/fsimage.c        |   14 ++++++++------
 12 files changed, 22 insertions(+), 20 deletions(-)

diff -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/common/fsimage.c
--- a/tools/libfsimage/common/fsimage.c Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/common/fsimage.c Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/common/fsimage.h
--- a/tools/libfsimage/common/fsimage.h Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/common/fsimage.h Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/common/fsimage_grub.c
--- a/tools/libfsimage/common/fsimage_grub.c    Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/common/fsimage_grub.c    Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/common/fsimage_grub.h
--- a/tools/libfsimage/common/fsimage_grub.h    Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/common/fsimage_grub.h    Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/common/fsimage_plugin.c
--- a/tools/libfsimage/common/fsimage_plugin.c  Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/common/fsimage_plugin.c  Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/common/fsimage_plugin.h
--- a/tools/libfsimage/common/fsimage_plugin.h  Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/common/fsimage_plugin.h  Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/common/fsimage_priv.h
--- a/tools/libfsimage/common/fsimage_priv.h    Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/common/fsimage_priv.h    Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/ext2fs-lib/ext2fs-lib.c
--- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c  Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c  Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/ext2fs/fsys_ext2fs.c
--- a/tools/libfsimage/ext2fs/fsys_ext2fs.c     Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/ext2fs/fsys_ext2fs.c     Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/reiserfs/fsys_reiserfs.c
--- a/tools/libfsimage/reiserfs/fsys_reiserfs.c Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/reiserfs/fsys_reiserfs.c Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/libfsimage/ufs/fsys_ufs.c
--- a/tools/libfsimage/ufs/fsys_ufs.c   Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/libfsimage/ufs/fsys_ufs.c   Mon Feb 19 20:44:42 2007 -0800
@@ -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 -r b83cfb117bdd -r 89ca591a2c21 tools/pygrub/src/fsimage/fsimage.c
--- a/tools/pygrub/src/fsimage/fsimage.c        Mon Feb 19 22:50:07 2007 +0000
+++ b/tools/pygrub/src/fsimage/fsimage.c        Mon Feb 19 20:44:42 2007 -0800
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.