Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/kinit/do_mounts_mtd.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1122 - (show annotations) (download)
Wed Aug 18 21:11:40 2010 UTC (13 years, 8 months ago) by niro
File MIME type: text/plain
File size: 945 byte(s)
-updated to klibc-1.5.19
1 /*
2 * Mount an MTD device as a character device.
3 */
4
5 #include <errno.h>
6 #include <fcntl.h>
7 #include <sys/mount.h>
8 #include <sys/stat.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include <unistd.h>
13 #include <inttypes.h>
14
15 #include "kinit.h"
16 #include "do_mounts.h"
17
18 int mount_mtd_root(int argc, char *argv[], const char *root_dev_name,
19 const char *type, unsigned long flags)
20 {
21 const char *data = get_arg(argc, argv, "rootflags=");
22
23 if (!type)
24 type = "jffs2";
25
26 printf("Trying to mount MTD %s as root (%s filesystem)\n",
27 root_dev_name, type);
28
29 if (mount(root_dev_name, "/root", type, flags, data)) {
30 int err = errno;
31 fprintf(stderr,
32 "%s: Unable to mount MTD %s (%s filesystem) "
33 "as root: %s\n",
34 progname, root_dev_name, type, strerror(err));
35 return -err;
36 } else {
37 fprintf(stderr, "%s: Mounted root (%s filesystem)%s.\n",
38 progname, type, (flags & MS_RDONLY) ? " readonly" : "");
39 return 0;
40 }
41
42 }