diff options
author | Corentin Chary <corentincj@iksaif.net> | 2009-09-28 15:10:12 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-11-24 01:18:54 -0500 |
commit | 9722324e65a017ea0ce39236a2f87c649bb7c39d (patch) | |
tree | 83450a50e35f5d1be14d7a74da57b45d3f138a79 /fs/ubifs/super.c | |
parent | b57102841846d9840dcb1b8b308f6d7369b8e5c5 (diff) |
UBIFS: support mounting of UBI volume character devices
This patch makes it possible to mount UBI character device
nodes, and use something like:
$ mount -t ubifs /dev/ubi_volume_name /mnt/ubifs
instead of the old restrictive 'nodev' semantics:
$ mount -t ubifs ubi0_0 /mnt/ubifs
[Comments and the patch were amended a bit by Artem]
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r-- | fs/ubifs/super.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 333e181ee987..943ad5624530 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1842,22 +1842,32 @@ const struct super_operations ubifs_super_operations = { | |||
1842 | * @name: UBI volume name | 1842 | * @name: UBI volume name |
1843 | * @mode: UBI volume open mode | 1843 | * @mode: UBI volume open mode |
1844 | * | 1844 | * |
1845 | * There are several ways to specify UBI volumes when mounting UBIFS: | 1845 | * The primary method of mounting UBIFS is by specifying the UBI volume |
1846 | * o ubiX_Y - UBI device number X, volume Y; | 1846 | * character device node path. However, UBIFS may also be mounted withoug any |
1847 | * o ubiY - UBI device number 0, volume Y; | 1847 | * character device node using one of the following methods: |
1848 | * | ||
1849 | * o ubiX_Y - mount UBI device number X, volume Y; | ||
1850 | * o ubiY - mount UBI device number 0, volume Y; | ||
1848 | * o ubiX:NAME - mount UBI device X, volume with name NAME; | 1851 | * o ubiX:NAME - mount UBI device X, volume with name NAME; |
1849 | * o ubi:NAME - mount UBI device 0, volume with name NAME. | 1852 | * o ubi:NAME - mount UBI device 0, volume with name NAME. |
1850 | * | 1853 | * |
1851 | * Alternative '!' separator may be used instead of ':' (because some shells | 1854 | * Alternative '!' separator may be used instead of ':' (because some shells |
1852 | * like busybox may interpret ':' as an NFS host name separator). This function | 1855 | * like busybox may interpret ':' as an NFS host name separator). This function |
1853 | * returns ubi volume object in case of success and a negative error code in | 1856 | * returns UBI volume description object in case of success and a negative |
1854 | * case of failure. | 1857 | * error code in case of failure. |
1855 | */ | 1858 | */ |
1856 | static struct ubi_volume_desc *open_ubi(const char *name, int mode) | 1859 | static struct ubi_volume_desc *open_ubi(const char *name, int mode) |
1857 | { | 1860 | { |
1861 | struct ubi_volume_desc *ubi; | ||
1858 | int dev, vol; | 1862 | int dev, vol; |
1859 | char *endptr; | 1863 | char *endptr; |
1860 | 1864 | ||
1865 | /* First, try to open using the device node path method */ | ||
1866 | ubi = ubi_open_volume_path(name, mode); | ||
1867 | if (!IS_ERR(ubi)) | ||
1868 | return ubi; | ||
1869 | |||
1870 | /* Try the "nodev" method */ | ||
1861 | if (name[0] != 'u' || name[1] != 'b' || name[2] != 'i') | 1871 | if (name[0] != 'u' || name[1] != 'b' || name[2] != 'i') |
1862 | return ERR_PTR(-EINVAL); | 1872 | return ERR_PTR(-EINVAL); |
1863 | 1873 | ||