From af4249ff59ced3014325f00813dfaa4f9acaeb2b Mon Sep 17 00:00:00 2001 From: Mark Pryor Date: Mon, 13 May 2019 17:11:00 -0700 Subject: [PATCH] tools/libfsimage: revert namespace changes to fsimage Signed-off-by: Mark Pryor --- diff -rNub a/tools/libfsimage/common/fsimage.c b/tools/libfsimage/common/fsimage.c --- a/tools/libfsimage/common/fsimage.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/fsimage.c 2018-11-29 06:04:11.000000000 -0800 @@ -31,7 +31,7 @@ #include #include -#include "xenfsimage_plugin.h" +#include "fsimage_plugin.h" #include "fsimage_priv.h" static pthread_mutex_t fsi_lock = PTHREAD_MUTEX_INITIALIZER; diff -rNub a/tools/libfsimage/common/fsimage_grub.c b/tools/libfsimage/common/fsimage_grub.c --- a/tools/libfsimage/common/fsimage_grub.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/fsimage_grub.c 2018-11-29 06:04:11.000000000 -0800 @@ -28,7 +28,7 @@ #include #include -#include "xenfsimage_grub.h" +#include "fsimage_grub.h" #include "fsimage_priv.h" static char *disk_read_junk; diff -rNub a/tools/libfsimage/common/fsimage_grub.h b/tools/libfsimage/common/fsimage_grub.h --- a/tools/libfsimage/common/fsimage_grub.h 1969-12-31 16:00:00.000000000 -0800 +++ b/tools/libfsimage/common/fsimage_grub.h 2018-11-29 06:04:11.000000000 -0800 @@ -0,0 +1,102 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _FSIMAGE_GRUB_H +#define _FSIMAGE_GRUB_H + +#ifdef __cplusplus +extern C { +#endif + +#include +#include +#include +#include + +#include "fsimage.h" +#include "fsimage_plugin.h" + +typedef struct fsig_plugin_ops { + int fpo_version; + 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; + +#define STAGE1_5 +#define FSYS_BUFLEN 0x40000 +#define SECTOR_BITS 9 +#define SECTOR_SIZE 0x200 + +#define FSYS_BUF (fsig_file_buf(ffi)) +#define filepos (*fsig_filepos(ffi)) +#define filemax (*fsig_filemax(ffi)) +#define devread fsig_devread +#define substring fsig_substring +#define errnum (*fsig_errnum(ffi)) +#define disk_read_func (*fsig_disk_read_junk()) +#define disk_read_hook (*fsig_disk_read_junk()) +#define print_possibilities 0 +#define noisy_printf(fmt...) + +#define grub_memset memset +#define grub_memmove memmove +#define grub_log2 fsig_log2 + +extern char **fsig_disk_read_junk(void); +unsigned long fsig_log2(unsigned long); + +#define ERR_FSYS_CORRUPT 1 +#define ERR_OUTSIDE_PART 1 +#define ERR_SYMLINK_LOOP 1 +#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 +#define ERR_NEWER_VERSION 1 + +fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *); + +int fsig_devread(fsi_file_t *, unsigned int, unsigned int, unsigned int, char *); +int fsig_substring(const char *, const char *); + +void *fsig_fs_buf(fsi_t *); + +fsi_file_t *fsig_file_alloc(fsi_t *); +void *fsig_file_buf(fsi_file_t *); +uint64_t *fsig_filepos(fsi_file_t *); +uint64_t *fsig_filemax(fsi_file_t *); +int *fsig_int1(fsi_file_t *); +int *fsig_int2(fsi_file_t *); +int *fsig_errnum(fsi_file_t *); + +#ifdef __cplusplus +}; +#endif + +#endif /* _FSIMAGE_GRUB_H */ diff -rNub a/tools/libfsimage/common/fsimage.h b/tools/libfsimage/common/fsimage.h --- a/tools/libfsimage/common/fsimage.h 1969-12-31 16:00:00.000000000 -0800 +++ b/tools/libfsimage/common/fsimage.h 2018-11-29 06:04:11.000000000 -0800 @@ -0,0 +1,56 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _FSIMAGE_H +#define _FSIMAGE_H + +#ifdef __cplusplus +extern C { +#endif + +#include +#include +#include + +typedef struct fsi fsi_t; +typedef struct fsi_file fsi_file_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 *); +fsi_file_t *fsi_open_file(fsi_t *, const char *); +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 + +#endif /* _FSIMAGE_H */ diff -rNub a/tools/libfsimage/common/fsimage_plugin.c b/tools/libfsimage/common/fsimage_plugin.c --- a/tools/libfsimage/common/fsimage_plugin.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/fsimage_plugin.c 2018-11-29 06:04:11.000000000 -0800 @@ -29,7 +29,7 @@ #include #include -#include "xenfsimage_plugin.h" +#include "fsimage_plugin.h" #include "fsimage_priv.h" static fsi_plugin_t *plugins; lugin_t *plugins; diff -rNub a/tools/libfsimage/common/fsimage_plugin.h b/tools/libfsimage/common/fsimage_plugin.h --- a/tools/libfsimage/common/fsimage_plugin.h 1969-12-31 16:00:00.000000000 -0800 +++ b/tools/libfsimage/common/fsimage_plugin.h 2018-11-29 06:04:11.000000000 -0800 @@ -0,0 +1,64 @@ +/* + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * 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. + * Use is subject to license terms. + */ + +#ifndef _FSIMAGE_PLUGIN_H +#define _FSIMAGE_PLUGIN_H + +#ifdef __cplusplus +extern C { +#endif + +#include + +#include "fsimage.h" + +#define FSIMAGE_PLUGIN_VERSION 1 + +typedef struct fsi_plugin fsi_plugin_t; + +typedef struct fsi_plugin_ops { + int fpo_version; + 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); + ssize_t (*fpo_pread)(fsi_file_t *, void *, size_t, uint64_t); + int (*fpo_close)(fsi_file_t *); +} fsi_plugin_ops_t; + +typedef fsi_plugin_ops_t * + (*fsi_plugin_init_t)(int, fsi_plugin_t *, const char **); + +void fsip_fs_set_data(fsi_t *, void *); +fsi_file_t *fsip_file_alloc(fsi_t *, void *); +void fsip_file_free(fsi_file_t *); +fsi_t *fsip_fs(fsi_file_t *); +uint64_t fsip_fs_offset(fsi_t *); +void *fsip_fs_data(fsi_t *); +void *fsip_file_data(fsi_file_t *); + +#ifdef __cplusplus +}; +#endif + +#endif /* _FSIMAGE_PLUGIN_H */ diff -rNub a/tools/libfsimage/common/fsimage_priv.h b/tools/libfsimage/common/fsimage_priv.h --- a/tools/libfsimage/common/fsimage_priv.h 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/fsimage_priv.h 2018-11-29 06:04:11.000000000 -0800 @@ -30,8 +30,8 @@ #include -#include "xenfsimage.h" -#include "xenfsimage_plugin.h" +#include "fsimage.h" +#include "fsimage_plugin.h" struct fsi_plugin { const char *fp_name; diff -rNub a/tools/libfsimage/common/Makefile b/tools/libfsimage/common/Makefile --- a/tools/libfsimage/common/Makefile 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/Makefile 2018-11-29 06:04:11.000000000 -0800 @@ -13,7 +13,7 @@ LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c -TARGETS = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR) +TARGETS = libfsimage.so libfsimage.so.$(MAJOR) libfsimage.so.$(MAJOR).$(MINOR) .PHONY: all all: $(TARGETS) @@ -22,29 +22,29 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(libdir) $(INSTALL_DIR) $(DESTDIR)$(includedir) - $(INSTALL_PROG) libxenfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir) - ln -sf libxenfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR) - ln -sf libxenfsimage.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenfsimage.so - $(INSTALL_DATA) xenfsimage.h $(DESTDIR)$(includedir) - $(INSTALL_DATA) xenfsimage_plugin.h $(DESTDIR)$(includedir) - $(INSTALL_DATA) xenfsimage_grub.h $(DESTDIR)$(includedir) + $(INSTALL_PROG) libfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir) + ln -sf libfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libfsimage.so.$(MAJOR) + ln -sf libfsimage.so.$(MAJOR) $(DESTDIR)$(libdir)/libfsimage.so + $(INSTALL_DATA) fsimage.h $(DESTDIR)$(includedir) + $(INSTALL_DATA) fsimage_plugin.h $(DESTDIR)$(includedir) + $(INSTALL_DATA) fsimage_grub.h $(DESTDIR)$(includedir) .PHONY: uninstall uninstall: - rm -f $(DESTDIR)$(includedir)/xenfsimage_grub.h - rm -f $(DESTDIR)$(includedir)/xenfsimage_plugin.h - rm -f $(DESTDIR)$(includedir)/xenfsimage.h - rm -f $(DESTDIR)$(libdir)/libxenfsimage.so - rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR) - rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR).$(MINOR) + rm -f $(DESTDIR)$(includedir)/fsimage_grub.h + rm -f $(DESTDIR)$(includedir)/fsimage_plugin.h + rm -f $(DESTDIR)$(includedir)/fsimage.h + rm -f $(DESTDIR)$(libdir)/libfsimage.so + rm -f $(DESTDIR)$(libdir)/libfsimage.so.$(MAJOR) + rm -f $(DESTDIR)$(libdir)/libfsimage.so.$(MAJOR).$(MINOR) -libxenfsimage.so: libxenfsimage.so.$(MAJOR) +libfsimage.so: libfsimage.so.$(MAJOR) ln -sf $< $@ -libxenfsimage.so.$(MAJOR): libxenfsimage.so.$(MAJOR).$(MINOR) +libfsimage.so.$(MAJOR): libfsimage.so.$(MAJOR).$(MINOR) ln -sf $< $@ -libxenfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS) - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) $(APPEND_LDFLAGS) +libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) $(APPEND_LDFLAGS) -include $(DEPS_INCLUDE) diff -rNub a/tools/libfsimage/common/xenfsimage_grub.h b/tools/libfsimage/common/xenfsimage_grub.h --- a/tools/libfsimage/common/xenfsimage_grub.h 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/xenfsimage_grub.h 1969-12-31 16:00:00.000000000 -0800 @@ -1,102 +0,0 @@ -/* - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _FSIMAGE_GRUB_H -#define _FSIMAGE_GRUB_H - -#ifdef __cplusplus -extern C { -#endif - -#include -#include -#include -#include - -#include "xenfsimage.h" -#include "xenfsimage_plugin.h" - -typedef struct fsig_plugin_ops { - int fpo_version; - 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; - -#define STAGE1_5 -#define FSYS_BUFLEN 0x40000 -#define SECTOR_BITS 9 -#define SECTOR_SIZE 0x200 - -#define FSYS_BUF (fsig_file_buf(ffi)) -#define filepos (*fsig_filepos(ffi)) -#define filemax (*fsig_filemax(ffi)) -#define devread fsig_devread -#define substring fsig_substring -#define errnum (*fsig_errnum(ffi)) -#define disk_read_func (*fsig_disk_read_junk()) -#define disk_read_hook (*fsig_disk_read_junk()) -#define print_possibilities 0 -#define noisy_printf(fmt...) - -#define grub_memset memset -#define grub_memmove memmove -#define grub_log2 fsig_log2 - -extern char **fsig_disk_read_junk(void); -unsigned long fsig_log2(unsigned long); - -#define ERR_FSYS_CORRUPT 1 -#define ERR_OUTSIDE_PART 1 -#define ERR_SYMLINK_LOOP 1 -#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 -#define ERR_NEWER_VERSION 1 - -fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *); - -int fsig_devread(fsi_file_t *, unsigned int, unsigned int, unsigned int, char *); -int fsig_substring(const char *, const char *); - -void *fsig_fs_buf(fsi_t *); - -fsi_file_t *fsig_file_alloc(fsi_t *); -void *fsig_file_buf(fsi_file_t *); -uint64_t *fsig_filepos(fsi_file_t *); -uint64_t *fsig_filemax(fsi_file_t *); -int *fsig_int1(fsi_file_t *); -int *fsig_int2(fsi_file_t *); -int *fsig_errnum(fsi_file_t *); - -#ifdef __cplusplus -}; -#endif - -#endif /* _FSIMAGE_GRUB_H */ diff -rNub a/tools/libfsimage/common/xenfsimage.h b/tools/libfsimage/common/xenfsimage.h --- a/tools/libfsimage/common/xenfsimage.h 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/xenfsimage.h 1969-12-31 16:00:00.000000000 -0800 @@ -1,56 +0,0 @@ -/* - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _FSIMAGE_H -#define _FSIMAGE_H - -#ifdef __cplusplus -extern C { -#endif - -#include -#include -#include - -typedef struct fsi fsi_t; -typedef struct fsi_file fsi_file_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 *); -fsi_file_t *fsi_open_file(fsi_t *, const char *); -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 - -#endif /* _FSIMAGE_H */ diff -rNub a/tools/libfsimage/common/xenfsimage_plugin.h b/tools/libfsimage/common/xenfsimage_plugin.h --- a/tools/libfsimage/common/xenfsimage_plugin.h 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/common/xenfsimage_plugin.h 1969-12-31 16:00:00.000000000 -0800 @@ -1,64 +0,0 @@ -/* - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * 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. - * Use is subject to license terms. - */ - -#ifndef _FSIMAGE_PLUGIN_H -#define _FSIMAGE_PLUGIN_H - -#ifdef __cplusplus -extern C { -#endif - -#include - -#include "xenfsimage.h" - -#define FSIMAGE_PLUGIN_VERSION 1 - -typedef struct fsi_plugin fsi_plugin_t; - -typedef struct fsi_plugin_ops { - int fpo_version; - 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); - ssize_t (*fpo_pread)(fsi_file_t *, void *, size_t, uint64_t); - int (*fpo_close)(fsi_file_t *); -} fsi_plugin_ops_t; - -typedef fsi_plugin_ops_t * - (*fsi_plugin_init_t)(int, fsi_plugin_t *, const char **); - -void fsip_fs_set_data(fsi_t *, void *); -fsi_file_t *fsip_file_alloc(fsi_t *, void *); -void fsip_file_free(fsi_file_t *); -fsi_t *fsip_fs(fsi_file_t *); -uint64_t fsip_fs_offset(fsi_t *); -void *fsip_fs_data(fsi_t *); -void *fsip_file_data(fsi_file_t *); - -#ifdef __cplusplus -}; -#endif - -#endif /* _FSIMAGE_PLUGIN_H */ diff -rNub a/tools/libfsimage/ext2fs/fsys_ext2fs.c b/tools/libfsimage/ext2fs/fsys_ext2fs.c --- a/tools/libfsimage/ext2fs/fsys_ext2fs.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/ext2fs/fsys_ext2fs.c 2018-11-29 06:04:11.000000000 -0800 @@ -16,7 +16,7 @@ * along with this program; If not, see . */ -#include +#include #define mapblock1 (*fsig_int1(ffi)) #define mapblock2 (*fsig_int2(ffi)) diff -rNub a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c --- a/tools/libfsimage/ext2fs-lib/ext2fs-lib.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/ext2fs-lib/ext2fs-lib.c 2018-11-29 06:04:11.000000000 -0800 @@ -21,7 +21,7 @@ * Use is subject to license terms. */ -#include +#include #include INCLUDE_EXTFS_H #include #include diff -rNub a/tools/libfsimage/fat/fsys_fat.c b/tools/libfsimage/fat/fsys_fat.c --- a/tools/libfsimage/fat/fsys_fat.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/fat/fsys_fat.c 2018-11-29 06:04:11.000000000 -0800 @@ -17,7 +17,7 @@ */ #include -#include +#include #include "fat.h" struct fat_superblock diff -rNub a/tools/libfsimage/iso9660/fsys_iso9660.c b/tools/libfsimage/iso9660/fsys_iso9660.c --- a/tools/libfsimage/iso9660/fsys_iso9660.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/iso9660/fsys_iso9660.c 2018-11-29 06:04:11.000000000 -0800 @@ -28,7 +28,7 @@ * Leonid Lisovskiy 2003 */ -#include +#include #include #include "iso9660.h" diff -rNub a/tools/libfsimage/reiserfs/fsys_reiserfs.c b/tools/libfsimage/reiserfs/fsys_reiserfs.c --- a/tools/libfsimage/reiserfs/fsys_reiserfs.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/reiserfs/fsys_reiserfs.c 2018-11-29 06:04:11.000000000 -0800 @@ -17,7 +17,7 @@ * along with this program; If not, see . */ -#include +#include #undef REISERDEBUG diff -rNub a/tools/libfsimage/Rules.mk b/tools/libfsimage/Rules.mk --- a/tools/libfsimage/Rules.mk 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/Rules.mk 2018-11-29 06:04:11.000000000 -0800 @@ -19,6 +19,6 @@ fi $(FSLIB): $(PIC_OBJS) - $(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lxenfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS) + $(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS) -include $(DEPS_INCLUDE) diff -rNub a/tools/libfsimage/ufs/fsys_ufs.c b/tools/libfsimage/ufs/fsys_ufs.c --- a/tools/libfsimage/ufs/fsys_ufs.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/ufs/fsys_ufs.c 2018-11-29 06:04:11.000000000 -0800 @@ -22,7 +22,7 @@ /* From Solaris usr/src/stand/lib/fs/ufs/ufsops.c */ -#include +#include #include "ufs.h" diff -rNub a/tools/libfsimage/xfs/fsys_xfs.c b/tools/libfsimage/xfs/fsys_xfs.c --- a/tools/libfsimage/xfs/fsys_xfs.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/xfs/fsys_xfs.c 2018-11-29 06:04:11.000000000 -0800 @@ -17,7 +17,7 @@ * along with this program; If not, see . */ -#include +#include #include "xfs.h" #define MAX_LINK_COUNT 8 diff -rNub a/tools/libfsimage/zfs/fsi_zfs.c b/tools/libfsimage/zfs/fsi_zfs.c --- a/tools/libfsimage/zfs/fsi_zfs.c 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/zfs/fsi_zfs.c 2018-11-29 06:04:11.000000000 -0800 @@ -22,7 +22,7 @@ #ifdef FSYS_ZFS -#include +#include #include #include #include diff -rNub a/tools/libfsimage/zfs/fsi_zfs.h b/tools/libfsimage/zfs/fsi_zfs.h --- a/tools/libfsimage/zfs/fsi_zfs.h 2019-01-16 08:13:49.000000000 -0800 +++ b/tools/libfsimage/zfs/fsi_zfs.h 2018-11-29 06:04:11.000000000 -0800 @@ -27,7 +27,7 @@ #include #include #include -#include +#include /*** START FROM shared.h ****/