From 72df74b589b47dce63a36d8c3541408ef25ce67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Thu, 21 Mar 2013 18:13:09 +0000 Subject: [PATCH] Add my current patch for e2fsprogs, which now fully compiles. Thanks scott for getting me dig this :-P --- sys-fs/e2fsprogs/e2fsprogs-1.43-git.bep | 28 ++ .../patches/e2fsprogs-1.43-git.patch | 476 ++++++++++++++++++ 2 files changed, 504 insertions(+) create mode 100644 sys-fs/e2fsprogs/e2fsprogs-1.43-git.bep create mode 100644 sys-fs/e2fsprogs/patches/e2fsprogs-1.43-git.patch diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.43-git.bep b/sys-fs/e2fsprogs/e2fsprogs-1.43-git.bep new file mode 100644 index 000000000..cc5b02d07 --- /dev/null +++ b/sys-fs/e2fsprogs/e2fsprogs-1.43-git.bep @@ -0,0 +1,28 @@ +DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities" +HOMEPAGE="http://e2fsprogs.sourceforge.net/" +SRC_URI="git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git" +#CHECKSUM_MD5="" +REVISION="1" +STATUS_HAIKU="untested" +DEPEND="" + +BUILD { + cd e2fsprogs + autoconf + libdir=`finddir B_COMMON_LIB_DIRECTORY` + ./configure \ + --enable-symlink-build \ + --enable-symlink-install \ + --disable-tls --enable-quota=no \ + --disable-fsck \ + --enable-elf-shlibs + make +} + +INSTALL { + cd e2fsprogs + make install-libs +} + +LICENSE="GNU GPL v2" +COPYRIGHT="2004-2012 Free Software Foundation, Inc." diff --git a/sys-fs/e2fsprogs/patches/e2fsprogs-1.43-git.patch b/sys-fs/e2fsprogs/patches/e2fsprogs-1.43-git.patch new file mode 100644 index 000000000..64306c456 --- /dev/null +++ b/sys-fs/e2fsprogs/patches/e2fsprogs-1.43-git.patch @@ -0,0 +1,476 @@ +diff --git a/configure.in b/configure.in +index ac3cd92..296021a 100644 +--- a/configure.in ++++ b/configure.in +@@ -96,8 +96,11 @@ AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead])) + dnl + AC_PROG_CC + if test "$GCC" = yes; then +- RDYNAMIC="-rdynamic" +- AC_SUBST(RDYNAMIC) ++ case "$host_os" in ++ haiku*) RDYNAMIC="-Wl,-export-dynamic" ;; ++ *) RDYNAMIC="-rdynamic" ;; ++ esac ++ AC_SUBST(RDYNAMIC) + fi + AC_PROG_CPP + dnl +@@ -1051,6 +1054,7 @@ AC_CHECK_FUNCS(m4_flatten([ + backtrace + blkid_probe_get_topology + chflags ++ daemon + fallocate + fallocate64 + fchown +@@ -1094,9 +1098,10 @@ AC_CHECK_FUNCS(m4_flatten([ + dnl + dnl Check to see if -lsocket is required (solaris) to make something + dnl that uses socket() to compile; this is needed for the UUID library ++dnl Haiku needs -lnetwork to get socket(). + dnl + SOCKET_LIB='' +-AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket]) ++AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket],[AC_CHECK_LIB(network, socket, [SOCKET_LIB=-lnetwork])]) + AC_SUBST(SOCKET_LIB) + dnl + dnl See if optreset exists +@@ -1187,6 +1192,16 @@ linux* | gnu* | k*bsd*-gnu) + fi + fi + ;; ++haiku*) ++ if test "$prefix" = NONE ; then ++ prefix="`finddir B_COMMON_DIRECTORY`"; ++ AC_MSG_RESULT([On $host_os systems, prefix defaults to `finddir B_COMMON_DIRECTORY`]) ++ if test "$sbindir" = '${exec_prefix}/sbin' ; then ++ AC_MSG_RESULT([...and sbindir defaults to `finddir B_COMMON_DIRECTORY`/bin]) ++ mandir="`finddir B_COMMON_DIRECTORY`/bin" ++ fi ++ fi ++;; + esac + if test "$root_prefix" = NONE ; then + if test "$prefix" = NONE ; then +diff --git a/contrib/spd_readdir.c b/contrib/spd_readdir.c +index 8345fa1..b5984e9 100644 +--- a/contrib/spd_readdir.c ++++ b/contrib/spd_readdir.c +@@ -254,7 +254,7 @@ DIR *opendir(const char *name) + dirstruct = alloc_dirstruct(dir); + if (!dirstruct) { + (*real_closedir)(dir); +- errno = -ENOMEM; ++ errno = ENOMEM; + return NULL; + } + +@@ -287,7 +287,7 @@ DIR *fdopendir(int fd) + dirstruct = alloc_dirstruct(dir); + if (!dirstruct) { + (*real_closedir)(dir); +- errno = -ENOMEM; ++ errno = ENOMEM; + return NULL; + } + +diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h +index 09a9d08..6cb3746 100644 +--- a/e2fsck/e2fsck.h ++++ b/e2fsck/e2fsck.h +@@ -67,7 +67,9 @@ + #define E2FSCK_ATTR(x) + #endif + ++#ifdef CONFIG_QUOTA + #include "quota/mkquota.h" ++#endif + + /* + * Exit codes used by fsck-type programs +@@ -320,7 +322,9 @@ struct e2fsck_struct { + /* + * Ext4 quota support + */ ++#ifdef CONFIG_QUOTA + quota_ctx_t qctx; ++#endif + #ifdef RESOURCE_TRACK + /* + * For timing purposes +diff --git a/e2fsck/logfile.c b/e2fsck/logfile.c +index c48b8eb..ec45dd3 100644 +--- a/e2fsck/logfile.c ++++ b/e2fsck/logfile.c +@@ -233,10 +233,14 @@ static FILE *save_output(const char *s0, const char *s1, const char *s2) + } + + if (pid == 0) { ++#ifdef HAVE_DAEMON + if (daemon(0, 0) < 0) { + perror("daemon"); + exit(1); + } ++#else ++#warning daemon() not present ++#endif + /* + * Grab the output from our parent + */ +diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c +index a20b57b..253a681 100644 +--- a/e2fsck/pass1.c ++++ b/e2fsck/pass1.c +@@ -2206,11 +2206,13 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, + } + } + ++#ifdef CONFIG_QUOTA + if (ino == EXT2_ROOT_INO || ino >= EXT2_FIRST_INODE(ctx->fs->super)) { + quota_data_add(ctx->qctx, inode, ino, + pb.num_blocks * fs->blocksize); + quota_data_inodes(ctx->qctx, inode, ino, +1); + } ++#endif + + if (!(fs->super->s_feature_ro_compat & + EXT4_FEATURE_RO_COMPAT_HUGE_FILE) || +diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c +index 05cbd10..a4bae9e 100644 +--- a/e2fsck/pass1b.c ++++ b/e2fsck/pass1b.c +@@ -644,8 +644,10 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino, + if (ctx->inode_bad_map) + ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino); + ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(inode.i_mode)); ++#ifdef CONFIG_QUOTA + quota_data_sub(ctx->qctx, &inode, ino, pb.dup_blocks * fs->blocksize); + quota_data_inodes(ctx->qctx, &inode, ino, -1); ++#endif + + /* Inode may have changed by block_iterate, so reread it */ + e2fsck_read_inode(ctx, ino, &inode, "delete_file"); +@@ -677,7 +679,9 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino, + delete_file_block(fs, &blk, + BLOCK_COUNT_EXTATTR, 0, 0, &pb); + ext2fs_file_acl_block_set(fs, &inode, blk); ++#ifdef CONFIG_QUOTA + quota_data_sub(ctx->qctx, &inode, ino, fs->blocksize); ++#endif + } + } + } +diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c +index a379e9b..0d3af58 100644 +--- a/e2fsck/pass3.c ++++ b/e2fsck/pass3.c +@@ -491,8 +491,10 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix) + ext2fs_icount_store(ctx->inode_count, ino, 2); + ext2fs_icount_store(ctx->inode_link_info, ino, 2); + ctx->lost_and_found = ino; ++#ifdef CONFIG_QUOTA + quota_data_add(ctx->qctx, &inode, ino, fs->blocksize); + quota_data_inodes(ctx->qctx, &inode, ino, +1); ++#endif + #if 0 + printf("/lost+found created; inode #%lu\n", ino); + #endif +@@ -802,7 +804,9 @@ errcode_t e2fsck_expand_directory(e2fsck_t ctx, ext2_ino_t dir, + + inode.i_size = (es.last_block + 1) * fs->blocksize; + ext2fs_iblk_add_blocks(fs, &inode, es.newblocks); ++#ifdef CONFIG_QUOTA + quota_data_add(ctx->qctx, &inode, dir, es.newblocks * fs->blocksize); ++#endif + + e2fsck_write_inode(ctx, dir, &inode, "expand_directory"); + +diff --git a/e2fsck/pass4.c b/e2fsck/pass4.c +index 2d55180..c5ca971 100644 +--- a/e2fsck/pass4.c ++++ b/e2fsck/pass4.c +@@ -64,7 +64,9 @@ static int disconnect_inode(e2fsck_t ctx, ext2_ino_t i, + e2fsck_read_bitmaps(ctx); + ext2fs_inode_alloc_stats2(fs, i, -1, + LINUX_S_ISDIR(inode->i_mode)); ++#ifdef CONFIG_QUOTA + quota_data_inodes(ctx->qctx, inode, i, -1); ++#endif + return 0; + } + } +diff --git a/e2fsck/quota.c b/e2fsck/quota.c +index 7a1476e..2dc01ff 100644 +--- a/e2fsck/quota.c ++++ b/e2fsck/quota.c +@@ -21,6 +21,7 @@ + static void move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino, + ext2_ino_t to_ino, int qtype) + { ++#ifdef CONFIG_QUOTA + struct ext2_inode inode; + char qf_name[QUOTA_NAME_LEN]; + +@@ -46,10 +47,12 @@ static void move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino, + /* Clear out the original inode in the inode-table block. */ + memset(&inode, 0, sizeof(struct ext2_inode)); + ext2fs_write_inode(fs, from_ino, &inode); ++#endif + } + + void e2fsck_hide_quota(e2fsck_t ctx) + { ++#ifdef CONFIG_QUOTA + struct ext2_super_block *sb = ctx->fs->super; + struct problem_context pctx; + ext2_filsys fs = ctx->fs; +@@ -79,4 +82,5 @@ void e2fsck_hide_quota(e2fsck_t ctx) + } + + return; ++#endif + } +diff --git a/e2fsck/unix.c b/e2fsck/unix.c +index 5b705ed..93e270e 100644 +--- a/e2fsck/unix.c ++++ b/e2fsck/unix.c +@@ -1616,6 +1616,7 @@ print_unsupp_features: + journal_size = -1; + + if (sb->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_QUOTA) { ++#ifdef CONFIG_QUOTA + /* Quotas were enabled. Do quota accounting during fsck. */ + if ((sb->s_usr_quota_inum && sb->s_grp_quota_inum) || + (!sb->s_usr_quota_inum && !sb->s_grp_quota_inum)) +@@ -1624,6 +1625,11 @@ print_unsupp_features: + qtype = sb->s_usr_quota_inum ? USRQUOTA : GRPQUOTA; + + quota_init_context(&ctx->qctx, ctx->fs, qtype); ++#else ++ log_err(ctx, _("%s: e2fsck not compiled with QUOTA support,\n\t" ++ "but filesystem %s has QUOTA enabled.\n"), ++ ctx->program_name, ctx->device_name); ++#endif + } + + run_result = e2fsck_run(ctx); +@@ -1658,6 +1664,7 @@ print_unsupp_features: + } + no_journal: + ++#ifdef CONFIG_QUOTA + if (ctx->qctx) { + int i, needs_writeout; + for (i = 0; i < MAXQUOTAS; i++) { +@@ -1673,6 +1680,7 @@ no_journal: + } + quota_release_context(&ctx->qctx); + } ++#endif + + if (run_result == E2F_FLAG_RESTART) { + log_out(ctx, _("Restarting e2fsck from the beginning...\n")); +diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c +index a6673c1..c2ea2f7 100644 +--- a/lib/blkid/devname.c ++++ b/lib/blkid/devname.c +@@ -40,6 +40,10 @@ + + #include "blkidP.h" + ++#ifndef makedev ++#define makedev(major,minor) (-1) ++#endif ++ + /* + * Find a dev struct in the cache by device name, if available. + * +diff --git a/lib/ext2fs/bmap64.h b/lib/ext2fs/bmap64.h +index c5384c9..4573fc6 100644 +--- a/lib/ext2fs/bmap64.h ++++ b/lib/ext2fs/bmap64.h +@@ -9,6 +9,8 @@ + * %End-Header% + */ + ++#include ++ + struct ext2_bmap_statistics { + int type; + struct timeval created; +diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c +index ebd544f..f72525b 100644 +--- a/lib/ext2fs/csum.c ++++ b/lib/ext2fs/csum.c +@@ -722,6 +722,7 @@ __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group) + __u16 crc = 0; + struct ext2_group_desc *desc; + size_t size; ++ size_t offset; + + size = fs->super->s_desc_size; + if (size < EXT2_MIN_DESC_SIZE) +@@ -764,7 +765,7 @@ __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group) + } + + /* old crc16 code */ +- size_t offset = offsetof(struct ext2_group_desc, bg_checksum); ++ offset = offsetof(struct ext2_group_desc, bg_checksum); + crc = ext2fs_crc16(~0, fs->super->s_uuid, + sizeof(fs->super->s_uuid)); + crc = ext2fs_crc16(crc, &group, sizeof(group)); +diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c +index 3503615..3236c6a 100644 +--- a/lib/ext2fs/dblist.c ++++ b/lib/ext2fs/dblist.c +@@ -365,9 +365,9 @@ int ext2fs_dblist_count(ext2_dblist dblist) + errcode_t ext2fs_dblist_get_last(ext2_dblist dblist, + struct ext2_db_entry **entry) + { +- EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); + static struct ext2_db_entry ret_entry; + struct ext2_db_entry2 *last; ++ EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); + + if (dblist->count == 0) + return EXT2_ET_DBLIST_EMPTY; +diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c +index 19be630..d556594 100644 +--- a/lib/ext2fs/unix_io.c ++++ b/lib/ext2fs/unix_io.c +@@ -24,6 +24,9 @@ + #include "config.h" + #include + #include ++#if HAVE_STDINT_H ++#include ++#endif + #if HAVE_UNISTD_H + #include + #endif +diff --git a/lib/quota/common.h b/lib/quota/common.h +index 7f3f4b9..fee81b1 100644 +--- a/lib/quota/common.h ++++ b/lib/quota/common.h +@@ -13,9 +13,15 @@ + # endif + #endif + ++# if !defined __GNUC__ || __GNUC__ > 2 + #define log_err(format, arg ...) \ + fprintf(stderr, "[ERROR] %s:%d:%s:: " format "\n", \ + __FILE__, __LINE__, __func__, ## arg) ++#else ++#define log_err(format, arg...) \ ++ fprintf(stderr, "[ERROR] %s:%d:%s:: " format "\n", \ ++ __FILE__, __LINE__, __func__ , ## arg) ++#endif + + #ifdef DEBUG_QUOTA + # define log_debug(format, arg ...) \ +diff --git a/lib/quota/quotaio_tree.h b/lib/quota/quotaio_tree.h +index 6ee54c9..4c22c21 100644 +--- a/lib/quota/quotaio_tree.h ++++ b/lib/quota/quotaio_tree.h +@@ -6,6 +6,7 @@ + #define _LINUX_QUOTA_TREE_H + + #include ++#include + + typedef u_int32_t qid_t; /* Type in which we store ids in memory */ + +diff --git a/misc/mke2fs.c b/misc/mke2fs.c +index bbf477a..40ae31c 100644 +--- a/misc/mke2fs.c ++++ b/misc/mke2fs.c +@@ -2334,6 +2334,7 @@ static void fix_cluster_bg_counts(ext2_filsys fs) + ext2fs_free_blocks_count_set(fs->super, EXT2FS_C2B(fs, tot_free)); + } + ++#ifdef CONFIG_QUOTA + static int create_quota_inodes(ext2_filsys fs) + { + quota_ctx_t qctx; +@@ -2345,6 +2346,7 @@ static int create_quota_inodes(ext2_filsys fs) + + return 0; + } ++#endif + + int main (int argc, char *argv[]) + { +@@ -2729,9 +2731,11 @@ no_journal: + if (EXT2_HAS_RO_COMPAT_FEATURE(&fs_param, + EXT4_FEATURE_RO_COMPAT_BIGALLOC)) + fix_cluster_bg_counts(fs); ++#ifdef CONFIG_QUOTA + if (EXT2_HAS_RO_COMPAT_FEATURE(&fs_param, + EXT4_FEATURE_RO_COMPAT_QUOTA)) + create_quota_inodes(fs); ++#endif + + if (!quiet) + printf(_("Writing superblocks and " +diff --git a/misc/tune2fs.c b/misc/tune2fs.c +index c1ecae8..267b672 100644 +--- a/misc/tune2fs.c ++++ b/misc/tune2fs.c +@@ -56,7 +56,9 @@ extern int optind; + #include "jfs_user.h" + #include "util.h" + #include "blkid/blkid.h" ++#ifdef CONFIG_QUOTA + #include "quota/mkquota.h" ++#endif + + #include "../version.h" + #include "nls-enable.h" +@@ -477,6 +479,7 @@ static int rewrite_dir_block(ext2_filsys fs, + dcl->limit = ext2fs_cpu_to_le16(max_entries); + } + } else { ++ int max_entries; + /* If htree block is full then rebuild the dir */ + if (ext2fs_le16_to_cpu(dcl->count) == + ext2fs_le16_to_cpu(dcl->limit)) { +@@ -487,7 +490,7 @@ static int rewrite_dir_block(ext2_filsys fs, + * Ensure dcl->limit is small enough to leave room for + * the checksum tail. + */ +- int max_entries = (fs->blocksize - (dcl_offset + ++ max_entries = (fs->blocksize - (dcl_offset + + sizeof(struct ext2_dx_tail))) / + sizeof(struct ext2_dx_entry); + if (ext2fs_le16_to_cpu(dcl->limit) != max_entries) +@@ -1127,6 +1130,7 @@ err: + return 1; + } + ++#ifdef CONFIG_QUOTA + void handle_quota_options(ext2_filsys fs) + { + quota_ctx_t qctx; +@@ -1176,6 +1180,7 @@ void handle_quota_options(ext2_filsys fs) + + return; + } ++#endif + + void parse_quota_opts(const char *opts) + { +@@ -2547,7 +2552,13 @@ retry_open: + rc = 1; + goto closefs; + } ++#ifdef CONFIG_QUOTA + handle_quota_options(fs); ++#else ++ fputs(_("The quota feature is disabled.\n"), stderr); ++ rc = 1; ++ goto closefs; ++#endif + } + + if (U_flag) {