summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
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/ubifs
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/ubifs')
-rw-r--r--fs/ubifs/ubifs.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 9df8dc5cbd..dfa6107458 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -553,25 +553,22 @@ static int ubifs_probe(struct device_d *dev)
{
struct fs_device_d *fsdev = dev_to_fs_device(dev);
struct ubifs_priv *priv = xzalloc(sizeof(struct ubifs_priv));
- char *backingstore = fsdev->backingstore;
int ret;
dev->priv = priv;
- if (!strncmp(backingstore , "/dev/", 5))
- backingstore += 5;
-
- priv->cdev = cdev_open(backingstore, O_RDONLY);
- if (!priv->cdev) {
- ret = -ENOENT;
+ ret = fsdev_open_cdev(fsdev);
+ if (ret)
goto err_free;
- }
+
+ priv->cdev = fsdev->cdev;
priv->ubi = ubi_open_volume_cdev(priv->cdev, UBI_READONLY);
if (IS_ERR(priv->ubi)) {
dev_err(dev, "failed to open ubi volume: %s\n",
strerror(-PTR_ERR(priv->ubi)));
- return PTR_ERR(priv->ubi);
+ ret = PTR_ERR(priv->ubi);
+ goto err_free;
}
priv->sb = ubifs_get_super(priv->ubi, 0);
@@ -596,7 +593,6 @@ static void ubifs_remove(struct device_d *dev)
ubifs_umount(c);
ubi_close_volume(priv->ubi);
- cdev_close(priv->cdev);
free(c);
free(sb);