diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/devfs-core.c | 8 | ||||
-rw-r--r-- | fs/fs.c | 14 | ||||
-rw-r--r-- | fs/pstore/ram_core.c | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/fs/devfs-core.c b/fs/devfs-core.c index be56edd18d..ea5887c720 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -464,7 +464,7 @@ static const struct file_operations loop_ops = { .lseek = dev_lseek_default, }; -struct cdev *cdev_create_loop(const char *path, ulong flags) +struct cdev *cdev_create_loop(const char *path, ulong flags, loff_t offset) { struct cdev *new; struct loop_priv *priv; @@ -486,15 +486,15 @@ struct cdev *cdev_create_loop(const char *path, ulong flags) new->priv = priv; ofs = lseek(priv->fd, 0, SEEK_END); - if (ofs < 0) { + if (ofs < 0 || ofs <= offset) { free(new); free(priv); return NULL; } - lseek(priv->fd, 0, SEEK_SET); + lseek(priv->fd, offset, SEEK_SET); new->size = ofs; - new->offset = 0; + new->offset = offset; new->dev = NULL; new->flags = 0; @@ -1279,11 +1279,13 @@ static const char *detect_fs(const char *filename, const char *fsoptions) enum filetype type; struct driver_d *drv; struct fs_driver_d *fdrv; - bool loop; + bool loop = false; + unsigned long long offset = 0; parseopt_b(fsoptions, "loop", &loop); + parseopt_llu_suffix(fsoptions, "offset", &offset); if (loop) - type = file_name_detect_type(filename); + type = file_name_detect_type_offset(filename, offset); else type = cdev_detect_type(filename); @@ -1302,9 +1304,13 @@ static const char *detect_fs(const char *filename, const char *fsoptions) int fsdev_open_cdev(struct fs_device_d *fsdev) { + unsigned long long offset = 0; + parseopt_b(fsdev->options, "loop", &fsdev->loop); + parseopt_llu_suffix(fsdev->options, "offset", &offset); if (fsdev->loop) - fsdev->cdev = cdev_create_loop(fsdev->backingstore, O_RDWR); + fsdev->cdev = cdev_create_loop(fsdev->backingstore, O_RDWR, + offset); else fsdev->cdev = cdev_open(fsdev->backingstore, O_RDWR); if (!fsdev->cdev) @@ -1392,6 +1398,8 @@ int mount(const char *device, const char *fsname, const char *_path, fsdev_set_linux_rootarg(fsdev, str); } + free(path); + return 0; err_no_driver: diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index d68d80900b..9de6dc614d 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -219,7 +219,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, pr_info("error in header, %d\n", numerr); prz->corrected_bytes += numerr; } else if (numerr < 0) { - pr_info("uncorrectable error in header\n"); + pr_debug("No valid data in block, assuming it is empty\n"); prz->bad_blocks++; } |