Re: [PATCH 4/5] fs: add cdev_create_from_file for loop mount option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux