Whamcloud - gitweb
Many files:
authorTheodore Ts'o <tytso@mit.edu>
Sat, 6 Jan 2001 04:20:03 +0000 (04:20 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 6 Jan 2001 04:20:03 +0000 (04:20 +0000)
  get_device_by_label.h (get_volume_label_by_spec): Add function prototype.
  get_device_by_label.c: Use string_copy() instead of strdup() for
   portability's sake.  Fix a few other gcc -Wall complaints.
  fsck.h, fsck.c (string_copy): Export string_copy() extern.
  badblocks.c: Fix various gcc -Wall complaints, including an incorrect
   reference to sync in flush_bufs().
ChangeLog, configure, configure.in:
  configure.in: Add checks for the header files sys/mkdev.h and
   sys/sysmacros.h.

ChangeLog
configure
configure.in
misc/ChangeLog
misc/badblocks.c
misc/fsck.c
misc/fsck.h
misc/get_device_by_label.c
misc/get_device_by_label.h

index e6130c1..85d9190 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-01-05    <tytso@snap.thunk.org>
+
+       * configure.in: Add checks for the header files sys/mkdev.h and
+               sys/sysmacros.h.
+
 2000-12-08    <tytso@snap.thunk.org>
 
        * MCONFIG.in, Makefile.in: Fix so that top-level "make check"
index 0f2ec53..a8f0b06 100644 (file)
--- a/configure
+++ b/configure
@@ -3951,7 +3951,7 @@ test -n "$BUILD_CC" && break
 done
 
 fi
-for ac_hdr in stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/mount.h sys/sockio.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h
+for ac_hdr in stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/mkdev.h sys/mount.h sys/sockio.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
index 6c960f9..a1343ed 100644 (file)
@@ -383,7 +383,7 @@ if test $cross_compiling = no; then
 else
   AC_CHECK_PROGS(BUILD_CC, gcc cc)
 fi
-AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/mount.h sys/sockio.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h)
+AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/mkdev.h sys/mount.h sys/sockio.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h)
 AC_FUNC_VPRINTF
 dnl
 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
index 2ba1819..f9991f0 100644 (file)
@@ -1,3 +1,17 @@
+2001-01-05    <tytso@snap.thunk.org>
+
+       * get_device_by_label.h (get_volume_label_by_spec): Add function
+               prototype.
+
+       * get_device_by_label.c: Use string_copy() instead of strdup() for
+               portability's sake.  Fix a few other gcc -Wall
+               complaints. 
+
+       * fsck.c (string_copy): Export string_copy() extern.
+
+       * badblocks.c: Fix various gcc -Wall complaints, including
+               an incorrect reference to sync in flush_bufs().
+
 2001-01-03    <tytso@snap.thunk.org>
 
        * tune2fs.c (update_feature_set, add_journal): Moved to separate
index 66e352b..8c72885 100644 (file)
@@ -66,7 +66,7 @@ static int w_flag = 0;                        /* do r/w test: 0=no, 1=yes,
 static int s_flag = 0;                 /* show progress of test */
 static int force = 0;                  /* force check of mounted device */
 
-static void usage(NOARGS)
+static void usage(void)
 {
        fprintf(stderr, _("Usage: %s [-b block_size] [-i input_file] [-o output_file] [-svwnf]\n [-c blocks_at_once] [-p num_passes] device [blocks_count [start_count]]\n"),
                 program_name);
@@ -80,9 +80,6 @@ static FILE *out;
 static blk_t next_bad = 0;
 static ext2_badblocks_iterate bb_iter = NULL;
 
-/* Everything is STDC, these days */
-#define NOARGS void
-
 /*
  * This routine reports a new bad block.  If the bad block has already
  * been seen before, then it returns 0; otherwise it returns 1.
@@ -111,7 +108,7 @@ static int bb_output (unsigned long bad)
        return 1;
 }
 
-static void print_status(NOARGS)
+static void print_status(void)
 {
        fprintf(stderr, "%9ld/%9ld", currently_testing, num_blocks);
        fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
@@ -149,7 +146,7 @@ static void capture_terminate(jmp_buf term_addr)
        signal (SIGUSR2, terminate_intr);
 }
 
-static void uncapture_terminate(NOARGS)
+static void uncapture_terminate(void)
 {
        terminate_addr = NULL;
        signal (SIGHUP, SIG_DFL);
@@ -220,10 +217,10 @@ static int host_dev;
 static void flush_bufs (int dev)
 {
 #ifdef HAVE_FDATASYNC
-  if (sync && fdatasync (dev) == -1)
+  if (fdatasync (dev) == -1)
     com_err (program_name, errno, _("during fdatasync"));
 #else
-  if (sync && fsync (dev) == -1)
+  if (fsync (dev) == -1)
     com_err (program_name, errno, _("during fsync"));
 #endif
 
@@ -321,7 +318,7 @@ static unsigned int test_rw (int dev, unsigned long blocks_count,
 {
        int i;
        char * buffer;
-       unsigned char pattern[] = {0xaa, 0x55, 0xff, 0x00};
+       static unsigned char pattern[] = {0xaa, 0x55, 0xff, 0x00};
        unsigned int bb_count = 0;
 
        buffer = malloc (2 * block_size);
@@ -659,9 +656,9 @@ int main (int argc, char ** argv)
        int passes_clean = 0;
        int dev;
        errcode_t errcode;
-       unsigned int (*test_func)(int dev, unsigned long blocks_count,
-                                 int block_size, unsigned long from_count,
-                                 unsigned long blocks_at_once);
+       unsigned int (*test_func)(int, unsigned long,
+                                 int, unsigned long,
+                                 unsigned long);
 
        setbuf(stdout, NULL);
        setbuf(stderr, NULL);
index 8084351..e3f1419 100644 (file)
@@ -106,7 +106,7 @@ const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc";
 char *fsck_path = 0;
 static int ignore(struct fs_info *);
 
-static char *string_copy(const char *s)
+char *string_copy(const char *s)
 {
        char    *ret;
 
index 9fdbce4..9d9f6ea 100644 (file)
@@ -2,6 +2,8 @@
  * fsck.h
  */
 
+#include <time.h>
+
 #ifdef __STDC__
 #define NOARGS void
 #else
@@ -58,4 +60,4 @@ struct fsck_instance {
 };
 
 extern char *base_device(char *device);
-
+extern char *string_copy(const char *s);
index 9ca404a..ee5070d 100644 (file)
 #ifdef HAVE_SYS_MKDEV_H
 #include <sys/mkdev.h>
 #endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
 #include "nls-enable.h"
 #include "get_device_by_label.h"
+#include "fsck.h"
 
 /* function prototype from libext2 */
 extern char *ext2fs_find_block_device(dev_t device);
@@ -155,7 +159,7 @@ uuidcache_init(void) {
                            (statbuf.st_rdev != dev)) {
                                devname = ext2fs_find_block_device(dev);
                        } else
-                               devname = strdup(device);
+                               devname = string_copy(device);
                        if (!devname)
                                continue;
                        if (!get_label_uuid(devname, &label, uuid))
@@ -183,11 +187,11 @@ get_spec_by_x(int n, const char *t) {
                switch (n) {
                case UUID:
                        if (!memcmp(t, uc->uuid, sizeof(uc->uuid)))
-                               return strdup(uc->device);
+                               return string_copy(uc->device);
                        break;
                case VOL:
                        if (!strcmp(t, uc->label))
-                               return strdup(uc->device);
+                               return string_copy(uc->device);
                        break;
                }
                uc = uc->next;
@@ -195,8 +199,8 @@ get_spec_by_x(int n, const char *t) {
        return NULL;
 }
 
-static u_char
-fromhex(char c) {
+static char fromhex(char c)
+{
        if (isdigit(c))
                return (c - '0');
        else if (islower(c))
@@ -206,8 +210,9 @@ fromhex(char c) {
 }
 
 char *
-get_spec_by_uuid(const char *s) {
-       u_char uuid[16];
+get_spec_by_uuid(const char *s)
+{
+       char uuid[16];
        int i;
 
        if (strlen(s) != 36 ||
index f87b27f..2385c14 100644 (file)
@@ -1,10 +1,13 @@
 /*
  * get_device_by_label.h
  *
- * Copyright 1999 by Andries Brouwer and Theodore Ts'o
+ * Copyright 1999 by Andries Brouwer
+ * Copyright 1999, 2000 by Theodore Ts'o
  *
  * This file may be redistributed under the terms of the GNU Public
  * License. 
  */
-char *get_spec_by_uuid(const char *uuid);
-char *get_spec_by_volume_label(const char *volumelabel);
+
+extern char *get_spec_by_uuid(const char *uuid);
+extern char *get_spec_by_volume_label(const char *volumelabel);
+extern const char *get_volume_label_by_spec(const char *spec);