diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2022-10-13 13:57:07 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-10-13 13:57:07 +0200 |
commit | 3d46afb56fa3c5e3c41a382dc454b5bcda04d5ac (patch) | |
tree | 957de9cbc6a68e82c84ae26cc4712c3e86dfc964 /fs | |
parent | 965a946c49e016bcff5bbfffaa1a468cd74af0db (diff) | |
parent | 8513703c6c46428908264923260504ce81e3e3a7 (diff) | |
download | barebox-3d46afb56fa3c5e3c41a382dc454b5bcda04d5ac.tar.gz |
Merge branch 'for-next/misc'
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bpkfs.c | 6 | ||||
-rw-r--r-- | fs/fs.c | 23 | ||||
-rw-r--r-- | fs/uimagefs.c | 4 |
3 files changed, 26 insertions, 7 deletions
diff --git a/fs/bpkfs.c b/fs/bpkfs.c index 8fc4df65de..147f4735d9 100644 --- a/fs/bpkfs.c +++ b/fs/bpkfs.c @@ -381,7 +381,7 @@ static int bpkfs_probe(struct device_d *dev) ret = read(fd, header, sizeof(*header)); if (ret < 0) { - dev_err(dev, "could not read: %s (ret = %d)\n", errno_str(), ret); + dev_err(dev, "could not read: %m\n"); goto err; } @@ -407,7 +407,7 @@ static int bpkfs_probe(struct device_d *dev) ret = read(fd, &data_header, sizeof(data_header)); if (ret < 0) { - dev_err(dev, "could not read: %s\n", errno_str()); + dev_err(dev, "could not read: %m\n"); goto err; } else if (ret == 0) { dev_err(dev, "EOF: to_read %llu\n", size); @@ -456,7 +456,7 @@ static int bpkfs_probe(struct device_d *dev) priv->nb_data_entries++; if (lseek(fd, d->size, SEEK_CUR) != d->size) { - dev_err(dev, "could not seek: %s\n", errno_str()); + dev_err(dev, "could not seek: %m\n"); ret = -errno; goto err; } @@ -756,7 +756,7 @@ int register_fs_driver(struct fs_driver_d *fsdrv) } EXPORT_SYMBOL(register_fs_driver); -static const char *detect_fs(const char *filename, const char *fsoptions) +const char *fs_detect(const char *filename, const char *fsoptions) { enum filetype type; struct driver_d *drv; @@ -1000,6 +1000,25 @@ const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions) } /* + * cdev_mount - return existing mount or mount a cdev to the default path + * + * If a cdev is already mounted anywhere return the path + * it's mounted on. + * Otherwise mount it to /mnt/<cdevname> and return the path. Returns an + * error pointer on failure. + */ +const char *cdev_mount(struct cdev *cdev) +{ + const char *path; + + path = cdev_get_mount_path(cdev); + if (path) + return path; + + return cdev_mount_default(cdev, NULL); +} + +/* * mount_all - iterate over block devices and mount all devices we are able to */ void mount_all(void) @@ -2961,7 +2980,7 @@ int mount(const char *device, const char *fsname, const char *pathname, device, pathname, fsname, fsoptions); if (!fsname) - fsname = detect_fs(device, fsoptions); + fsname = fs_detect(device, fsoptions); if (!fsname) { ret = -ENOENT; diff --git a/fs/uimagefs.c b/fs/uimagefs.c index daaa3ad24b..8de2b8881f 100644 --- a/fs/uimagefs.c +++ b/fs/uimagefs.c @@ -373,7 +373,7 @@ static int __uimage_open(struct uimagefs_handle *priv) fd = open(filename, O_RDONLY); if (fd < 0) { - printf("could not open: %s\n", errno_str()); + printf("could not open: %m\n"); return fd; } @@ -381,7 +381,7 @@ static int __uimage_open(struct uimagefs_handle *priv) ret = read(fd, header, sizeof(*header)); if (ret < 0) { - printf("could not read: %s\n", errno_str()); + printf("could not read: %m\n"); goto err_out; } offset += sizeof(*header); |