[klibc] bunch of small fixes

maximilian attems max at stro.at
Tue Mar 25 02:53:37 PDT 2008


hello hpa,

nothing particular stands out,
just syncing with latest Debian upload and subsequent patch emails.

please review merge or nack.
thanks :)
maks

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

Harald Jenny (1):
      [klibc] fstype: tuxonice swap signature

maximilian attems (2):
      [klibc] Kbuild.install header install target cleanup
      [klibc] .gitingore: move havesyscall.h entry to top .gitignore


 .gitignore                   |    3 +++
 scripts/Kbuild.install       |    8 ++++----
 usr/include/klibc/.gitignore |    1 -
 usr/kinit/do_mounts_md.c     |    4 ++++
 usr/kinit/fstype/fstype.c    |    4 +++-
 usr/kinit/fstype/swap_fs.h   |    5 +++++
 usr/utils/mount_main.c       |   10 ++++++++--
 usr/utils/umount.c           |    8 ++++++--
 8 files changed, 33 insertions(+), 10 deletions(-)
 delete mode 100644 usr/include/klibc/.gitignore


commit 16196c58c8d78b3cb286c6a407a3cc802025e58e
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 eb3edc45fd0c5849331ff1b0ccaa4da348b97609
Author: Harald Jenny <harald at a-little-linux-box.at>
Date:   Mon Mar 24 20:03:20 2008 +0100

    [klibc] fstype: tuxonice swap signature
    
    please find attached a patch which adds support for tuxonice (formerly
    suspend2) swap partition recognition to klibc-utils 1.5.8-1. It adds two
    new signatures to swap space detection which are used by tuxonice in
    version 3.0-rc5 (don't know when they were put in use, but fstype
    stopped working for me some time ago).
    
    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..c8fa94c 100644
--- a/usr/kinit/fstype/fstype.c
+++ b/usr/kinit/fstype/fstype.c
@@ -244,7 +244,9 @@ static int suspend_image(const void *buf, unsigned long long *blocks)
 
 	if (!memcmp(ssb->magic, SUSP_MAGIC_1, SUSP_MAGIC_L) ||
 	    !memcmp(ssb->magic, SUSP_MAGIC_2, SUSP_MAGIC_L) ||
-	    !memcmp(ssb->magic, SUSP_MAGIC_U, SUSP_MAGIC_L)) {
+	    !memcmp(ssb->magic, SUSP_MAGIC_U, SUSP_MAGIC_L) ||
+	    !memcmp(ssb->magic, TOI_MAGIC_1, TOI_MAGIC_L) ||
+	    !memcmp(ssb->magic, TOI_MAGIC_2, TOI_MAGIC_L)) {
 		*blocks = 0;
 		return 1;
 	}
diff --git a/usr/kinit/fstype/swap_fs.h b/usr/kinit/fstype/swap_fs.h
index 7b7fddb..f76bf02 100644
--- a/usr/kinit/fstype/swap_fs.h
+++ b/usr/kinit/fstype/swap_fs.h
@@ -13,6 +13,11 @@
 #define SUSP_MAGIC_2		"S2SUSPEND"
 #define SUSP_MAGIC_U		"ULSUSPEND"
 
+/* TuxOnIce signatures, located at same addr as swap magic */
+#define TOI_MAGIC_L		1
+#define TOI_MAGIC_1		"z"
+#define TOI_MAGIC_2		"Z"
+
 /* The superblock is the last block in the first page */
 #define SWAP_OFFSET()		((getpagesize() - 1024) >> 10)
 

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