From: Theodore Ts'o Date: Mon, 17 Mar 2003 15:01:22 +0000 (-0500) Subject: Fix the Apple Darwin port. X-Git-Tag: E2FSPROGS-1_33-WIP-0325~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa75ecccab67ea7428fc19c66e80a28fb1ca941f;p=thirdparty%2Fe2fsprogs.git Fix the Apple Darwin port. --- diff --git a/ChangeLog b/ChangeLog index 1656b939e..c6cfaf958 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-03-17 Theodore Ts'o + + * configure.in: Fix the Apple Darwin port. + 2003-03-16 Theodore Ts'o * configure.in: Check to see if libdl exists for the sake of dlopen diff --git a/configure b/configure index 3c5862f38..25987bf13 100644 --- a/configure +++ b/configure @@ -1215,7 +1215,7 @@ else MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib LIB_EXT=.so case "$host_os" in - darwin.*) + darwin*) MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib LIB_EXT=.dylib ;; diff --git a/configure.in b/configure.in index 53bb71623..89d83ced8 100644 --- a/configure.in +++ b/configure.in @@ -259,7 +259,7 @@ else MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib LIB_EXT=.so [case "$host_os" in - darwin.*) + darwin*) MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib LIB_EXT=.dylib ;; diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index c02827e2d..0fb86426a 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,8 @@ +2003-03-17 Theodore Ts'o + + * util.c: Explicitly declare e2fsck_global_ctx as extern for the + benefit of the Apple Darwin port. + 2003-03-15 Theodore Ts'o * rehash.c (e2fsck_rehash_dir): If user specified the -n option, diff --git a/e2fsck/util.c b/e2fsck/util.c index b9ad4d40b..2c890dc60 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -31,7 +31,7 @@ #include "e2fsck.h" -e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */ +extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */ #include #include diff --git a/lib/ChangeLog b/lib/ChangeLog index cb95c341e..b4d8f7532 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2003-03-17 Theodore Ts'o + + * Makefile.darwin-lib: Fix Apple Darwin port. + 2003-03-14 Theodore Ts'o * Makefile.darwin-lib: New file to provide support for e2fsprogs diff --git a/lib/Makefile.darwin-lib b/lib/Makefile.darwin-lib index 4bacd2745..77c5bac27 100644 --- a/lib/Makefile.darwin-lib +++ b/lib/Makefile.darwin-lib @@ -2,8 +2,7 @@ # This is a Makefile stub which handles the creation of Darwin BSD shared # libraries. # -# In order to use this stub, the following makefile variables must be -efined. +# In order to use this stub, the following makefile variables must be defined. # # BSDLIB_VERSION = 1.0 # BSDLIB_IMAGE = libce @@ -23,8 +22,7 @@ BSD_LIB = $(BSDLIB_IMAGE).$(BSDLIB_VERSION).dylib image: $(BSD_LIB) $(BSD_LIB): $(OBJS) - (cd pic; $(CC) -dynamiclib -compatibility_version 1.0 - -current_version $(BSDLIB_VERSION) \ + (cd pic; $(CC) -dynamiclib -compatibility_version 1.0 -current_version $(BSDLIB_VERSION) \ -flat_namespace -undefined warning -o $(BSD_LIB) $(OBJS)) $(MV) pic/$(BSD_LIB) . $(RM) -f ../$(BSD_LIB) diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog index a49a16a8b..c2bf686f2 100644 --- a/lib/blkid/ChangeLog +++ b/lib/blkid/ChangeLog @@ -1,3 +1,7 @@ +2003-03-17 Theodore Ts'o + + * getsize.c (blkid_get_dev_size): Fix Apple Darwin port. + 2003-03-06 * devname.c (probe_one): Fix bug; if a partition has no known diff --git a/lib/blkid/getsize.c b/lib/blkid/getsize.c index da809dc6e..c83b1ddc2 100644 --- a/lib/blkid/getsize.c +++ b/lib/blkid/getsize.c @@ -35,6 +35,13 @@ #define BLKGETSIZE _IO(0x12,96) /* return device size */ #endif +#ifdef APPLE_DARWIN +#include +#include + +#define BLKGETSIZE DKIOCGETBLOCKCOUNT32 +#endif /* APPLE_DARWIN */ + static int valid_offset(int fd, blkid_loff_t offset) { char ch; @@ -59,10 +66,11 @@ blkid_loff_t blkid_get_dev_size(int fd) struct floppy_struct this_floppy; #endif #ifdef HAVE_SYS_DISKLABEL_H - int part; + int part = -1; struct disklabel lab; struct partition *pp; char ch; + struct stat st; #endif /* HAVE_SYS_DISKLABEL_H */ #ifdef BLKGETSIZE @@ -74,21 +82,20 @@ blkid_loff_t blkid_get_dev_size(int fd) return (blkid_loff_t)this_floppy.size << 9; #endif #ifdef HAVE_SYS_DISKLABEL_H - part = strlen(file) - 1; - if (part >= 0) { - ch = file[part]; - if (isdigit(ch)) - part = 0; - else if (ch >= 'a' && ch <= 'h') - part = ch - 'a'; - else - part = -1; - } +#if 0 + /* + * This should work in theory but I haven't tested it. Anyone + * on a BSD system want to test this for me? In the meantime, + * binary search mechanism should work just fine. + */ + if ((fstat(fd, &st) >= 0) && S_ISBLK(st.st_mode)) + part = st.st_rdev & 7; if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) { pp = &lab.d_partitions[part]; if (pp->p_size) return pp->p_size << 9; } +#endif #endif /* HAVE_SYS_DISKLABEL_H */ /*