[klibc] bunch of small fixes

maximilian attems max at stro.at
Fri Mar 28 13:32:14 PDT 2008


hello hpa,

updated/rebased my klibc merge branch.

David critized the toxonice fstype support due to the
missing real MAGIC of tuxonice. I agree that "z" and "Z"
leaves too much room for misrecognition thus patch dropped.
added a quick utils cleanup and a mknod switch.


please pull
git pull git://git.debian.org/~maks/klibc.git maks


for the changes:
Aaron Griffin (1):
      [klibc] kinit: skip md assembly if mdX exists

Colin Watson (1):
      [klibc] mount/umount FUSE support

David Flynn (1):
      [klibc] nfsmount: added options support for [no]acl

Michal Sojka (1):
      [klibc] ipconfig: fix indef loop with multiple interfaces

Stephane Chazelas (2):
      [klibc] fstype: fix size returned for jfs
      [klibc] fstype: nilfs2 support

maximilian attems (4):
      [klibc] Kbuild.install header install target cleanup
      [klibc] .gitingore: move havesyscall.h entry to top .gitignore
      [klibc] utils: quick codingstyle cleanups
      [klibc] mknod: allow to specify mode

with the diffstat:
 .gitignore                   |    3 ++
 scripts/Kbuild.install       |    8 ++--
 usr/include/klibc/.gitignore |    1 -
 usr/kinit/do_mounts_md.c     |    4 ++
 usr/kinit/fstype/fstype.c    |   17 ++++++++-
 usr/kinit/fstype/nilfs_fs.h  |   64 +++++++++++++++++++++++++++++++++
 usr/kinit/ipconfig/main.c    |    1 +
 usr/kinit/nfsmount/main.c    |    2 +
 usr/utils/dmesg.c            |    6 ++--
 usr/utils/halt.c             |   81 ++++++++++++++++++++++--------------------
 usr/utils/minips.c           |    4 ++-
 usr/utils/mknod.c            |   16 +++++++-
 usr/utils/mount_main.c       |   12 +++++--
 usr/utils/nuke.c             |    3 +-
 usr/utils/sleep.c            |    2 +-
 usr/utils/umount.c           |    8 +++-
 usr/utils/uname.c            |    9 +++--
 17 files changed, 179 insertions(+), 62 deletions(-)
 delete mode 100644 usr/include/klibc/.gitignore
 create mode 100644 usr/kinit/fstype/nilfs_fs.h


thanks
maks

commit 045990b374200b1fb6deebfba7c1ba1970e3b158
Author: maximilian attems <max at stro.at>
Date:   Fri Mar 28 20:49:35 2008 +0100

    [klibc] mknod: allow to specify mode
    
    some bootup scripts assume that you can set permissions.
    -> http://bugs.debian.org/469577
    this allows for static dev to set permissions of devices
    without leaving root holes.
    
    inspiration taken on mknod from klibc-extra of archlinux.
    size increase is not big compaired to gain:
    size usr/utils/shared/mknod
       text    data     bss     dec     hex filename
        978       0       8     986     3da usr/utils/shared/mknod.old
       1090       0       8    1098     44a usr/utils/shared/mknod
       9312      32      48    9392    24b0 usr/utils/static/mknod.old
       9520      32      48    9600    2580 usr/utils/static/mknod
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/utils/mknod.c b/usr/utils/mknod.c
index 89f0da4..14f8fdd 100644
--- a/usr/utils/mknod.c
+++ b/usr/utils/mknod.c
@@ -1,12 +1,14 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 
 char *progname;
 
 static __noreturn usage(void)
 {
-	fprintf(stderr, "Usage: %s name {b|c|p} major minor\n", progname);
+	fprintf(stderr, "Usage: %s [-m mode] name {b|c|p} major minor\n",
+			progname);
 	exit(1);
 }
 
@@ -14,11 +16,16 @@ int main(int argc, char *argv[])
 {
 	char *name, *type, typec, *endp;
 	unsigned int major_num, minor_num;
-	mode_t mode;
+	mode_t mode, mode_set = 0;
 	dev_t dev;
 
 	progname = *argv++;
 
+	if (argv[0][0] == '-' && argv[0][1] == 'm' && !argv[0][2]) {
+		mode_set = strtoul(argv[1], &endp, 8);
+		argv += 2;
+	}
+
 	name = *argv++;
 	if (!name)
 		usage();
@@ -66,5 +73,10 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
+	if (mode_set && chmod(name, mode_set)) {
+		perror("chmod");
+		exit(1);
+	}
+
 	exit(0);
 }

commit c841d5ee7fc1bce2a7ac309a9283fcfa77c9f868
Author: maximilian attems <max at stro.at>
Date:   Wed Mar 26 18:03:54 2008 +0100

    [klibc] utils: quick codingstyle cleanups
    
    * nuke trailing spaces, non tab indenting, add missing space
    * goto labels aren't indented
    * don't assign in if condition

diff --git a/usr/utils/dmesg.c b/usr/utils/dmesg.c
index 877330b..8d2a719 100644
--- a/usr/utils/dmesg.c
+++ b/usr/utils/dmesg.c
@@ -20,7 +20,7 @@ int main(int argc, char *argv[])
 	int i = 0;
 
 	while ((opt = getopt(argc, argv, "c")) != -1) {
-		switch(opt) {
+		switch (opt) {
 		/* Read and clear all messages remaining in the ring buffer */
 		case 'c':
 			cmd = 4;
@@ -53,10 +53,10 @@ int main(int argc, char *argv[])
 	while (buf[i] && i < len)
 		switch (buf[i]) {
 		case '<':
-			if (i == 0 || buf[i-1] == '\n')	
+			if (i == 0 || buf[i-1] == '\n')
 				i++;
 		case '0' ... '9':
-			if (i > 0 && buf[i-1] == '<')	
+			if (i > 0 && buf[i-1] == '<')
 				i++;
 		case '>':
 			if (i > 0 && isdigit(buf[i-1]))
diff --git a/usr/utils/halt.c b/usr/utils/halt.c
index a6656b5..eed0a46 100644
--- a/usr/utils/halt.c
+++ b/usr/utils/halt.c
@@ -6,50 +6,53 @@
 
 static __noreturn usage(void)
 {
-       static char mesg[] = "Usage: {halt|reboot|poweroff} [-n]\n";
-       write(2, mesg, sizeof(mesg) - 1);
-       exit(1);
+	static char mesg[] = "Usage: {halt|reboot|poweroff} [-n]\n";
+	write(2, mesg, sizeof(mesg) - 1);
+	exit(1);
 }
 
 int main(int argc, char *argv[])
 {
-       int cmd = 0; /* initalize to shut gcc up */
-       int do_sync = 1;
-       char *ptr, *ptr2;
+	int cmd = 0; /* initalize to shut gcc up */
+	int do_sync = 1;
+	char *ptr, *ptr2;
 
-       /* Which action (program name)? */
-       ptr2 = ptr = argv[0];
-       while (*ptr2)
-               if (*ptr2++ == '/')
-                       ptr = ptr2;
-       if (*ptr == 'r')
-               cmd = LINUX_REBOOT_CMD_RESTART;
-       else if (*ptr == 'h')
-               cmd = LINUX_REBOOT_CMD_HALT;
-       else if (*ptr == 'p')
-               cmd = LINUX_REBOOT_CMD_POWER_OFF;
-       else
-               usage();
+	/* Which action (program name)? */
+	ptr2 = ptr = argv[0];
+	while (*ptr2)
+		if (*ptr2++ == '/')
+			ptr = ptr2;
+	if (*ptr == 'r')
+		cmd = LINUX_REBOOT_CMD_RESTART;
+	else if (*ptr == 'h')
+		cmd = LINUX_REBOOT_CMD_HALT;
+	else if (*ptr == 'p')
+		cmd = LINUX_REBOOT_CMD_POWER_OFF;
+	else
+		usage();
 
-       /* Walk options */
-       while (*++argv && **argv == '-')
-               switch (*++*argv) {
-                       case 'f': break; /* -f assumed */
-                       case 'n': do_sync = 0; break;
-                       default:
-                               usage();
-               }
-       if (*argv)
-               usage(); /* any args == error */
+	/* Walk options */
+	while (*++argv && **argv == '-')
+		switch (*++*argv) {
+		case 'f':
+			break; /* -f assumed */
+		case 'n':
+			do_sync = 0;
+			break;
+		default:
+			usage();
+		}
+	if (*argv)
+		usage(); /* any args == error */
 
-       if (do_sync)
-               sync();
-       reboot(LINUX_REBOOT_CMD_CAD_OFF); /* Enable CTRL+ALT+DEL */
-       if (!reboot(cmd)) {
-               /* Success. Currently, CMD_HALT returns, so stop the world */
-               /* kill(-1, SIGSTOP); */
-               kill(getpid(), SIGSTOP);
-       }
-       write(2, "failed.\n", 8);
-       return 1;
+	if (do_sync)
+		sync();
+	reboot(LINUX_REBOOT_CMD_CAD_OFF); /* Enable CTRL+ALT+DEL */
+	if (!reboot(cmd)) {
+		/* Success. Currently, CMD_HALT returns, so stop the world */
+		/* kill(-1, SIGSTOP); */
+		kill(getpid(), SIGSTOP);
+	}
+	write(2, "failed.\n", 8);
+	return 1;
 }
diff --git a/usr/utils/minips.c b/usr/utils/minips.c
index fabf8b6..2547e28 100644
--- a/usr/utils/minips.c
+++ b/usr/utils/minips.c
@@ -303,8 +303,10 @@ static int stat2proc(int pid)
 	int fd;
 	char *tmp;
 	struct stat sb;		/* stat() used to get EUID */
+
 	snprintf(buf, 32, "/proc/%d/stat", pid);
-	if ((fd = open(buf, O_RDONLY, 0)) == -1)
+	fd = open(buf, O_RDONLY, 0);
+	if (fd == -1)
 		return 0;
 	num = read(fd, buf, sizeof buf - 1);
 	fstat(fd, &sb);
diff --git a/usr/utils/mount_main.c b/usr/utils/mount_main.c
index 2fea3e3..cf5db69 100644
--- a/usr/utils/mount_main.c
+++ b/usr/utils/mount_main.c
@@ -22,7 +22,7 @@ do_mount(char *dev, char *dir, char *type, unsigned long rwflag, void *data)
 	int error = 0;
 
 	while ((s = strsep(&type, ",")) != NULL) {
-	      retry:
+retry:
 		if (mount(dev, dir, s, rwflag, data) == -1) {
 			error = errno;
 			/*
diff --git a/usr/utils/nuke.c b/usr/utils/nuke.c
index 829bd05..0a282c8 100644
--- a/usr/utils/nuke.c
+++ b/usr/utils/nuke.c
@@ -65,7 +65,8 @@ static int nuke_dir(const char *what)
 	struct dirent *d;
 	int err = 0;
 
-	if (!(dir = opendir(what))) {
+	dir = opendir(what);
+	if (!dir) {
 		/* EACCES means we can't read it.  Might be empty and removable;
 		   if not, the rmdir() in nuke() will trigger an error. */
 		return (errno == EACCES) ? 0 : errno;
diff --git a/usr/utils/sleep.c b/usr/utils/sleep.c
index 5df6aee..62b2238 100644
--- a/usr/utils/sleep.c
+++ b/usr/utils/sleep.c
@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
 
 	return 0;
 
-      err:
+err:
 	fprintf(stderr, "Usage: %s seconds[.fraction]\n", argv[0]);
 	return 1;
 }
diff --git a/usr/utils/uname.c b/usr/utils/uname.c
index 704e385..6ea4dbe 100644
--- a/usr/utils/uname.c
+++ b/usr/utils/uname.c
@@ -28,7 +28,7 @@ enum uname_fields {
 	UN_NR_FIELDS
 };
 
-static void usage(FILE * stream, const char *progname)
+static void usage(FILE *stream, const char *progname)
 {
 	fprintf(stream,
 		"Usage: %s [OPTION] . . .\n"
@@ -53,7 +53,8 @@ static char *make_hardware(const char *machine)
 {
 	char *hardware;
 
-	if (!(hardware = strdup(machine))) {
+	hardware = strdup(machine);
+	if (!hardware) {
 		fprintf(stderr, "strdup() failed: %s\n", strerror(errno));
 		goto end;
 	}
@@ -61,7 +62,7 @@ static char *make_hardware(const char *machine)
 	    && hardware[0] == 'i' && hardware[2] == '8' && hardware[3] == '6') {
 		hardware[1] = '3';
 	}
-      end:
+end:
 	return hardware;
 }
 
@@ -147,7 +148,7 @@ int main(int argc, char *argv[])
 
 	ec = 0;
 
-      end:
+end:
 	if (uname_fields[UN_HARDWARE])
 		free(uname_fields[UN_HARDWARE]);
 	return ec;

commit f355c659665b32ada937f65e44c45fde1ef6e666
Author: Michal Sojka <sojkam1 at fel.cvut.cz>
Date:   Tue Mar 25 16:09:44 2008 +0100

    [klibc] ipconfig: fix indef loop with multiple interfaces
    
    if ipconfig is run as ipconfig :::::: (i.e. long spec with all fields empty)
    and the computer has multiple network interfaces and only one of them is
    connected to dhcp managed network, ipconfig ends up in an infinite loop (see
    the log bellow).
    
    The following patch solved this for me. According to README, if the <device>
    in the long spec is empty, the first interface should be used, but the
    program busy wait for all interfaces.
    
    (easily testable on any laptop with 2 interfaces eth0 and wlan0,
     fixed ipconfig no longer loops indefinitely:
     ./src/klibc/usr/kinit/ipconfig/static/ipconfig -d ::::::
    IP-Config: eth0 hardware address 00:16:d3:3e:31:5c mtu 1500 DHCP RARP
    IP-Config: wlan0 hardware address 00:13:e8:70:59:fb mtu 1500 DHCP RARP
    IP-Config: eth0 guessed broadcast address 128.131.48.255
    IP-Config: eth0 complete (from 128.131.48.127):
     address: 128.131.48.177   broadcast: 128.131.48.255   netmask: 255.255.255.0
     gateway: 128.131.48.1     dns0     : 128.130.4.3      dns1   : 128.131.4.3
     domain : itp.tuwien.ac.at
     rootserver: 128.131.48.127 rootpath:
     filename  : /pxelinux.0
    )
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index 50141e5..72bfdaf 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -534,6 +534,7 @@ static int parse_device(struct netdev *dev, const char *ip)
 	if (dev->name == NULL ||
 	    dev->name[0] == '\0' || strcmp(dev->name, "all") == 0) {
 		add_all_devices(dev);
+		bringup_first = 1;
 		return 0;
 	}
 	return 1;

commit 00cd50a5377c135abad3506f5c46984f8bc563d2
Author: Stephane Chazelas <Stephane_Chazelas at yahoo.fr>
Date:   Mon Mar 3 17:24:18 2008 +0000

    [klibc] fstype: nilfs2 support
    
    this patch adds support for the NILFS2 (http://www.nilfs.org/)
    filesystem to fstype (on top of 1.5.7 from the debian package).
    Please let me know what you think.
    
    (note debian sid has no mkfs.nilfs2, compile tested. -maks)
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/kinit/fstype/fstype.c b/usr/kinit/fstype/fstype.c
index a7b3e1f..eee3431 100644
--- a/usr/kinit/fstype/fstype.c
+++ b/usr/kinit/fstype/fstype.c
@@ -33,6 +33,7 @@
 #include "squashfs_fs.h"
 #include "gfs2_fs.h"
 #include "ocfs2_fs.h"
+#include "nilfs_fs.h"
 
 /*
  * Slightly cleaned up version of jfs_superblock to
@@ -328,6 +329,19 @@ static int ocfs2_image(const void *buf, unsigned long long *bytes)
 	return 0;
 }
 
+static int nilfs2_image(const void *buf, unsigned long long *bytes)
+{
+	const struct nilfs_super_block *sb =
+	    (const struct nilfs_super_block *)buf;
+
+	if (sb->s_magic == __cpu_to_le16(NILFS_SUPER_MAGIC) &&
+	    sb->s_rev_level == __cpu_to_le32(2)) {
+		*bytes = (unsigned long long)__le64_to_cpu(sb->s_dev_size);
+		return 1;
+	}
+	return 0;
+}
+
 struct imagetype {
 	off_t block;
 	const char name[12];
@@ -356,6 +370,7 @@ static struct imagetype images[] = {
 	{1, "ext3", ext3_image},
 	{1, "ext2", ext2_image},
 	{1, "minix", minix_image},
+	{1, "nilfs2", nilfs2_image},
 	{2, "ocfs2", ocfs2_image},
 	{8, "reiserfs", reiserfs_image},
 	{64, "reiserfs", reiserfs_image},
diff --git a/usr/kinit/fstype/nilfs_fs.h b/usr/kinit/fstype/nilfs_fs.h
new file mode 100644
index 0000000..0845edf
--- /dev/null
+++ b/usr/kinit/fstype/nilfs_fs.h
@@ -0,0 +1,64 @@
+#ifndef __NILFS_FS_H
+#define __NILFS_FS_H
+
+#define NILFS_SUPER_MAGIC       0x3434  /* NILFS filesystem  magic number */
+
+/*
+ * struct nilfs_super_block - structure of super block on disk
+ */
+struct nilfs_super_block {
+	__le32	s_rev_level;		/* Revision level */
+	__le16	s_minor_rev_level;	/* minor revision level */
+	__le16	s_magic;		/* Magic signature */
+
+	__le16  s_bytes;		/* Bytes count of CRC calculation
+					   for this structure. s_reserved
+					   is excluded. */
+	__le16  s_flags;		/* flags */
+	__le32  s_crc_seed;		/* Seed value of CRC calculation */
+	__le32	s_sum;			/* Check sum of super block */
+
+	__le32	s_log_block_size;	/* Block size represented as follows
+					   blocksize = 1 << (s_log_block_size + 10) */
+	__le64  s_nsegments;		/* Number of segments in filesystem */
+	__le64  s_dev_size;		/* block device size in bytes */
+	__le64	s_first_data_block;	/* 1st seg disk block number */
+	__le32  s_blocks_per_segment;   /* number of blocks per full segment */
+	__le32	s_r_segments_percentage;/* Reserved segments percentage */ /* or __le16 */
+
+	__le64  s_last_cno;		/* Last checkpoint number */
+	__le64  s_last_pseg;		/* disk block addr pseg written last */
+	__le64  s_last_seq;             /* seq. number of seg written last */
+	__le64	s_free_blocks_count;	/* Free blocks count */
+
+	__le64	s_ctime;		/* Creation time (execution time of newfs) */
+	__le64	s_mtime;		/* Mount time */
+	__le64	s_wtime;		/* Write time */
+	__le16	s_mnt_count;		/* Mount count */
+	__le16	s_max_mnt_count;	/* Maximal mount count */
+	__le16	s_state;		/* File system state */
+	__le16	s_errors;		/* Behaviour when detecting errors */
+	__le64	s_lastcheck;		/* time of last check */
+
+	__le32	s_checkinterval;	/* max. time between checks */
+	__le32	s_creator_os;		/* OS */
+	__le16	s_def_resuid;		/* Default uid for reserved blocks */
+	__le16	s_def_resgid;		/* Default gid for reserved blocks */
+	__le32	s_first_ino; 		/* First non-reserved inode */ /* or __le16 */
+
+	__le16  s_inode_size; 		/* Size of an inode */
+	__le16  s_dat_entry_size;       /* Size of a dat entry */
+	__le16  s_checkpoint_size;      /* Size of a checkpoint */
+	__le16	s_segment_usage_size;	/* Size of a segment usage */
+
+	__u8	s_uuid[16];		/* 128-bit uuid for volume */
+	char	s_volume_name[16]; 	/* volume name */
+	char	s_last_mounted[64]; 	/* directory where last mounted */
+
+	__le32  s_c_interval;           /* Commit interval of segment */
+	__le32  s_c_block_max;          /* Threshold of data amount for
+					   the segment construction */
+	__u32	s_reserved[192];	/* padding to the end of the block */
+};
+
+#endif /* __NILFS_FS_H */

commit 88273c3e9f78c9064d159397fa26cbd713c0bb3f
Author: David Flynn <davidf at rd.bbc.co.uk>
Date:   Tue Feb 26 17:21:11 2008 +0000

    [klibc] nfsmount: added options support for [no]acl
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/kinit/nfsmount/main.c b/usr/kinit/nfsmount/main.c
index 2e2eec7..e9f8a0e 100644
--- a/usr/kinit/nfsmount/main.c
+++ b/usr/kinit/nfsmount/main.c
@@ -70,6 +70,8 @@ static struct bool_opts {
 	{"noac", ~NFS_MOUNT_NOAC, NFS_MOUNT_NOAC},
 	{"lock", ~NFS_MOUNT_NONLM, 0},
 	{"nolock", ~NFS_MOUNT_NONLM, NFS_MOUNT_NONLM},
+	{"acl", ~NFS_MOUNT_NOACL, 0},
+	{"noacl", ~NFS_MOUNT_NOACL, NFS_MOUNT_NOACL},
 	{"v2", ~NFS_MOUNT_VER3, 0},
 	{"v3", ~NFS_MOUNT_VER3, NFS_MOUNT_VER3},
 	{"udp", ~NFS_MOUNT_TCP, 0},

commit 74577105a1ee9fbf452b7a7ebb17737f43708c7d
Author: Stephane Chazelas <Stephane_Chazelas at yahoo.fr>
Date:   Mon Mar 3 17:15:05 2008 +0000

    [klibc] fstype: fix size returned for jfs
    
    I've noticed that the size returned by the fstype utility was
    not correct for JFS filesystems (it returns the size in number
    of HW blocks instead of bytes).
    
    Here is a simple patch that addresses it (based on 1.5.7 from
    the debian package).
    
    (easily testable:
    
    lvcreate -L 1G -n jfstest dualvg0
      Logical volume "jfstest" created
    
    mkfs.jfs -q /dev/dualvg0/jfstest > /dev/null
    
    /usr/lib/klibc/bin/fstype  /dev/dualvg0/jfstest
     FSTYPE=jfs
     FSSIZE=2088488
    
    fstype with aboves patch applied gives:
     ./usr/kinit/fstype/static/fstype /dev/mapper/dualvg0-jfstest
     FSTYPE=jfs
     FSSIZE=1069305856
    )
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/kinit/fstype/fstype.c b/usr/kinit/fstype/fstype.c
index ea7171b..a7b3e1f 100644
--- a/usr/kinit/fstype/fstype.c
+++ b/usr/kinit/fstype/fstype.c
@@ -205,7 +205,7 @@ static int jfs_image(const void *buf, unsigned long long *bytes)
 	const struct jfs_superblock *sb = (const struct jfs_superblock *)buf;
 
 	if (!memcmp(sb->s_magic, JFS_MAGIC, 4)) {
-		*bytes = __le32_to_cpu(sb->s_size);
+		*bytes = __le64_to_cpu(sb->s_size) << __le16_to_cpu(sb->s_l2pbsize);
 		return 1;
 	}
 	return 0;

commit cd105a470d58a98d0c917874f53ad804e003f7ec
Author: Colin Watson <cjwatson at ubuntu.com>
Date:   Tue Mar 25 10:38:07 2008 +0100

    [klibc] mount/umount FUSE support
    
    add -i and -f options as fuse does:
    	execl("/bin/mount", "/bin/mount", "-i", "-f", "-t", type, "-o", opts,
    		fsname, mnt, NULL);
    
    it is relevant if someone tries to put ntfs-3g in the initramfs.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/utils/mount_main.c b/usr/utils/mount_main.c
index fd62000..2fea3e3 100644
--- a/usr/utils/mount_main.c
+++ b/usr/utils/mount_main.c
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
 	rwflag = MS_VERBOSE;
 
 	do {
-		c = getopt(argc, argv, "no:rt:w");
+		c = getopt(argc, argv, "no:rt:wfi");
 		if (c == EOF)
 			break;
 		switch (c) {
@@ -83,6 +83,12 @@ int main(int argc, char *argv[])
 		case 'w':
 			rwflag &= ~MS_RDONLY;
 			break;
+		case 'f':
+			/* we can't edit /etc/mtab yet anyway; exit */
+			exit(0);
+		case 'i':
+			/* ignore for now; no support for mount helpers */
+			break;
 		case '?':
 			fprintf(stderr, "%s: invalid option -%c\n",
 				progname, optopt);
@@ -98,7 +104,7 @@ int main(int argc, char *argv[])
 		type = "none";
 
 	if (optind + 2 != argc || type == NULL) {
-		fprintf(stderr, "Usage: %s [-r] [-w] [-o options] [-t type] "
+		fprintf(stderr, "Usage: %s [-r] [-w] [-o options] [-t type] [-f] [-i] "
 			"[-n] device directory\n", progname);
 		exit(1);
 	}
diff --git a/usr/utils/umount.c b/usr/utils/umount.c
index 85497a7..4469297 100644
--- a/usr/utils/umount.c
+++ b/usr/utils/umount.c
@@ -17,7 +17,7 @@ int main(int argc, char *argv[])
 	progname = argv[0];
 
 	do {
-		c = getopt(argc, argv, "fl");
+		c = getopt(argc, argv, "fli");
 		if (c == EOF)
 			break;
 		switch (c) {
@@ -27,6 +27,9 @@ int main(int argc, char *argv[])
 		case 'l':
 			flag |= MNT_DETACH;
 			break;
+		case 'i':
+			/* ignore for now; no support for umount helpers */
+			break;
 		case '?':
 			fprintf(stderr, "%s: invalid option -%c\n",
 				progname, optopt);
@@ -35,7 +38,8 @@ int main(int argc, char *argv[])
 	} while (1);
 
 	if (optind + 1 != argc) {
-		fprintf(stderr, "Usage: %s [-f] [-l] mntpoint\n", progname);
+		fprintf(stderr, "Usage: %s [-f] [-l] [-i] mntpoint\n",
+			progname);
 		return 1;
 	}
 

commit 6752cb2fe4134b9daaf6121cf3413f571d2c979d
Author: maximilian attems <max at stro.at>
Date:   Tue Mar 25 10:25:30 2008 +0100

    [klibc] .gitingore: move havesyscall.h entry to top .gitignore
    
    it seems that .gitignore honours pathes, thus move
    the include/klibc/.gitignore line to top.
    otherwise we end up shipping this file in the header target.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/.gitignore b/.gitignore
index d67ae65..efc15f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,6 @@
 *.o.cmd
 .*.cmd
 *.g
+
+# generated header
+usr/include/klibc/havesyscall.h
diff --git a/usr/include/klibc/.gitignore b/usr/include/klibc/.gitignore
deleted file mode 100644
index 8246d7f..0000000
--- a/usr/include/klibc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-havesyscall.h

commit d33c99c558a7cf8ab3dad63fd89a634dcaebb469
Author: maximilian attems <max at stro.at>
Date:   Wed Dec 12 00:42:10 2007 +0100

    [klibc] Kbuild.install header install target cleanup
    
    - only create a dir if we really copy stuff to it.
    - add dual arch asm target (seen missing due to latest x86 arch merge)
    - headers_install in linux-2.6 exports no scsi headers anymore
    
    Cc: Sam Ravnborg <sam at ravnborg.org>
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
index 1575169..44c8f76 100644
--- a/scripts/Kbuild.install
+++ b/scripts/Kbuild.install
@@ -95,12 +95,12 @@ header:
 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
-	$(Q)set -e ; for d in linux scsi asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \
-	  mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \
+	$(Q)set -e ; for d in linux asm asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \
 	  for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \
 	           $(KLIBCKERNELOBJ)/include2 ; do \
-	    [ ! -d $$r/$$d ] || \
-	      cp -rfL $$r/$$d/. \
+	    [ ! -d $$r/$$d ] && continue; \
+	    mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \
+	    cp -rfL $$r/$$d/. \
 	          $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
 	  done ; \
 	done

commit 9a6c1084bf4296840c0ed3877839af91c4ac2de3
Author: Aaron Griffin <aaronmgriffin at gmail.com>
Date:   Tue Sep 4 12:22:43 2007 +0200

    [klibc] kinit: skip md assembly if mdX exists
    
    mkinitcpio initramfs(?) tries to start root MD device twice
    http://bugs.archlinux.org/task/4938
    
    Belows patch shipped for one year in Archlinux,
    which seems to be an heavy kinit user.  -maks
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/kinit/do_mounts_md.c b/usr/kinit/do_mounts_md.c
index e5bbe21..c1c8b01 100644
--- a/usr/kinit/do_mounts_md.c
+++ b/usr/kinit/do_mounts_md.c
@@ -227,6 +227,7 @@ static void md_setup_drive(void)
 		char *devname;
 		mdu_disk_info_t dinfo;
 		char name[16];
+		struct stat st_chk;
 
 		dev_minor = md_setup_args[ent].minor;
 		partitioned = md_setup_args[ent].partitioned;
@@ -235,6 +236,9 @@ static void md_setup_drive(void)
 		snprintf(name, sizeof name,
 			 "/dev/md%s%d", partitioned ? "_d" : "", dev_minor);
 
+		if (stat(name, &st_chk) == 0)
+			continue;
+
 		if (partitioned)
 			dev = makedev(mdp_major(), dev_minor << MdpMinorShift);
 		else



More information about the klibc mailing list