Annotation of /trunk/mkinitrd-magellan/klibc/usr/kinit/do_mounts_mtd.c
Parent Directory | Revision Log
Revision 532 -
(hide annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 952 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 952 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | niro | 532 | /* |
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 | DEBUG(("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 | } |