From: Sascha Hauer <s.hauer@pengutronix.de>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/5] fs: add cdev_create_from_file for loop mount option
Date: Thu, 1 Jun 2017 08:31:11 +0200 [thread overview]
Message-ID: <20170601063111.k36wjyxac6uwslgv@pengutronix.de> (raw)
In-Reply-To: <20170530140947.3988-4-p.zabel@pengutronix.de>
Hi Philipp,
On Tue, May 30, 2017 at 04:09:46PM +0200, Philipp Zabel wrote:
> Allow to create a loopback cdev from a file.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> fs/devfs-core.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> fs/fs.c | 21 ++++++++++++---
> include/driver.h | 1 +
> 3 files changed, 99 insertions(+), 4 deletions(-)
>
> diff --git a/fs/devfs-core.c b/fs/devfs-core.c
> +static ssize_t loop_write(struct cdev *cdev, const void *buf, size_t count,
> + loff_t offset, ulong flags)
> +{
> + struct loop_priv *priv = cdev->priv;
> + loff_t ofs;
> +
> + ofs = lseek(priv->fd, offset, SEEK_SET);
> + if (ofs < 0)
> + return ofs;
> +
> + return write(priv->fd, buf, count);
> +}
> +
> +static const struct file_operations loop_ops = {
> + .read = loop_read,
> + .write = loop_write,
> + .memmap = generic_memmap_rw,
> + .lseek = dev_lseek_default,
> +};
> +
> +struct cdev *cdev_create_from_file(const char *path, ulong flags)
Looks good, but I'm missing the counterpart of this function and its
usage in umount().
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-06-01 6:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-30 14:09 [PATCH 1/5] cdev: make file operations const Philipp Zabel
2017-05-30 14:09 ` [PATCH 2/5] commands: mount: combine dev and devstr, which are the same Philipp Zabel
2017-05-30 14:09 ` [PATCH 3/5] fs: add parseopt_b for loop mount option Philipp Zabel
2017-05-30 14:09 ` [PATCH 4/5] fs: add cdev_create_from_file " Philipp Zabel
2017-06-01 6:31 ` Sascha Hauer [this message]
2017-06-01 9:37 ` Philipp Zabel
2017-05-30 14:09 ` [PATCH 5/5] commands: mount: mention file loop mounts in the help text Philipp Zabel
2017-06-01 6:32 ` [PATCH 1/5] cdev: make file operations const Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170601063111.k36wjyxac6uwslgv@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox