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.
+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"
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
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
+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
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);
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.
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");
signal (SIGUSR2, terminate_intr);
}
-static void uncapture_terminate(NOARGS)
+static void uncapture_terminate(void)
{
terminate_addr = NULL;
signal (SIGHUP, SIG_DFL);
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
{
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);
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);
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;
* fsck.h
*/
+#include <time.h>
+
#ifdef __STDC__
#define NOARGS void
#else
};
extern char *base_device(char *device);
-
+extern char *string_copy(const char *s);
#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);
(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))
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;
return NULL;
}
-static u_char
-fromhex(char c) {
+static char fromhex(char c)
+{
if (isdigit(c))
return (c - '0');
else if (islower(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 ||
/*
* 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);