aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub/src/fsimage
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-05-01 16:38:56 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-05-01 16:38:56 +0100
commit622e368758b626b4567237395e5217761efb43d8 (patch)
tree84dc079d5cd0527975c092816ecb259f7f21ae34 /tools/pygrub/src/fsimage
parent3e3b5e2b2aa8a64f6520876a310d040784f5f6bf (diff)
downloadxen-622e368758b626b4567237395e5217761efb43d8.tar.gz
xen-622e368758b626b4567237395e5217761efb43d8.tar.bz2
xen-622e368758b626b4567237395e5217761efb43d8.zip
Add ZFS libfsimage support patch
Add support to pygrub and libfsimage to boot ZFS root filesystems. Boot argument of zfs-bootfs is set to describe ZFS root pool and boot filesystem object number. Boot argument bootpath is set to describe the virtual device root mirror components. Signed-off-by: Susan Kamm-Worrell <susan.kamm-worrell@sun.com>
Diffstat (limited to 'tools/pygrub/src/fsimage')
-rw-r--r--tools/pygrub/src/fsimage/fsimage.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/tools/pygrub/src/fsimage/fsimage.c b/tools/pygrub/src/fsimage/fsimage.c
index 21f9411c25..8ec0dec346 100644
--- a/tools/pygrub/src/fsimage/fsimage.c
+++ b/tools/pygrub/src/fsimage/fsimage.c
@@ -17,7 +17,7 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -281,6 +281,22 @@ fsimage_open(PyObject *o, PyObject *args, PyObject *kwargs)
return (PyObject *)fs;
}
+static PyObject *
+fsimage_getbootstring(PyObject *o, PyObject *args)
+{
+ PyObject *fs;
+ char *bootstring;
+ fsi_t *fsi;
+
+ if (!PyArg_ParseTuple(args, "O", &fs))
+ return (NULL);
+
+ fsi = ((fsimage_fs_t *)fs)->fs;
+ bootstring = fsi_fs_bootstring(fsi);
+
+ return Py_BuildValue("s", bootstring);
+}
+
PyDoc_STRVAR(fsimage_open__doc__,
"open(name, [offset=off]) - Open the given file as a filesystem image.\n"
"\n"
@@ -288,9 +304,15 @@ PyDoc_STRVAR(fsimage_open__doc__,
"offset - offset of file system within file image.\n"
"options - mount options string.\n");
+PyDoc_STRVAR(fsimage_getbootstring__doc__,
+ "getbootstring(fs) - Return the boot string needed for this file system "
+ "or NULL if none is needed.\n");
+
static struct PyMethodDef fsimage_module_methods[] = {
{ "open", (PyCFunction)fsimage_open,
METH_VARARGS|METH_KEYWORDS, fsimage_open__doc__ },
+ { "getbootstring", (PyCFunction)fsimage_getbootstring,
+ METH_VARARGS, fsimage_getbootstring__doc__ },
{ NULL, NULL, 0, NULL }
};