summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-09-27 22:47:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-29 12:11:14 +0200
commitecb3aaa23b09c41f2ac8364f5ca72779467762e3 (patch)
treeab76b31d8736050aed1a150c5ec7525dd0836e2b /fs/ext4
parentd4f5bb1e011ac653a167031554f0ac9e028e9e36 (diff)
downloadbarebox-ecb3aaa23b09c41f2ac8364f5ca72779467762e3.tar.gz
barebox-ecb3aaa23b09c41f2ac8364f5ca72779467762e3.tar.xz
fs: cleanup backingstore handling
All filesystem drivers which need a backingstore device do the same ignoring of '/dev/' in the backingstore followed by a cdev_open. Add a helper function for it and let the core handle the cdev. As a side effect this makes sure that fsdev->cdev is also set when a device is mounted without the leading '/dev/' which was previously ignored by the mount code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ext_barebox.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/ext4/ext_barebox.c b/fs/ext4/ext_barebox.c
index adc8f758e0..69a7723b5c 100644
--- a/fs/ext4/ext_barebox.c
+++ b/fs/ext4/ext_barebox.c
@@ -225,7 +225,6 @@ static int ext_readlink(struct device_d *dev, const char *pathname,
static int ext_probe(struct device_d *dev)
{
struct fs_device_d *fsdev = dev_to_fs_device(dev);
- char *backingstore = fsdev->backingstore;
int ret;
struct ext_filesystem *fs;
@@ -234,14 +233,11 @@ static int ext_probe(struct device_d *dev)
dev->priv = fs;
fs->dev = dev;
- if (!strncmp(backingstore , "/dev/", 5))
- backingstore += 5;
-
- fs->cdev = cdev_open(backingstore, O_RDWR);
- if (!fs->cdev) {
- ret = -ENOENT;
+ ret = fsdev_open_cdev(fsdev);
+ if (ret)
goto err_open;
- }
+
+ fs->cdev = fsdev->cdev;
ret = ext4fs_mount(fs);
if (ret)
@@ -250,7 +246,6 @@ static int ext_probe(struct device_d *dev)
return 0;
err_mount:
- cdev_close(fs->cdev);
err_open:
free(fs);
@@ -262,7 +257,6 @@ static void ext_remove(struct device_d *dev)
struct ext_filesystem *fs = dev->priv;
ext4fs_umount(fs);
- cdev_close(fs->cdev);
free(fs);
}