[klibc] [git patch] klibc bzero, mount fixes + random stuff

maximilian attems max at stro.at
Fri Aug 24 15:03:05 PDT 2007


hello hpa,

please pull for the latest
git pull git://brane.itp.tuwien.ac.at/~mattems/klibc.git maks

with the following shortlog:

maximilian attems (9):
      mount: add nodev, noexec and nosuid options
      mount: add -n option
      cpio: small cleanups
      readlink: s/link/link_name/
      kinit, mknod: s/(major|minor)/\1_num/
      klibc: strcspn, strpbrk, strspn include string.h
      resume, kill: axe unused envp usage
      devname.c: include kinit.h
      add bzero()

and diffstat

 usr/include/string.h      |    1 
 usr/kinit/devname.c       |    2 +
 usr/kinit/do_mounts_md.c  |   18 +++++------
 usr/kinit/name_to_dev.c   |   16 +++++-----
 usr/kinit/resume/resume.c |    2 -
 usr/klibc/Kbuild          |    2 -
 usr/klibc/bzero.c         |    9 +++++
 usr/klibc/strcspn.c       |    1 
 usr/klibc/strpbrk.c       |    1 
 usr/klibc/strspn.c        |    1 
 usr/utils/cpio.c          |   55 +++++++++++++-----------------------
 usr/utils/kill.c          |    2 -
 usr/utils/mknod.c         |    8 ++---
 usr/utils/mount_main.c    |    7 +++-
 usr/utils/mount_opts.c    |    3 +
 usr/utils/readlink.c      |   10 +++---
 16 files changed, 73 insertions(+), 65 deletions(-)

the mount fixes allow thanks to latest dash merge
to run latest bare initramfs-tools without busybox itself. :)

while compiling with -Wnested i get those
usr/klibc/../include/unistd.h: In function 'getpagesize':
usr/klibc/../include/unistd.h:145: warning: nested extern declaration of '__page_size'
usr/klibc/../include/unistd.h: In function '__getpageshift':
usr/klibc/../include/unistd.h:150: warning: nested extern declaration of '__page_shift'

they also appear when compiling udev against klibc, as udev
sets aboves gcc warning. can you enlight me on what's going
on, tried to compile with -E to see if any preprocessor trick
was going on, but..?

-- 
maks


commit 63310d84839af47b0beb304d9722f26a379ff7dd
Author: maximilian attems <max at stro.at>
Date:   Fri Aug 24 23:24:07 2007 +0200

    add bzero()
    
    bzero() contra memset() saves an argument,
    which is about 4 bytes per call on x86.
    
    "In fact, one could argue for making memset() an inline function which
    collapses to bzero if the middle argument is zero." -hpa
    left for a later exercise.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/include/string.h b/usr/include/string.h
index 1a6072c..ae8270e 100644
--- a/usr/include/string.h
+++ b/usr/include/string.h
@@ -17,6 +17,7 @@ __extern void *memmove(void *, const void *, size_t);
 __extern void *memset(void *, int, size_t);
 __extern void *memmem(const void *, size_t, const void *, size_t);
 __extern void memswap(void *, void *, size_t);
+__extern void bzero(void *, size_t);
 __extern int strcasecmp(const char *, const char *);
 __extern int strncasecmp(const char *, const char *, size_t);
 __extern char *strcat(char *, const char *);
diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index ad72116..c8eabf9 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -30,7 +30,7 @@ klib-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \
 	  brk.o sbrk.o malloc.o realloc.o calloc.o \
 	  mmap.o shm_open.o shm_unlink.o \
 	  memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
-	  memmove.o memchr.o memrchr.o \
+	  memmove.o memchr.o memrchr.o bzero.o \
 	  strcasecmp.o strncasecmp.o strndup.o strerror.o strsignal.o \
 	  strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \
 	  strncat.o strlcpy.o strlcat.o \
diff --git a/usr/klibc/bzero.c b/usr/klibc/bzero.c
new file mode 100644
index 0000000..a2155e3
--- /dev/null
+++ b/usr/klibc/bzero.c
@@ -0,0 +1,9 @@
+#include <string.h>
+
+void bzero(void *dst, size_t n)
+{
+	char *q = dst;
+
+	while (n--)
+		*q++ = 0;
+}

commit 9066a0392b2f1f52814cf38a29070866fe0181c9
Author: maximilian attems <max at stro.at>
Date:   Fri Aug 24 23:09:03 2007 +0200

    devname.c: include kinit.h
    
    include the header file that prototypes bdevname()
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/kinit/devname.c b/usr/kinit/devname.c
index aeb2135..03f360e 100644
--- a/usr/kinit/devname.c
+++ b/usr/kinit/devname.c
@@ -6,6 +6,8 @@
 #include <sys/types.h>
 #include <sys/sysmacros.h>
 
+#include "kinit.h"
+
 /*
  * Print the name of a block device.
  */

commit 15d1d56ef9ad64c8e7d19553eb8f56d4ba4fb993
Author: maximilian attems <max at stro.at>
Date:   Fri Aug 24 22:45:46 2007 +0200

    resume, kill: axe unused envp usage
    
    makes main() more familiar ;)
    
    Signed-off-by: maximlian attems <max at stro.at>

diff --git a/usr/kinit/resume/resume.c b/usr/kinit/resume/resume.c
index 80099f9..2138078 100644
--- a/usr/kinit/resume/resume.c
+++ b/usr/kinit/resume/resume.c
@@ -15,7 +15,7 @@ static __noreturn usage(void)
 	exit(1);
 }
 
-int main(int argc, char *argv[], char *envp[])
+int main(int argc, char *argv[])
 {
 	progname = argv[0];
 	if (argc < 2 || argc > 3)
diff --git a/usr/utils/kill.c b/usr/utils/kill.c
index 8e68faa..188f1b5 100644
--- a/usr/utils/kill.c
+++ b/usr/utils/kill.c
@@ -10,7 +10,7 @@ static __noreturn usage(void)
 	fprintf(stderr, "Usage: %s pid\n", progname);
 	exit(1);
 }
-int main(int argc, char *argv[], char *envp[])
+int main(int argc, char *argv[])
 {
 	long pid;
 	char *endp;

commit a8faf56f7ec338df134c3b121557573720fea5f4
Author: maximilian attems <max at stro.at>
Date:   Fri Aug 24 22:34:49 2007 +0200

    klibc: strcspn, strpbrk, strspn include string.h
    
    include the header file that prototype their function.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/klibc/strcspn.c b/usr/klibc/strcspn.c
index bb3ac72..c9cbb67 100644
--- a/usr/klibc/strcspn.c
+++ b/usr/klibc/strcspn.c
@@ -2,6 +2,7 @@
  * strcspn
  */
 
+#include "string.h"
 #include "strxspn.h"
 
 size_t strcspn(const char *s, const char *reject)
diff --git a/usr/klibc/strpbrk.c b/usr/klibc/strpbrk.c
index ba53d02..271a338 100644
--- a/usr/klibc/strpbrk.c
+++ b/usr/klibc/strpbrk.c
@@ -2,6 +2,7 @@
  * strpbrk
  */
 
+#include "string.h"
 #include "strxspn.h"
 
 char *strpbrk(const char *s, const char *accept)
diff --git a/usr/klibc/strspn.c b/usr/klibc/strspn.c
index 1222ce4..35582b3 100644
--- a/usr/klibc/strspn.c
+++ b/usr/klibc/strspn.c
@@ -2,6 +2,7 @@
  * strspn
  */
 
+#include "string.h"
 #include "strxspn.h"
 
 size_t strspn(const char *s, const char *accept)

commit 083a250727809c1a59a6ca5160279b06def8c404
Author: maximilian attems <max at stro.at>
Date:   Fri Aug 24 22:31:38 2007 +0200

    kinit, mknod: s/(major|minor)/\1_num/
    
    don't shadow major(), minor()
    
    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 696ffbd..6d4facc 100644
--- a/usr/kinit/do_mounts_md.c
+++ b/usr/kinit/do_mounts_md.c
@@ -142,7 +142,7 @@ static int mdp_major(void)
  */
 static int md_setup(char *str)
 {
-	int minor, level, factor, fault, partitioned = 0;
+	int minor_num, level, factor, fault, partitioned = 0;
 	char *pername = "";
 	char *str1;
 	int ent;
@@ -151,28 +151,28 @@ static int md_setup(char *str)
 		partitioned = 1;
 		str++;
 	}
-	if (get_option(&str, &minor) != 2) {	/* MD Number */
+	if (get_option(&str, &minor_num) != 2) {	/* MD Number */
 		fprintf(stderr, "md: Too few arguments supplied to md=.\n");
 		return 0;
 	}
 	str1 = str;
-	if (minor >= MAX_MD_DEVS) {
+	if (minor_num >= MAX_MD_DEVS) {
 		fprintf(stderr, "md: md=%d, Minor device number too high.\n",
-			minor);
+			minor_num);
 		return 0;
 	}
 	for (ent = 0; ent < md_setup_ents; ent++)
-		if (md_setup_args[ent].minor == minor &&
+		if (md_setup_args[ent].minor == minor_num &&
 		    md_setup_args[ent].partitioned == partitioned) {
 			fprintf(stderr,
 				"md: md=%s%d, Specified more than once. "
 				"Replacing previous definition.\n",
-				partitioned ? "d" : "", minor);
+				partitioned ? "d" : "", minor_num);
 			break;
 		}
 	if (ent >= MAX_MD_DEVS) {
 		fprintf(stderr, "md: md=%s%d - too many md initialisations\n",
-			partitioned ? "d" : "", minor);
+			partitioned ? "d" : "", minor_num);
 		return 0;
 	}
 	if (ent >= md_setup_ents)
@@ -204,10 +204,10 @@ static int md_setup(char *str)
 	}
 
 	fprintf(stderr, "md: Will configure md%s%d (%s) from %s, below.\n",
-		partitioned?"_d":"", minor, pername, str);
+		partitioned?"_d":"", minor_num, pername, str);
 	md_setup_args[ent].device_names = str;
 	md_setup_args[ent].partitioned = partitioned;
-	md_setup_args[ent].minor = minor;
+	md_setup_args[ent].minor = minor_num;
 
 	return 1;
 }
diff --git a/usr/kinit/name_to_dev.c b/usr/kinit/name_to_dev.c
index 593bc12..e5ad1cc 100644
--- a/usr/kinit/name_to_dev.c
+++ b/usr/kinit/name_to_dev.c
@@ -20,7 +20,7 @@ static dev_t try_name(char *name, int part)
 	char path[BUF_SZ];
 	char buf[BUF_SZ];
 	int range;
-	unsigned int major, minor;
+	unsigned int major_num, minor_num;
 	dev_t res;
 	char *s;
 	int len;
@@ -37,13 +37,13 @@ static dev_t try_name(char *name, int part)
 	if (len <= 0 || len == BUF_SZ || buf[len - 1] != '\n')
 		goto fail;
 	buf[len - 1] = '\0';
-	major = strtoul(buf, &s, 10);
+	major_num = strtoul(buf, &s, 10);
 	if (*s != ':')
 		goto fail;
-	minor = strtoul(s + 1, &s, 10);
+	minor_num = strtoul(s + 1, &s, 10);
 	if (*s)
 		goto fail;
-	res = makedev(major, minor);
+	res = makedev(major_num, minor_num);
 
 	/* if it's there and we are not looking for a partition - that's it */
 	if (!part)
@@ -105,7 +105,7 @@ static inline dev_t name_to_dev_t_real(const char *name)
 	int len;
 	const char *devname;
 	char *cptr, *e1, *e2;
-	int major, minor;
+	int major_num, minor_num;
 
 
 	if (name[0] == '/') {
@@ -124,10 +124,10 @@ static inline dev_t name_to_dev_t_real(const char *name)
 		    cptr[1] != '\0') {
 			/* Colon-separated decimal device number */
 			*cptr = '\0';
-			major = strtoul(devname+5, &e1, 10);
-			minor = strtoul(cptr+1, &e2, 10);
+			major_num = strtoul(devname+5, &e1, 10);
+			minor_num = strtoul(cptr+1, &e2, 10);
 			if (!*e1 && !*e2)
-				return makedev(major, minor);
+				return makedev(major_num, minor_num);
 			*cptr = ':';
 		} else {
 			/* Hexadecimal device number */
diff --git a/usr/utils/mknod.c b/usr/utils/mknod.c
index 3145450..89f0da4 100644
--- a/usr/utils/mknod.c
+++ b/usr/utils/mknod.c
@@ -13,7 +13,7 @@ static __noreturn usage(void)
 int main(int argc, char *argv[])
 {
 	char *name, *type, typec, *endp;
-	unsigned int major, minor;
+	unsigned int major_num, minor_num;
 	mode_t mode;
 	dev_t dev;
 
@@ -49,13 +49,13 @@ int main(int argc, char *argv[])
 		if (!argv[0] || !argv[1])
 			usage();
 
-		major = strtol(*argv++, &endp, 0);
+		major_num = strtol(*argv++, &endp, 0);
 		if (*endp != '\0')
 			usage();
-		minor = strtol(*argv++, &endp, 0);
+		minor_num = strtol(*argv++, &endp, 0);
 		if (*endp != '\0')
 			usage();
-		dev = makedev(major, minor);
+		dev = makedev(major_num, minor_num);
 	}
 
 	if (*argv)

commit 4f5bf37b7362ab4d203ad92ae678cdad09684f0a
Author: maximilian attems <max at stro.at>
Date:   Fri Aug 24 22:28:08 2007 +0200

    readlink: s/link/link_name/
    
    don't shadow link() with this char*
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/utils/readlink.c b/usr/utils/readlink.c
index 00c2a1e..50c1a34 100644
--- a/usr/utils/readlink.c
+++ b/usr/utils/readlink.c
@@ -13,7 +13,7 @@ static __noreturn usage(void)
 
 int main(int argc, char *argv[])
 {
-	char *name, *link = NULL;
+	char *name, *link_name = NULL;
 	size_t max_siz = 128;
 
 	progname = *argv++;
@@ -22,17 +22,17 @@ int main(int argc, char *argv[])
 	if (!name)
 		usage();
 
-	link = malloc(max_siz);
-	if (!link) {
+	link_name = malloc(max_siz);
+	if (!link_name) {
 		perror("malloc");
 		exit(1);
 	}
 
-	if (readlink(name, link, max_siz) == -1) {
+	if (readlink(name, link_name, max_siz) == -1) {
 		perror("readlink");
 		exit(1);
 	}
-	printf("%s\n", link);
+	printf("%s\n", link_name);
 
 	exit(0);
 }

commit 2dd5d9a16eb83d32f7ef604091d541959979282a
Author: maximilian attems <max at stro.at>
Date:   Fri Aug 24 22:26:13 2007 +0200

    cpio: small cleanups
    
    * declare bunch of function as static
    * axe unused xrealloc()
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/utils/cpio.c b/usr/utils/cpio.c
index a41f40a..db626a3 100644
--- a/usr/utils/cpio.c
+++ b/usr/utils/cpio.c
@@ -123,7 +123,7 @@ long input_bytes, output_bytes;
 
 /* Allocate N bytes of memory dynamically, with error checking.  */
 
-void *xmalloc(size_t n)
+static void *xmalloc(size_t n)
 {
 	void *p;
 	if (xalloc_oversized(n, 1) || (!(p = malloc(n)) && n != 0)) {
@@ -134,22 +134,9 @@ void *xmalloc(size_t n)
 /*   return xnmalloc_inline (n, 1); */
 }
 
-/* Change the size of an allocated block of memory P to N bytes,
-   with error checking.  */
-
-void *xrealloc(void *p, size_t n)
-{
-	if (xalloc_oversized(n, 1) || (!(p = realloc(p, n)) && n != 0)) {
-		fprintf(stderr, "%s: memory exhausted\n", progname);
-		exit(1);
-	}
-	return p;
-/*   return xnrealloc_inline (p, n, 1); */
-}
-
 /* Clone STRING.  */
 
-char *xstrdup(char const *string)
+static char *xstrdup(char const *string)
 {
 	size_t s = strlen(string) + 1;
 	return memcpy(xmalloc(s), string, s);
@@ -187,7 +174,7 @@ static void tape_fill_input_buffer(int in_des, int num_bytes)
    must always be a multiple of 4 helps us (and our callers)
    insure this.  */
 
-void disk_empty_output_buffer(int out_des)
+static void disk_empty_output_buffer(int out_des)
 {
 	int bytes_written;
 
@@ -206,7 +193,7 @@ void disk_empty_output_buffer(int out_des)
 /* Copy NUM_BYTES of buffer IN_BUF to `out_buff', which may be partly full.
    When `out_buff' fills up, flush it to file descriptor OUT_DES.  */
 
-void disk_buffered_write(char *in_buf, int out_des, long num_bytes)
+static void disk_buffered_write(char *in_buf, int out_des, long num_bytes)
 {
 	register long bytes_left = num_bytes;	/* Bytes needing to be copied.  */
 	register long space_left;	/* Room left in output buffer.  */
@@ -235,7 +222,7 @@ void disk_buffered_write(char *in_buf, int out_des, long num_bytes)
    OUT_DES is the file descriptor for output;
    NUM_BYTES is the number of bytes to copy.  */
 
-void copy_files_tape_to_disk(int in_des, int out_des, long num_bytes)
+static void copy_files_tape_to_disk(int in_des, int out_des, long num_bytes)
 {
 	long size;
 
@@ -251,7 +238,7 @@ void copy_files_tape_to_disk(int in_des, int out_des, long num_bytes)
 }
 
 /* if IN_BUF is NULL, Skip the next NUM_BYTES bytes of file descriptor IN_DES. */
-void tape_buffered_read(char *in_buf, int in_des, long num_bytes)
+static void tape_buffered_read(char *in_buf, int in_des, long num_bytes)
 {
 	register long bytes_left = num_bytes;	/* Bytes needing to be copied.  */
 	register long space_left;	/* Bytes to copy from input buffer.  */
@@ -282,7 +269,7 @@ struct deferment {
 	struct new_cpio_header header;
 };
 
-struct deferment *create_deferment(struct new_cpio_header *file_hdr)
+static struct deferment *create_deferment(struct new_cpio_header *file_hdr)
 {
 	struct deferment *d;
 	d = (struct deferment *)xmalloc(sizeof(struct deferment));
@@ -292,13 +279,13 @@ struct deferment *create_deferment(struct new_cpio_header *file_hdr)
 	return d;
 }
 
-void free_deferment(struct deferment *d)
+static void free_deferment(struct deferment *d)
 {
 	free(d->header.c_name);
 	free(d);
 }
 
-int link_to_name(char *link_name, char *link_target)
+static int link_to_name(char *link_name, char *link_target)
 {
 	int res = link(link_target, link_name);
 	return res;
@@ -352,7 +339,7 @@ static void hash_insert(struct inode_val *new_value)
 
 /* Associate FILE_NAME with the inode NODE_NUM.  (Insert into hash table.)  */
 
-void
+static void
 add_inode(unsigned long node_num, char *file_name, unsigned long major_num,
 	  unsigned long minor_num)
 {
@@ -399,7 +386,7 @@ add_inode(unsigned long node_num, char *file_name, unsigned long major_num,
 	hash_num++;
 }
 
-char *find_inode_file(unsigned long node_num, unsigned long major_num,
+static char *find_inode_file(unsigned long node_num, unsigned long major_num,
 		      unsigned long minor_num)
 {
 	int start;		/* Initial hash location.  */
@@ -439,7 +426,7 @@ char *find_inode_file(unsigned long node_num, unsigned long major_num,
    numbers is found, try and create another link to it using
    link_to_name, and return 0 for success and -1 for failure.  */
 
-int
+static int
 link_to_maj_min_ino(char *file_name, int st_dev_maj, int st_dev_min, int st_ino)
 {
 	int link_res;
@@ -457,7 +444,7 @@ link_to_maj_min_ino(char *file_name, int st_dev_maj, int st_dev_min, int st_ino)
 static void copyin_regular_file(struct new_cpio_header *file_hdr,
 				int in_file_des);
 
-void warn_junk_bytes(long bytes_skipped)
+static void warn_junk_bytes(long bytes_skipped)
 {
 	fprintf(stderr, "%s: warning: skipped %ld byte(s) of junk\n",
 		progname, bytes_skipped);
@@ -578,7 +565,7 @@ static void create_defered_links(struct new_cpio_header *file_hdr)
    we are done reading the whole archive.  Write out all of these
    empty links that are still on the deferments list.  */
 
-static void create_final_defers()
+static void create_final_defers(void)
 {
 	struct deferment *d;
 	int link_res;
@@ -720,7 +707,7 @@ copyin_regular_file(struct new_cpio_header *file_hdr, int in_file_des)
    NAME has no file name components because it is all slashes, return
    NAME if it is empty, the address of its last slash otherwise.  */
 
-char *base_name(char const *name)
+static char *base_name(char const *name)
 {
 	char const *base = name + FILE_SYSTEM_PREFIX_LEN(name);
 	char const *p;
@@ -752,7 +739,7 @@ char *base_name(char const *name)
    value returned by base_name.  Act like strlen (NAME), except omit
    redundant trailing slashes.  */
 
-size_t base_len(char const *name)
+static size_t base_len(char const *name)
 {
 	size_t len;
 
@@ -769,7 +756,7 @@ size_t base_len(char const *name)
    the Unix rename and rmdir system calls return an "Invalid argument" error
    when given a path that ends in "/" (except for the root directory).  */
 
-bool strip_trailing_slashes(char *path)
+static bool strip_trailing_slashes(char *path)
 {
 	char *base = base_name(path);
 	char *base_lim = base + base_len(base);
@@ -930,7 +917,7 @@ static void copyin_file(struct new_cpio_header *file_hdr, int in_file_des)
    file descriptor IN_DES, except for the magic number, which is
    already filled in.  */
 
-void read_in_new_ascii(struct new_cpio_header *file_hdr, int in_des)
+static void read_in_new_ascii(struct new_cpio_header *file_hdr, int in_des)
 {
 	char ascii_header[112];
 
@@ -963,7 +950,7 @@ void read_in_new_ascii(struct new_cpio_header *file_hdr, int in_des)
 /* Read the header, including the name of the file, from file
    descriptor IN_DES into FILE_HDR.  */
 
-void read_in_header(struct new_cpio_header *file_hdr, int in_des)
+static void read_in_header(struct new_cpio_header *file_hdr, int in_des)
 {
 	long bytes_skipped = 0;	/* Bytes of junk found before magic number.  */
 
@@ -991,7 +978,7 @@ void read_in_header(struct new_cpio_header *file_hdr, int in_des)
 /* Read the collection from standard input and create files
    in the file system.  */
 
-void process_copy_in()
+static void process_copy_in(void)
 {
 	char done = false;	/* True if trailer reached.  */
 	struct new_cpio_header file_hdr;	/* Output header information.  */
@@ -1033,7 +1020,7 @@ void process_copy_in()
    initialize all variables associated with the input and output
    buffers.  */
 
-void initialize_buffers()
+static void initialize_buffers(void)
 {
 	int in_buf_size, out_buf_size;
 

commit 65b514c265f9999663dd1e3e6a9de21eda2d0d2c
Author: maximilian attems <max at stro.at>
Date:   Wed Aug 22 09:30:20 2007 +0200

    mount: add -n option
    klibc mount ignores mtab anyway.
    so there is nothing special to be done.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/utils/mount_main.c b/usr/utils/mount_main.c
index e8e22cd..fd62000 100644
--- a/usr/utils/mount_main.c
+++ b/usr/utils/mount_main.c
@@ -64,10 +64,13 @@ int main(int argc, char *argv[])
 	rwflag = MS_VERBOSE;
 
 	do {
-		c = getopt(argc, argv, "o:rt:w");
+		c = getopt(argc, argv, "no:rt:w");
 		if (c == EOF)
 			break;
 		switch (c) {
+		case 'n':
+			/* no mtab writing */
+			break;
 		case 'o':
 			rwflag = parse_mount_options(optarg, rwflag, &extra);
 			break;
@@ -96,7 +99,7 @@ int main(int argc, char *argv[])
 
 	if (optind + 2 != argc || type == NULL) {
 		fprintf(stderr, "Usage: %s [-r] [-w] [-o options] [-t type] "
-			"device directory\n", progname);
+			"[-n] device directory\n", progname);
 		exit(1);
 	}
 

commit a00d84e64e2aef6ca4b58df02681b9cd39d5f101
Author: maximilian attems <max at stro.at>
Date:   Wed Aug 22 09:24:46 2007 +0200

    mount: add nodev, noexec and nosuid options
    
    options are used by init of initramfs-tools.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/utils/mount_opts.c b/usr/utils/mount_opts.c
index 98f58cf..05d1729 100644
--- a/usr/utils/mount_opts.c
+++ b/usr/utils/mount_opts.c
@@ -21,6 +21,9 @@ static const struct mount_opts options[] = {
 	{"dirsync", MS_DIRSYNC, MS_DIRSYNC, 0},
 	{"exec", MS_NOEXEC, 0, MS_NOEXEC},
 	{"move", MS_TYPE, MS_MOVE, 0},
+	{"nodev", MS_NODEV, MS_NODEV, 0},
+	{"noexec", MS_NOEXEC, MS_NOEXEC, 0},
+	{"nosuid", MS_NOSUID, MS_NOSUID, 0},
 	{"recurse", MS_REC, MS_REC, 0},
 	{"remount", MS_TYPE, MS_REMOUNT, 0},
 	{"ro", MS_RDONLY, MS_RDONLY, 0},



More information about the klibc mailing list