Add ZFS libfsimage support patch
PATCH 1/1 Add ZFS libfsimage support patch
# HG changeset patch
# User [email protected]
# Date 1209521787 25200
# Node ID 51023851f6401182c0c2c200716e5bfcc8f14002 # Parent 7aabc2f601717f031b29cc219bcd80d04616575a 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.
tools/libfsimage/Makefile +1 -1
@@ -1,7 +1,7 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -SUBDIRS-y = common ufs reiserfs iso9660 fat +SUBDIRS-y = common ufs reiserfs iso9660 fat zfs SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs) .PHONY: all clean install
tools/libfsimage/common/fsimage.c +28 -1
@@ -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 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,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); +}
tools/libfsimage/common/fsimage.h +5 -1
@@ -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 @@ ssize_t fsi_read_file(fsi_file_t *, voidssize_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
tools/libfsimage/common/fsimage_grub.c +3 -1
@@ -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,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 @@ static intstatic int fsig_umount (fsi_t *fsi) { +fsi_bootstring_free (fsi);free (fsi->f_data);return (0 ); }
tools/libfsimage/common/fsimage_grub.h +7 -1
@@ -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 1fsi_plugin_ops_t *fsig_init (fsi_plugin_t *,fsig_plugin_ops_t *);
tools/libfsimage/common/fsimage_priv.h +2 -1
@@ -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 {
tools/libfsimage/common/mapfile-GNU +3 -0
@@ -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;
tools/libfsimage/common/mapfile-SunOS +3 -0
@@ -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;
tools/libfsimage/zfs/Makefile new file +37 -0
@@ -0,0 +1,37 @@ +# +# GRUB -- GRand Unified Bootloader +# Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +XEN_ROOT = ../../.. + +LIB_SRCS-y = fsys_zfs.c zfs_lzjb.c zfs_sha256.c zfs_fletcher.c + +FS = zfs + +.PHONY: all +all: fs-all + +.PHONY: install +install: fs-install + +include $(XEN_ROOT)/tools/libfsimage/Rules.mk
tools/libfsimage/zfs/fsys_zfs.c new file +1457 -0
1,457 lines not on this page · raw message
tools/libfsimage/zfs/fsys_zfs.h new file +203 -0
203 lines not on this page · raw message
tools/libfsimage/zfs/mb_info.h new file +217 -0
217 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/dmu.h new file +105 -0
105 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/dmu_objset.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +/* +* Copyright 2007 Sun Microsystems, Inc. All rights reserved. +* Use is subject to license terms. +*/ + +#ifndef _SYS_DMU_OBJSET_H +#define _SYS_DMU_OBJSET_H + +typedef struct objset_phys { +dnode_phys_t os_meta_dnode; +zil_header_t os_zil_header; +uint64_t os_type; +char os_pad[1024 -sizeof (dnode_phys_t) -sizeof (zil_header_t) - +sizeof (uint64_t )]; +}objset_phys_t ; + +#endif /* _SYS_DMU_OBJSET_H */
tools/libfsimage/zfs/zfs-include/dnode.h new file +76 -0
76 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/dsl_dataset.h new file +53 -0
53 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/dsl_dir.h new file +49 -0
49 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/spa.h new file +283 -0
283 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/uberblock_impl.h new file +49 -0
49 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/vdev_impl.h new file +70 -0
70 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zap_impl.h new file +110 -0
110 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zap_leaf.h new file +100 -0
100 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zfs.h new file +112 -0
11 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zfs_acl.h new file +60 -0
60 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zfs_znode.h new file +68 -0
68 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zil.h new file +51 -0
51 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zio.h new file +81 -0
81 lines not on this page · raw message
tools/libfsimage/zfs/zfs-include/zio_checksum.h new file +42 -0
42 lines not on this page · raw message
tools/libfsimage/zfs/zfs_fletcher.c new file +93 -0
93 lines not on this page · raw message
tools/libfsimage/zfs/zfs_lzjb.c new file +60 -0
60 lines not on this page · raw message
tools/libfsimage/zfs/zfs_sha256.c new file +124 -0
124 lines not on this page · raw message
tools/pygrub/src/fsimage/fsimage.c +23 -1
Lines of this file are not shown. View the raw message.
tools/pygrub/src/pygrub +16 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 1/1 fix libfsimage xfs compilation fix (was Re: [PATCH] Add ZFS libfsimage support patch)
# HG changeset patch
# User Isaku Yamahata <[email protected]> # Date 1209698086 -32400
# Node ID 96a1821bb35598ba14345e616c9bdd8b09f090c1 # Parent 64f790e90d3d4797e298cc5abdfc54cb943687f3 [libfsimage/zfs] compilation fix ZFS libfsimage support.
Depending on environments, zfs libfsimage support doesn't compile. This patch fixes it.
ia64-linux-gnu-gcc -DPIC -O2 -fomit-frame-pointer -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -I/usr/ia64-linux-gnu/sys-root/usr/include -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I../../../tools/libfsimage/common/ -Werror -Wp,-MD,.zfs_lzjb.opic.d -fPIC -c -o zfs_lzjb.opic zfs_lzjb.c In file included from fsys_zfs.h:41,
from zfs_lzjb.c:25:
zfs-include/zfs_acl.h:29: error: redefinition of typedef uid_t /usr/ia64-linux-gnu/sys-root/usr/include/sys/types.h:82: error: previous declaration of uid_t was here
This depends on how __uid_t is defined in the system header. No file under the zfs directory uses uid_t so that just removing the definition in the zfs_acl.h looks reasonable.
tools/libfsimage/zfs/zfs-include/zfs_acl.h +0 -5
@@ -23,11 +23,6 @@ #ifndef _SYS_FS_ZFS_ACL_H #define _SYS_FS_ZFS_ACL_H - -#ifndef _UID_T -#define _UID_T -typedef unsigned int uid_t; /* UID type */ -#endif /* _UID_T */ typedef struct zfs_oldace { uint32_t z_fuid; /* "who" */
Signature · 1 line
yamahata
# HG changeset patch
# User Isaku Yamahata <[email protected]> # Date 1209698086 -32400
# Node ID 96a1821bb35598ba14345e616c9bdd8b09f090c1 # Parent 64f790e90d3d4797e298cc5abdfc54cb943687f3 [libfsimage/zfs] compilation fix ZFS libfsimage support.
Depending on environments, zfs libfsimage support doesn't compile. This patch fixes it.
ia64-linux-gnu-gcc -DPIC -O2 -fomit-frame-pointer -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -I/usr/ia64-linux-gnu/sys-root/usr/include -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I../../../tools/libfsimage/common/ -Werror -Wp,-MD,.zfs_lzjb.opic.d -fPIC -c -o zfs_lzjb.opic zfs_lzjb.c In file included from fsys_zfs.h:41,
from zfs_lzjb.c:25:
zfs-include/zfs_acl.h:29: error: redefinition of typedef uid_t /usr/ia64-linux-gnu/sys-root/usr/include/sys/types.h:82: error: previous declaration of uid_t was here
This depends on how __uid_t is defined in the system header. No file under the zfs directory uses uid_t so that just removing the definition in the zfs_acl.h looks reasonable.
tools/libfsimage/zfs/zfs-include/zfs_acl.h +0 -5
@@ -23,11 +23,6 @@ #ifndef _SYS_FS_ZFS_ACL_H #define _SYS_FS_ZFS_ACL_H - -#ifndef _UID_T -#define _UID_T -typedef unsigned int uid_t; /* UID type */ -#endif /* _UID_T */ typedef struct zfs_oldace { uint32_t z_fuid; /* "who" */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH] fix libfsimage xfs compilation fix (was Re: [PATCH] Add ZFS libfsimage support patch)
Quoted 1 line · Isaku Yamahata
[libfsimage/zfs] compilation fix ZFS libfsimage support.
Yep, looks fine, thanks.
regards
john