aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libfsimage/common
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/libfsimage/common
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/libfsimage/common')
-rw-r--r--tools/libfsimage/common/fsimage.c29
-rw-r--r--tools/libfsimage/common/fsimage.h6
-rw-r--r--tools/libfsimage/common/fsimage_grub.c4
-rw-r--r--tools/libfsimage/common/fsimage_grub.h8
-rw-r--r--tools/libfsimage/common/fsimage_priv.h3
-rw-r--r--tools/libfsimage/common/mapfile-GNU3
-rw-r--r--tools/libfsimage/common/mapfile-SunOS3
7 files changed, 51 insertions, 5 deletions
diff --git a/tools/libfsimage/common/fsimage.c b/tools/libfsimage/common/fsimage.c
index 4a1431751d..21d6c38ac6 100644
--- a/tools/libfsimage/common/fsimage.c
+++ b/tools/libfsimage/common/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.
*/
@@ -51,6 +51,7 @@ fsi_t *fsi_open_fsimage(const char *path, uint64_t off, const char *options)
fsi->f_fd = fd;
fsi->f_off = off;
fsi->f_data = NULL;
+ fsi->f_bootstring = NULL;
pthread_mutex_lock(&fsi_lock);
err = find_plugin(fsi, path, options);
@@ -140,3 +141,29 @@ ssize_t fsi_pread_file(fsi_file_t *ffi, void *buf, size_t nbytes, uint64_t off)
return (ret);
}
+
+char *
+fsi_bootstring_alloc(fsi_t *fsi, size_t len)
+{
+ fsi->f_bootstring = malloc(len);
+ if (fsi->f_bootstring == NULL)
+ return (NULL);
+
+ bzero(fsi->f_bootstring, len);
+ return (fsi->f_bootstring);
+}
+
+void
+fsi_bootstring_free(fsi_t *fsi)
+{
+ if (fsi->f_bootstring != NULL) {
+ free(fsi->f_bootstring);
+ fsi->f_bootstring = NULL;
+ }
+}
+
+char *
+fsi_fs_bootstring(fsi_t *fsi)
+{
+ return (fsi->f_bootstring);
+}
diff --git a/tools/libfsimage/common/fsimage.h b/tools/libfsimage/common/fsimage.h
index ad305b5dae..201abd54f2 100644
--- a/tools/libfsimage/common/fsimage.h
+++ b/tools/libfsimage/common/fsimage.h
@@ -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.
*/
@@ -45,6 +45,10 @@ int fsi_close_file(fsi_file_t *);
ssize_t fsi_read_file(fsi_file_t *, void *, size_t);
ssize_t fsi_pread_file(fsi_file_t *, void *, size_t, uint64_t);
+char *fsi_bootstring_alloc(fsi_t *, size_t);
+void fsi_bootstring_free(fsi_t *);
+char *fsi_fs_bootstring(fsi_t *);
+
#ifdef __cplusplus
};
#endif
diff --git a/tools/libfsimage/common/fsimage_grub.c b/tools/libfsimage/common/fsimage_grub.c
index 9ea2e35ac6..c58790d523 100644
--- a/tools/libfsimage/common/fsimage_grub.c
+++ b/tools/libfsimage/common/fsimage_grub.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.
*/
@@ -286,6 +286,7 @@ fsig_mount(fsi_t *fsi, const char *path, const char *options)
if (!ops->fpo_mount(ffi, options)) {
fsip_file_free(ffi);
+ fsi_bootstring_free(fsi);
free(fsi->f_data);
fsi->f_data = NULL;
return (-1);
@@ -299,6 +300,7 @@ fsig_mount(fsi_t *fsi, const char *path, const char *options)
static int
fsig_umount(fsi_t *fsi)
{
+ fsi_bootstring_free(fsi);
free(fsi->f_data);
return (0);
}
diff --git a/tools/libfsimage/common/fsimage_grub.h b/tools/libfsimage/common/fsimage_grub.h
index bca481bc28..11684d3e1f 100644
--- a/tools/libfsimage/common/fsimage_grub.h
+++ b/tools/libfsimage/common/fsimage_grub.h
@@ -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.
*/
@@ -72,6 +72,12 @@ unsigned long fsig_log2(unsigned long);
#define ERR_FILELENGTH 1
#define ERR_BAD_FILETYPE 1
#define ERR_FILE_NOT_FOUND 1
+#define ERR_BAD_ARGUMENT 1
+#define ERR_FILESYSTEM_NOT_FOUND 1
+#define ERR_NO_BOOTPATH 1
+#define ERR_DEV_VALUES 1
+#define ERR_WONT_FIT 1
+#define ERR_READ 1
fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *);
diff --git a/tools/libfsimage/common/fsimage_priv.h b/tools/libfsimage/common/fsimage_priv.h
index 441b71930a..57a0826dee 100644
--- a/tools/libfsimage/common/fsimage_priv.h
+++ b/tools/libfsimage/common/fsimage_priv.h
@@ -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.
*/
@@ -46,6 +46,7 @@ struct fsi {
uint64_t f_off;
void *f_data;
fsi_plugin_t *f_plugin;
+ char *f_bootstring;
};
struct fsi_file {
diff --git a/tools/libfsimage/common/mapfile-GNU b/tools/libfsimage/common/mapfile-GNU
index ced9ade69c..26d4d7a69e 100644
--- a/tools/libfsimage/common/mapfile-GNU
+++ b/tools/libfsimage/common/mapfile-GNU
@@ -8,6 +8,9 @@ VERSION {
fsi_close_file;
fsi_read_file;
fsi_pread_file;
+ fsi_bootstring_alloc;
+ fsi_bootstring_free;
+ fsi_fs_bootstring;
fsip_fs_set_data;
fsip_file_alloc;
diff --git a/tools/libfsimage/common/mapfile-SunOS b/tools/libfsimage/common/mapfile-SunOS
index 21ef67605a..e99b90b650 100644
--- a/tools/libfsimage/common/mapfile-SunOS
+++ b/tools/libfsimage/common/mapfile-SunOS
@@ -7,6 +7,9 @@ libfsimage.so.1.0 {
fsi_close_file;
fsi_read_file;
fsi_pread_file;
+ fsi_bootstring_alloc;
+ fsi_bootstring_free;
+ fsi_fs_bootstring;
fsip_fs_set_data;
fsip_file_alloc;