Whamcloud - gitweb
Fix the Apple Darwin port.
authorTheodore Ts'o <tytso@mit.edu>
Mon, 17 Mar 2003 15:01:22 +0000 (10:01 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 17 Mar 2003 15:01:22 +0000 (10:01 -0500)
ChangeLog
configure
configure.in
e2fsck/ChangeLog
e2fsck/util.c
lib/ChangeLog
lib/Makefile.darwin-lib
lib/blkid/ChangeLog
lib/blkid/getsize.c

index 1656b93..c6cfaf9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-17  Theodore Ts'o  <tytso@mit.edu>
+
+       * configure.in: Fix the Apple Darwin port.
+
 2003-03-16  Theodore Ts'o  <tytso@mit.edu>
 
        * configure.in: Check to see if libdl exists for the sake of dlopen
index 3c5862f..25987bf 100644 (file)
--- 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
        ;;
index 53bb716..89d83ce 100644 (file)
@@ -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
        ;;
index c02827e..0fb8642 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-17  Theodore Ts'o  <tytso@mit.edu>
+
+       * util.c: Explicitly declare e2fsck_global_ctx as extern for the
+               benefit of the Apple Darwin port.
+
 2003-03-15  Theodore Ts'o  <tytso@mit.edu>
 
        * rehash.c (e2fsck_rehash_dir): If user specified the -n option,
index b9ad4d4..2c890dc 100644 (file)
@@ -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 <sys/time.h>
 #include <sys/resource.h>
index cb95c34..b4d8f75 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-17  Theodore Ts'o  <tytso@mit.edu>
+
+       * Makefile.darwin-lib: Fix Apple Darwin port.
+
 2003-03-14  Theodore Ts'o  <tytso@mit.edu>
 
        * Makefile.darwin-lib: New file to provide support for e2fsprogs
index 4bacd27..77c5bac 100644 (file)
@@ -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)
index a49a16a..c2bf686 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-17  Theodore Ts'o  <tytso@mit.edu>
+
+       * getsize.c (blkid_get_dev_size): Fix Apple Darwin port.
+
 2003-03-06    <tytso@mit.edu>
 
        * devname.c (probe_one): Fix bug; if a partition has no known
index da809dc..c83b1dd 100644 (file)
 #define BLKGETSIZE _IO(0x12,96)        /* return device size */
 #endif
 
+#ifdef APPLE_DARWIN
+#include <sys/ioctl.h>
+#include <sys/disk.h>
+
+#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 */
 
        /*