Large file >2Gib support.
authorEric Andersen <andersen@codepoet.org>
Thu, 21 Sep 2000 02:23:30 +0000 (02:23 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 21 Sep 2000 02:23:30 +0000 (02:23 -0000)
Makefile
coreutils/ls.c
ls.c
more.c
util-linux/more.c

index 278887f36efc9bba577126417d001f65f9095b62..6a9c694fa4a5d6ccef36f5785959b36ed38e2a03 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,16 @@ DODEBUG = false
 # Do not enable this for production builds...
 DODMALLOC = false
 
+# If you want large file summit support, turn this on.
+# This has no effect if you don't have a kernel with lfs
+# support, and a system with libc-2.1.3 or later.
+# Some of the programs that can benefit from lfs support
+# are dd, gzip, mount, tar, and mkfs_minix.
+# LFS allows you to use the above programs for files
+# larger than 2GB!
+DOLFS = false
+
+
 # If you are running a cross compiler, you may want to set this
 # to something more interesting...
 CROSS = #powerpc-linux-
@@ -63,6 +73,10 @@ OPTIMIZATION = $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&
 
 WARNINGS = -Wall
 
+ifeq ($(DOLFS),true)
+    # For large file summit support
+    CFLAGS+=-D_FILE_OFFSET_BITS=64
+endif
 ifeq ($(DODMALLOC),true)
     # For testing mem leaks with dmalloc
     CFLAGS+=-DDMALLOC
index 03fed5478ca886381e47025480ae1af39218da34..b818003a8d5d4a732ec7325cf729ea9ead89ce17 100644 (file)
@@ -532,7 +532,11 @@ int list_single(struct dnode *dn)
                                column += 8;
                                break;
                        case LIST_BLOCKS:
+#if _FILE_OFFSET_BITS == 64
+                               fprintf(stdout, "%4lld ", dn->dstat.st_blocks>>1);
+#else
                                fprintf(stdout, "%4ld ", dn->dstat.st_blocks>>1);
+#endif
                                column += 5;
                                break;
                        case LIST_MODEBITS:
@@ -578,7 +582,11 @@ int list_single(struct dnode *dn)
                                if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
                                        fprintf(stdout, "%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev));
                                } else {
+#if _FILE_OFFSET_BITS == 64
+                                       fprintf(stdout, "%9lld ", dn->dstat.st_size);
+#else
                                        fprintf(stdout, "%9ld ", dn->dstat.st_size);
+#endif
                                }
                                column += 10;
                                break;
diff --git a/ls.c b/ls.c
index 03fed5478ca886381e47025480ae1af39218da34..b818003a8d5d4a732ec7325cf729ea9ead89ce17 100644 (file)
--- a/ls.c
+++ b/ls.c
@@ -532,7 +532,11 @@ int list_single(struct dnode *dn)
                                column += 8;
                                break;
                        case LIST_BLOCKS:
+#if _FILE_OFFSET_BITS == 64
+                               fprintf(stdout, "%4lld ", dn->dstat.st_blocks>>1);
+#else
                                fprintf(stdout, "%4ld ", dn->dstat.st_blocks>>1);
+#endif
                                column += 5;
                                break;
                        case LIST_MODEBITS:
@@ -578,7 +582,11 @@ int list_single(struct dnode *dn)
                                if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
                                        fprintf(stdout, "%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev));
                                } else {
+#if _FILE_OFFSET_BITS == 64
+                                       fprintf(stdout, "%9lld ", dn->dstat.st_size);
+#else
                                        fprintf(stdout, "%9ld ", dn->dstat.st_size);
+#endif
                                }
                                column += 10;
                                break;
diff --git a/more.c b/more.c
index 12168b5192b2040b6fc59cd1bfa857863b6b4ce6..45b7c1274aa65f4f59f583c0ee5aa674dd937ad9 100644 (file)
--- a/more.c
+++ b/more.c
@@ -123,7 +123,11 @@ extern int more_main(int argc, char **argv)
                                lines = 0;
                                len = fprintf(stdout, "--More-- ");
                                if (file != stdin) {
+#if _FILE_OFFSET_BITS == 64
+                                       len += fprintf(stdout, "(%d%% of %lld bytes)",
+#else
                                        len += fprintf(stdout, "(%d%% of %ld bytes)",
+#endif
                                                                   (int) (100 *
                                                                                  ((double) ftell(file) /
                                                                                   (double) st.st_size)),
index 12168b5192b2040b6fc59cd1bfa857863b6b4ce6..45b7c1274aa65f4f59f583c0ee5aa674dd937ad9 100644 (file)
@@ -123,7 +123,11 @@ extern int more_main(int argc, char **argv)
                                lines = 0;
                                len = fprintf(stdout, "--More-- ");
                                if (file != stdin) {
+#if _FILE_OFFSET_BITS == 64
+                                       len += fprintf(stdout, "(%d%% of %lld bytes)",
+#else
                                        len += fprintf(stdout, "(%d%% of %ld bytes)",
+#endif
                                                                   (int) (100 *
                                                                                  ((double) ftell(file) /
                                                                                   (double) st.st_size)),