OSDN Git Service

ChangeLog, getsize.c, llseek.c, unix_io.c:
authorTheodore Ts'o <tytso@mit.edu>
Thu, 25 May 2000 23:31:54 +0000 (23:31 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 25 May 2000 23:31:54 +0000 (23:31 +0000)
  getsize.c (ext2fs_get_device_size): Use open64() instead of open() if
  it exists.
  unix_io.c (unix_open): Use open64() instead of open() if it exists.
  llseek.c: Simplify header includes of unistd.h.  If lseek64 is
   available (and prototypes are defined) use it in preference to llseek.

lib/ext2fs/ChangeLog
lib/ext2fs/getsize.c
lib/ext2fs/llseek.c
lib/ext2fs/unix_io.c

index 9bcb2ec..bfd3bf1 100644 (file)
@@ -1,5 +1,15 @@
 2000-05-25    <tytso@snap.thunk.org>
 
+       * getsize.c (ext2fs_get_device_size): Use open64() instead of
+               open() if it exists.
+
+       * unix_io.c (unix_open): Use open64() instead of open() if it
+               exists. 
+
+       * llseek.c: Simplify header includes of unistd.h.  If lseek64 is
+               available (and prototypes are defined) use it in
+               preference to llseek.
+
        * Makefile: Add hack dependency rule so that parallel makes work
                correctly. 
 
index b92ce8d..7f805b4 100644 (file)
@@ -9,6 +9,9 @@
  * %End-Header%
  */
 
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+
 #include <stdio.h>
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -66,7 +69,11 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize,
        char ch;
 #endif /* HAVE_SYS_DISKLABEL_H */
 
+#ifdef HAVE_OPEN64
+       fd = open64(file, O_RDONLY);
+#else
        fd = open(file, O_RDONLY);
+#endif
        if (fd < 0)
                return errno;
 
index d75f42d..27348d9 100644 (file)
@@ -9,6 +9,9 @@
  * %End-Header%
  */
 
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 
 #ifdef __linux__
 
-#ifdef HAVE_LLSEEK
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#if defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)
+
+#define my_llseek lseek64
+
+#elif defined(HAVE_LLSEEK)
 #include <syscall.h>
 
 #ifndef HAVE_LLSEEK_PROTOTYPE
@@ -39,7 +43,7 @@ extern long long llseek (int fd, long long offset, int origin);
 
 #define my_llseek llseek
 
-#else  /* HAVE_LLSEEK */
+#else  /* HAVE_LLSEEK */
 
 #ifdef __alpha__
 
@@ -77,9 +81,9 @@ static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin)
        return (retval == -1 ? (ext2_loff_t) retval : result);
 }
 
-#endif /* HAVE_LLSEEK */
+#endif /* __alpha__ */
 
-#endif /* __alpha__ */
+#endif /* HAVE_LLSEEK */
 
 ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin)
 {
index c46602e..e0cc4db 100644 (file)
@@ -11,6 +11,9 @@
  * %End-Header%
  */
 
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+
 #include <stdio.h>
 #include <string.h>
 #if HAVE_UNISTD_H
@@ -78,6 +81,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
        io_channel      io = NULL;
        struct unix_private_data *data = NULL;
        errcode_t       retval;
+       int             open_flags;
 
        if (name == 0)
                return EXT2_ET_BAD_DEVICE_NAME;
@@ -111,7 +115,12 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
        if (retval)
                goto cleanup;
 
-       data->dev = open(name, (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY);
+       open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
+#ifdef HAVE_OPEN64
+       data->dev = open64(name, open_flags);
+#else
+       data->dev = open(name, open_flags);
+#endif
        if (data->dev < 0) {
                retval = errno;
                goto cleanup;