[Pancutan-commits] r63 - in hfsbootfiles: . os
tincho-guest at alioth.debian.org
tincho-guest at alioth.debian.org
Wed Aug 15 23:56:52 UTC 2007
Author: tincho-guest
Date: 2007-08-15 23:56:52 +0000 (Wed, 15 Aug 2007)
New Revision: 63
Modified:
hfsbootfiles/block.c
hfsbootfiles/config.h.in
hfsbootfiles/configure
hfsbootfiles/configure.in
hfsbootfiles/hfs.h
hfsbootfiles/os.h
hfsbootfiles/os/unix.c
Log:
(Some) support for largefiles. Although I think now it's limited to 2**(32+12) because blocknumber is still a long.
Modified: hfsbootfiles/block.c
===================================================================
--- hfsbootfiles/block.c 2007-08-15 23:42:28 UTC (rev 62)
+++ hfsbootfiles/block.c 2007-08-15 23:56:52 UTC (rev 63)
@@ -578,7 +578,8 @@
*/
int b_readpb(hfsvol *vol, unsigned long bnum, block *bp, unsigned int blen)
{
- unsigned long nblocks;
+ off_t sblocks;
+ ssize_t nblocks;
# ifdef DEBUG
fprintf(stderr, "BLOCK: READ vol 0x%lx block %lu",
@@ -589,15 +590,15 @@
fprintf(stderr, "\n");
# endif
- nblocks = os_seek(&vol->priv, bnum);
- if (nblocks == (unsigned long) -1)
+ sblocks = os_seek(&vol->priv, (off_t)bnum);
+ if (sblocks == (off_t) -1)
goto fail;
- if (nblocks != bnum)
+ if (sblocks != bnum)
ERROR(EIO, "block seek failed for read");
- nblocks = os_read(&vol->priv, bp, blen);
- if (nblocks == (unsigned long) -1)
+ nblocks = os_read(&vol->priv, bp, (ssize_t)blen);
+ if (nblocks == (ssize_t) -1)
goto fail;
if (nblocks != blen)
@@ -616,7 +617,8 @@
int b_writepb(hfsvol *vol, unsigned long bnum, const block *bp,
unsigned int blen)
{
- unsigned long nblocks;
+ off_t sblocks;
+ ssize_t nblocks;
# ifdef DEBUG
fprintf(stderr, "BLOCK: WRITE vol 0x%lx block %lu",
@@ -627,15 +629,15 @@
fprintf(stderr, "\n");
# endif
- nblocks = os_seek(&vol->priv, bnum);
- if (nblocks == (unsigned long) -1)
+ nblocks = os_seek(&vol->priv, (off_t)bnum);
+ if (nblocks == (off_t) -1)
goto fail;
if (nblocks != bnum)
ERROR(EIO, "block seek failed for write");
- nblocks = os_write(&vol->priv, bp, blen);
- if (nblocks == (unsigned long) -1)
+ nblocks = os_write(&vol->priv, bp, (ssize_t)blen);
+ if (nblocks == (ssize_t) -1)
goto fail;
if (nblocks != blen)
Modified: hfsbootfiles/config.h.in
===================================================================
--- hfsbootfiles/config.h.in 2007-08-15 23:42:28 UTC (rev 62)
+++ hfsbootfiles/config.h.in 2007-08-15 23:56:52 UTC (rev 63)
@@ -57,6 +57,12 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
Modified: hfsbootfiles/configure
===================================================================
--- hfsbootfiles/configure 2007-08-15 23:42:28 UTC (rev 62)
+++ hfsbootfiles/configure 2007-08-15 23:56:52 UTC (rev 63)
@@ -1247,6 +1247,7 @@
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-debug enable diagnostic debugging support
+ --disable-largefile omit support for large files
Some influential environment variables:
CC C compiler command
@@ -3823,7 +3824,356 @@
fi
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+ enableval=$enable_largefile;
+fi
+if test "$enable_largefile" != no; then
+
+ { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_largefile_CC=' -n32'; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_file_offset_bits=no; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_file_offset_bits=64; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_file_offset_bits=unknown
+ break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -f conftest*
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_large_files=no; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_large_files=1; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_large_files=unknown
+ break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -f conftest*
+ fi
+fi
+
{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
if test "${ac_cv_c_const+set}" = set; then
Modified: hfsbootfiles/configure.in
===================================================================
--- hfsbootfiles/configure.in 2007-08-15 23:42:28 UTC (rev 62)
+++ hfsbootfiles/configure.in 2007-08-15 23:56:52 UTC (rev 63)
@@ -50,7 +50,7 @@
AC_TYPE_SIZE_T
AC_STRUCT_TM
-
+AC_SYS_LARGEFILE
AC_C_CONST
dnl Checks for library functions.
Modified: hfsbootfiles/hfs.h
===================================================================
--- hfsbootfiles/hfs.h 2007-08-15 23:42:28 UTC (rev 62)
+++ hfsbootfiles/hfs.h 2007-08-15 23:56:52 UTC (rev 63)
@@ -20,6 +20,7 @@
*/
# include <time.h>
+# include <sys/types.h>
# define HFS_BLOCKSZ 512
# define HFS_BLOCKSZ_BITS 9
@@ -35,8 +36,8 @@
char name[HFS_MAX_VLEN + 1]; /* name of volume (MacOS Standard Roman) */
int flags; /* volume flags */
- unsigned long totbytes; /* total bytes on volume */
- unsigned long freebytes; /* free bytes on volume */
+ ssize_t totbytes; /* total bytes on volume */
+ ssize_t freebytes; /* free bytes on volume */
unsigned long alblocksz; /* volume allocation block size */
unsigned long clumpsz; /* default file clump size */
Modified: hfsbootfiles/os/unix.c
===================================================================
--- hfsbootfiles/os/unix.c 2007-08-15 23:42:28 UTC (rev 62)
+++ hfsbootfiles/os/unix.c 2007-08-15 23:56:52 UTC (rev 63)
@@ -137,14 +137,14 @@
* NAME: os->seek()
* DESCRIPTION: set a descriptor's seek pointer (offset in blocks)
*/
-unsigned long os_seek(void **priv, unsigned long offset)
+off_t os_seek(void **priv, off_t offset)
{
int fd = (int) *priv;
off_t result;
/* offset == -1 special; seek to last block of device */
- if (offset == (unsigned long) -1)
+ if (offset == (off_t) -1)
result = lseek(fd, 0, SEEK_END);
else
result = lseek(fd, offset << HFS_BLOCKSZ_BITS, SEEK_SET);
@@ -152,7 +152,7 @@
if (result == -1)
ERROR(errno, "error seeking medium");
- return (unsigned long) result >> HFS_BLOCKSZ_BITS;
+ return (off_t) result >> HFS_BLOCKSZ_BITS;
fail:
return -1;
@@ -162,7 +162,7 @@
* NAME: os->read()
* DESCRIPTION: read blocks from an open descriptor
*/
-unsigned long os_read(void **priv, void *buf, unsigned long len)
+ssize_t os_read(void **priv, void *buf, ssize_t len)
{
int fd = (int) *priv;
ssize_t result;
@@ -172,7 +172,7 @@
if (result == -1)
ERROR(errno, "error reading from medium");
- return (unsigned long) result >> HFS_BLOCKSZ_BITS;
+ return (ssize_t) result >> HFS_BLOCKSZ_BITS;
fail:
return -1;
@@ -182,7 +182,7 @@
* NAME: os->write()
* DESCRIPTION: write blocks to an open descriptor
*/
-unsigned long os_write(void **priv, const void *buf, unsigned long len)
+ssize_t os_write(void **priv, const void *buf, ssize_t len)
{
int fd = (int) *priv;
ssize_t result;
@@ -192,7 +192,7 @@
if (result == -1)
ERROR(errno, "error writing to medium");
- return (unsigned long) result >> HFS_BLOCKSZ_BITS;
+ return (ssize_t) result >> HFS_BLOCKSZ_BITS;
fail:
return -1;
Modified: hfsbootfiles/os.h
===================================================================
--- hfsbootfiles/os.h 2007-08-15 23:42:28 UTC (rev 62)
+++ hfsbootfiles/os.h 2007-08-15 23:56:52 UTC (rev 63)
@@ -24,6 +24,6 @@
int os_same(void **, const char *);
-unsigned long os_seek(void **, unsigned long);
-unsigned long os_read(void **, void *, unsigned long);
-unsigned long os_write(void **, const void *, unsigned long);
+off_t os_seek(void **, off_t);
+ssize_t os_read(void **, void *, ssize_t);
+ssize_t os_write(void **, const void *, ssize_t);
More information about the Pancutan-commits
mailing list