From 607036718c1ff60469477e5e09c6c86e0cca5071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 14 Nov 2013 16:35:15 +0100 Subject: [PATCH] libports: add fuse-ext2 Fixes #942. --- libports/lib/import/import-libext2fs.mk | 1 + libports/lib/mk/libc_fuse_ext2.mk | 20 + libports/lib/mk/libext2fs.mk | 20 + libports/ports/fuse-ext2.inc | 4 + libports/ports/fuse-ext2.mk | 36 ++ libports/run/libc_fuse_ext2.run | 5 + libports/src/lib/fuse-ext2/config.h | 373 ++++++++++++++++++ libports/src/lib/fuse-ext2/init.cc | 78 ++++ .../src/lib/fuse-ext2/patches/bitops.h.patch | 11 + .../src/lib/fuse-ext2/patches/closefs.c.patch | 22 ++ .../src/lib/fuse-ext2/patches/ext2fs.h.patch | 15 + .../lib/fuse-ext2/patches/fuse-ext2.c.patch | 11 + .../lib/fuse-ext2/patches/op_access.c.patch | 11 + .../lib/fuse-ext2/patches/op_statfs.c.patch | 15 + libports/src/test/libc_fuse_ext2/target.mk | 5 + .../src/test/libports/libext2fs/target.mk | 5 + 16 files changed, 632 insertions(+) create mode 100644 libports/lib/import/import-libext2fs.mk create mode 100644 libports/lib/mk/libc_fuse_ext2.mk create mode 100644 libports/lib/mk/libext2fs.mk create mode 100644 libports/ports/fuse-ext2.inc create mode 100644 libports/ports/fuse-ext2.mk create mode 100644 libports/run/libc_fuse_ext2.run create mode 100644 libports/src/lib/fuse-ext2/config.h create mode 100644 libports/src/lib/fuse-ext2/init.cc create mode 100644 libports/src/lib/fuse-ext2/patches/bitops.h.patch create mode 100644 libports/src/lib/fuse-ext2/patches/closefs.c.patch create mode 100644 libports/src/lib/fuse-ext2/patches/ext2fs.h.patch create mode 100644 libports/src/lib/fuse-ext2/patches/fuse-ext2.c.patch create mode 100644 libports/src/lib/fuse-ext2/patches/op_access.c.patch create mode 100644 libports/src/lib/fuse-ext2/patches/op_statfs.c.patch create mode 100644 libports/src/test/libc_fuse_ext2/target.mk create mode 100644 libports/src/test/libports/libext2fs/target.mk diff --git a/libports/lib/import/import-libext2fs.mk b/libports/lib/import/import-libext2fs.mk new file mode 100644 index 0000000000..5b4797d324 --- /dev/null +++ b/libports/lib/import/import-libext2fs.mk @@ -0,0 +1 @@ +REP_INC_DIR += include/fuse-ext2 diff --git a/libports/lib/mk/libc_fuse_ext2.mk b/libports/lib/mk/libc_fuse_ext2.mk new file mode 100644 index 0000000000..a4b1bbc635 --- /dev/null +++ b/libports/lib/mk/libc_fuse_ext2.mk @@ -0,0 +1,20 @@ +include $(REP_DIR)/ports/fuse-ext2.inc +FUSE_EXT2_DIR = $(REP_DIR)/contrib/$(FUSE_EXT2)/fuse-ext2 + +FILTER_OUT = fuse-ext2.probe.c fuse-ext2.wait.c +SRC_C = $(filter-out $(FILTER_OUT), $(notdir $(wildcard $(FUSE_EXT2_DIR)/*.c))) +SRC_CC = init.cc + +LIBS = libc libc_block libc_fuse libfuse libext2fs + +CC_OPT = -DHAVE_CONFIG_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + +CC_CXX_OPT +=-fpermissive + +INC_DIR += $(REP_DIR)/src/lib/fuse-ext2 \ + $(FUSE_EXT2_DIR) + +vpath %.c $(FUSE_EXT2_DIR) +vpath %.cc $(REP_DIR)/src/lib/fuse-ext2 + +SHARED_LIB = yes diff --git a/libports/lib/mk/libext2fs.mk b/libports/lib/mk/libext2fs.mk new file mode 100644 index 0000000000..82d7f0863c --- /dev/null +++ b/libports/lib/mk/libext2fs.mk @@ -0,0 +1,20 @@ +include $(REP_DIR)/ports/fuse-ext2.inc +FUSE_EXT2_DIR = $(REP_DIR)/contrib/$(FUSE_EXT2) +E2FSPROGS_DIR = $(FUSE_EXT2_DIR)/e2fsprogs-1.41.12.newgit +EXT2FS_DIR = $(E2FSPROGS_DIR)/ext2fs +ET_DIR = $(E2FSPROGS_DIR)/et + +FILTER_OUT = bmove.c dosio.c irel_ma.c nt_io.c tdbtool.c +SRC_C = $(filter-out $(FILTER_OUT), $(notdir $(wildcard $(EXT2FS_DIR)/*.c))) +SRC_C += $(notdir $(wildcard $(ET_DIR)/*.c)) + +INC_DIR += $(REP_DIR)/include/fuse-ext2 \ + $(REP_DIR)/src/lib/fuse-ext2 \ + $(ET_DIR) + +CC_OPT += -DHAVE_CONFIG_H -D__BSD_VISIBLE + +LIBS += libc + +vpath %.c $(EXT2FS_DIR) +vpath %.c $(ET_DIR) diff --git a/libports/ports/fuse-ext2.inc b/libports/ports/fuse-ext2.inc new file mode 100644 index 0000000000..9557d1b4ee --- /dev/null +++ b/libports/ports/fuse-ext2.inc @@ -0,0 +1,4 @@ +FUSE_EXT2_REV := 220 +FUSE_EXT2_VERSION := svn-$(FUSE_EXT2_REV) +FUSE_EXT2 := fuse-ext2-$(FUSE_EXT2_VERSION) + diff --git a/libports/ports/fuse-ext2.mk b/libports/ports/fuse-ext2.mk new file mode 100644 index 0000000000..4cc185be5e --- /dev/null +++ b/libports/ports/fuse-ext2.mk @@ -0,0 +1,36 @@ +include ports/fuse-ext2.inc + +FUSE_EXT2_SVN_URL = http://svn.code.sf.net/p/fuse-ext2/code/branch/renzo +EXT2_DIR = e2fsprogs-1.41.12.newgit/ + +# +# Interface to top-level prepare Makefile +# +PORTS += $(FUSE_EXT2) + +prepare-fuse-ext2: $(CONTRIB_DIR)/$(FUSE_EXT2) include/fuse-ext2 + +# +# Port-specific local rules +# +$(CONTRIB_DIR)/$(FUSE_EXT2): + $(ECHO) "checking out 'fuse-ext2 rev. $(FUSE_EXT2_REV)' to '$@'" + $(VERBOSE)svn export $(FUSE_EXT2_SVN_URL)@$(FUSE_EXT2_REV) $@ + $(VERBOSE)for i in src/lib/fuse-ext2/patches/*.patch; do \ + patch -N -p0 < $$i; done || true + +# +# Install fuse-ext2 headers +# +# +include/fuse-ext2: + $(VERBOSE)mkdir -p $@/{e2p,et,ext2fs} + $(VERBOSE)for j in e2p et ext2fs; do \ + for i in `find $(CONTRIB_DIR)/$(FUSE_EXT2)/$(EXT2_DIR)/$$j -name *.h`; do \ + ln -fs ../../../$$i $@/$$j; \ + done; done + +clean-fuse-ext2: + $(VERBOSE)rm -rf include/fuse-ext2 + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(FUSE_EXT2) + diff --git a/libports/run/libc_fuse_ext2.run b/libports/run/libc_fuse_ext2.run new file mode 100644 index 0000000000..a92db5f368 --- /dev/null +++ b/libports/run/libc_fuse_ext2.run @@ -0,0 +1,5 @@ +set mkfs_cmd mkfs.ext2 +set mkfs_opts "-F" +set filesystem fuse_ext2 + +source ${genode_dir}/libports/run/libc_filesystem_test.inc diff --git a/libports/src/lib/fuse-ext2/config.h b/libports/src/lib/fuse-ext2/config.h new file mode 100644 index 0000000000..1b81985e1c --- /dev/null +++ b/libports/src/lib/fuse-ext2/config.h @@ -0,0 +1,373 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +/* #undef CLOSEDIR_VOID */ + +/* Define to 1 if you want 'debug' support. */ +#define ENABLE_DEBUG 1 + +/* Define to 1 if you want 'swapfs' support. */ +#define ENABLE_SWAPFS 1 + +/* Version of FUSE interface */ +#define FUSE_USE_VERSION 26 + +/* Define to 1 if your system has a working `chown' function. */ +/* #undef HAVE_CHOWN */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `getdtablesize' function. */ +/* #undef HAVE_GETDTABLESIZE */ + +/* Define to 1 if you have the `getmntent' function. */ +#define HAVE_GETMNTENT 1 + +/* Define to 1 if you have the `getmntinfo' function. */ +/* #undef HAVE_GETMNTINFO */ + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `hasmntopt' function. */ +/* #undef HAVE_HASMNTOPT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `ext2fs' library (-lext2fs). */ +#define HAVE_LIBEXT2FS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_FD_H */ + +/* Define to 1 if you have the `llseek' function. */ +/* #undef HAVE_LLSEEK */ + +/* Define to 1 if you have the `llseek' prototype. */ +/* #undef HAVE_LLSEEK_PROTOTYPE */ + +/* Define to 1 if you have the `lseek64' function. */ +/* #undef HAVE_LSEEK64 */ + +/* Define to 1 if you have the `lseek64' prototype. */ +#define HAVE_LSEEK64_PROTOTYPE 1 + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have a working `mmap' system call. */ +/* #undef HAVE_MMAP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MNTENT_H */ + +/* Define to 1 if you have the `munmap' function. */ +/* #undef HAVE_MUNMAP */ + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NET_IF_DL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PATHS_H 1 + +/* Define to 1 if you have the `random' function. */ +#define HAVE_RANDOM 1 + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `srand' function. */ +#define HAVE_SRAND 1 + +/* Define to 1 if you have the `srandom' function. */ +#define HAVE_SRANDOM 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the `strtoull' function. */ +#define HAVE_STRTOULL 1 + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 + +/* Define to 1 if `st_rdev' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#define HAVE_ST_BLOCKS 1 + +/* Define to 1 if you have the `sysconf' function. */ +#define HAVE_SYSCONF 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_DISKLABEL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_DISK_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MOUNT_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PRCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_QUEUE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSCALL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the `ssize_t' prototype. */ +#define HAVE_TYPE_SSIZE_T 1 + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ +#define HAVE_UTIME_NULL 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +/* #undef LT_OBJDIR */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Name of package */ +#define PACKAGE "fuse-ext2" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "fuse-ext2" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "fuse-ext2 0.0.7.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "fuse-ext2" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.0.7.1" + +/* Define to the type of arg 1 for `select'. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#define SELECT_TYPE_ARG234 (fd_set *) + +/* Define to the type of arg 5 for `select'. */ +#define SELECT_TYPE_ARG5 (struct timeval *) + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define VERSION "0.0.7.1" + +/* File Offset size */ +#define _FILE_OFFSET_BITS 64 + +/* Large files support */ +#define _LARGE_FILE_SOURCE /**/ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to rpl_realloc if the replacement function should be used. */ +/* #undef realloc */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if does not define. */ +/* #undef ssize_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ diff --git a/libports/src/lib/fuse-ext2/init.cc b/libports/src/lib/fuse-ext2/init.cc new file mode 100644 index 0000000000..08e03fc31e --- /dev/null +++ b/libports/src/lib/fuse-ext2/init.cc @@ -0,0 +1,78 @@ +/* + * \brief libc_fuse_ext2 + * \author Josef Soentgen + * \date 2013-11-11 + */ + +/* + * Copyright (C) 2013 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/* Genode includes */ +#include +#include + +#include +#include + +/* libc includes */ +#include + +extern "C" { + +#include +#include + +extern struct fuse_operations ext2fs_ops; + +struct fuse_chan *fc; +struct fuse *fh; + +static ext2_filsys e2fs; +static struct extfs_data extfs_data; + +} + +void Fuse::init_fs(void) +{ + PLOG("libc_fuse_ext2: try to mount /dev/blkdev..."); + + int err = ext2fs_open("/dev/blkdev", EXT2_FLAG_RW, 0, 0, unix_io_manager, &e2fs); + if (err) { + PERR("libc_fuse_ext2: could not mount /dev/blkdev, error: %d", err); + return; + } + + errcode_t rc = ext2fs_read_bitmaps(e2fs); + if (rc) { + PERR("libc_fuse_ext2: error while reading bitmaps"); + ext2fs_close(e2fs); + return; + } + + extfs_data.debug = 0; + extfs_data.silent = 0; + extfs_data.force = 0; + extfs_data.readonly = 0; + extfs_data.last_flush = 0; + extfs_data.mnt_point = "/"; + extfs_data.options = ""; + extfs_data.device = "/dev/blkdev"; + extfs_data.volname = "ext2_volume"; + extfs_data.e2fs = e2fs; + + fh = fuse_new(fc, NULL, &ext2fs_ops, sizeof (ext2fs_ops), &extfs_data); + if (fh == 0) { + PERR("libc_fuse_ext2: fuse_new() failed"); + return; + } +} + +void Fuse::deinit_fs(void) +{ + PLOG("libc_fuse_ext2: unmount /dev/blkdev..."); + ext2fs_close(e2fs); +} diff --git a/libports/src/lib/fuse-ext2/patches/bitops.h.patch b/libports/src/lib/fuse-ext2/patches/bitops.h.patch new file mode 100644 index 0000000000..f5af19ab3e --- /dev/null +++ b/libports/src/lib/fuse-ext2/patches/bitops.h.patch @@ -0,0 +1,11 @@ +--- contrib/fuse-ext2-svn-220/e2fsprogs-1.41.12.newgit/ext2fs/bitops.h.orig 2013-11-14 15:25:38.621795983 +0100 ++++ contrib/fuse-ext2-svn-220/e2fsprogs-1.41.12.newgit/ext2fs/bitops.h 2013-11-14 15:24:24.069798186 +0100 +@@ -98,7 +98,7 @@ + extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); + extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap, +- ino_t inode, int num); ++ ext2_ino_t inode, int num); + extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); + extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, diff --git a/libports/src/lib/fuse-ext2/patches/closefs.c.patch b/libports/src/lib/fuse-ext2/patches/closefs.c.patch new file mode 100644 index 0000000000..f2a379b0ff --- /dev/null +++ b/libports/src/lib/fuse-ext2/patches/closefs.c.patch @@ -0,0 +1,22 @@ +--- contrib/fuse-ext2-svn-220/e2fsprogs-1.41.12.newgit/ext2fs/closefs.c.orig 2013-11-22 17:12:24.152903960 +0100 ++++ contrib/fuse-ext2-svn-220/e2fsprogs-1.41.12.newgit/ext2fs/closefs.c 2013-11-22 17:12:52.936905227 +0100 +@@ -32,19 +32,6 @@ + } + } + +-int ext2fs_bg_has_super(ext2_filsys fs, int group_block) +-{ +- if (!(fs->super->s_feature_ro_compat & +- EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) +- return 1; +- +- if (test_root(group_block, 3) || (test_root(group_block, 5)) || +- test_root(group_block, 7)) +- return 1; +- +- return 0; +-} +- + /* + * ext2fs_super_and_bgd_loc2() + * @fs: ext2 fs pointer diff --git a/libports/src/lib/fuse-ext2/patches/ext2fs.h.patch b/libports/src/lib/fuse-ext2/patches/ext2fs.h.patch new file mode 100644 index 0000000000..88e2954bec --- /dev/null +++ b/libports/src/lib/fuse-ext2/patches/ext2fs.h.patch @@ -0,0 +1,15 @@ +--- contrib/fuse-ext2-svn-220/e2fsprogs-1.41.12.newgit/ext2fs/ext2fs.h.orig 2013-11-22 17:06:23.728888099 +0100 ++++ contrib/fuse-ext2-svn-220/e2fsprogs-1.41.12.newgit/ext2fs/ext2fs.h 2013-11-22 17:03:53.028881471 +0100 +@@ -49,9 +49,12 @@ + #include + #endif + ++typedef unsigned int dev_t; ++ + #include + #include + #include ++#include + + #if EXT2_FLAT_INCLUDES + #include "e2_types.h" diff --git a/libports/src/lib/fuse-ext2/patches/fuse-ext2.c.patch b/libports/src/lib/fuse-ext2/patches/fuse-ext2.c.patch new file mode 100644 index 0000000000..f1e227981f --- /dev/null +++ b/libports/src/lib/fuse-ext2/patches/fuse-ext2.c.patch @@ -0,0 +1,11 @@ +--- contrib/fuse-ext2-svn-220/fuse-ext2/fuse-ext2.c.orig 2013-11-22 17:13:24.484906614 +0100 ++++ contrib/fuse-ext2-svn-220/fuse-ext2/fuse-ext2.c 2013-11-22 17:13:35.520907100 +0100 +@@ -278,7 +278,7 @@ + goto exit; + } + +-static const struct fuse_operations ext2fs_ops = { ++const struct fuse_operations ext2fs_ops = { + .getattr = op_getattr, + .readlink = op_readlink, + .mknod = op_mknod, diff --git a/libports/src/lib/fuse-ext2/patches/op_access.c.patch b/libports/src/lib/fuse-ext2/patches/op_access.c.patch new file mode 100644 index 0000000000..e641beb8a4 --- /dev/null +++ b/libports/src/lib/fuse-ext2/patches/op_access.c.patch @@ -0,0 +1,11 @@ +--- contrib/fuse-ext2-svn-220/fuse-ext2/op_access.c.orig 2013-11-22 17:10:24.636898700 +0100 ++++ contrib/fuse-ext2-svn-220/fuse-ext2/op_access.c 2013-11-22 17:10:34.728899142 +0100 +@@ -18,6 +18,8 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + ++#include ++ + #include "fuse-ext2.h" + + int op_access (const char *path, int mask) diff --git a/libports/src/lib/fuse-ext2/patches/op_statfs.c.patch b/libports/src/lib/fuse-ext2/patches/op_statfs.c.patch new file mode 100644 index 0000000000..2db69d9dd9 --- /dev/null +++ b/libports/src/lib/fuse-ext2/patches/op_statfs.c.patch @@ -0,0 +1,15 @@ +--- contrib/fuse-ext2-svn-220/fuse-ext2/op_statfs.c.orig 2013-11-25 15:51:51.752182307 +0100 ++++ contrib/fuse-ext2-svn-220/fuse-ext2/op_statfs.c 2013-11-25 15:51:45.592104883 +0100 +@@ -41,10 +41,12 @@ + + static int ext2_bg_has_super (ext2_filsys e2fs, int group) + { ++ /* + if (EXT2_HAS_RO_COMPAT_FEATURE(e2fs->super, EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) && + !ext2_group_spare(group)) { + return 0; + } ++ */ + return 1; + } + diff --git a/libports/src/test/libc_fuse_ext2/target.mk b/libports/src/test/libc_fuse_ext2/target.mk new file mode 100644 index 0000000000..97c942b732 --- /dev/null +++ b/libports/src/test/libc_fuse_ext2/target.mk @@ -0,0 +1,5 @@ +TARGET = test-libc_fuse_ext2 +LIBS = libc libc_log libc_fuse_ext2 +SRC_CC = main.cc + +vpath %.cc $(PRG_DIR)/../libc_ffat diff --git a/libports/src/test/libports/libext2fs/target.mk b/libports/src/test/libports/libext2fs/target.mk new file mode 100644 index 0000000000..b558a26cfe --- /dev/null +++ b/libports/src/test/libports/libext2fs/target.mk @@ -0,0 +1,5 @@ +TARGET = test-libext2fs +LIBS = libc libext2fs +SRC_CC = main.cc + +vpath main.cc $(PRG_DIR)/..