mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, fuse-devel@lists.sourceforge.net,
	miklos@szeredi.hu, greg@kroah.com
Subject: Re: [PATCH 5/5] CUSE: implement CUSE - Character device in Userspace
Date: Fri, 21 Nov 2008 21:16:07 -0800	[thread overview]
Message-ID: <20081121211607.49e0ec84.akpm@linux-foundation.org> (raw)
In-Reply-To: <1227190983-5820-6-git-send-email-tj@kernel.org>

On Thu, 20 Nov 2008 23:23:03 +0900 Tejun Heo <tj@kernel.org> wrote:

> CUSE enables implementing character devices in userspace.  With recent
> additions of nonblock, lseek, ioctl and poll support, FUSE already has
> most of what's necessary to implement character devices.  All CUSE has
> to do is bonding all those components - FUSE, chardev and the driver
> model - nicely.
> 
> Due to the number of different objects involved and many ways an
> instance can fail, object lifetime rules are a tad bit complex.
> Please take a look at the comment on top of fs/fuse/cuse.c for
> details.
> 
> Other than that, it's mostly straight forward.  Client opens
> /dev/cuse, kernel starts conversation with CUSE_INIT.  The client
> tells CUSE which device it wants to create.  CUSE creates the device
> for the client and the rest works the same way as in a direct IO FUSE
> session.
> 
> Each CUSE device has a corresponding directory /sys/class/cuse/DEVNAME
> (which is symlink to /sys/devices/virtual/class/DEVNAME if
> SYSFS_DEPRECATED is turned off) which hosts "waiting" and "abort"
> among other things.  Those two files have the same meaning as the FUSE
> control files.
> 
> The only notable lacking feature compared to in-kernel implementation
> is mmap support.
> 
> ...
>
> +struct cuse_conn {
> +	struct fuse_conn	fc;
> +	struct cdev		cdev;
> +	struct vfsmount		*mnt;
> +	struct device		*dev;
> +
> +	/* init parameters */
> +	bool			unrestricted_ioctl:1;

I'd suggest removal of the :1 here.  If someone later comes along and
adds another bitfield next to it, locking will be needed to prevent
racess accessing the bitfields, and I seeno appropriate lock here, nor
any comment explaining the locking..

> +static int cuse_init_worker(void *data)
> +{
> +	struct cuse_init_in iin = { };
> +	struct cuse_init_out iout = { };
> +	struct cuse_devinfo devinfo = { };

You might want to check the generated code here.  gcc has a habit of
assembling a temp structure on the stack then memcpying it over, which
is just junk.  This will be gcc version dependent.  Fixable by using an
old-fashioned memset instead.


  parent reply	other threads:[~2008-11-22  5:16 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 14:22 [PATCHSET] CUSE: implement CUSE, take #2 Tejun Heo
2008-11-20 14:22 ` [PATCH 1/5] FUSE: add fuse_ prefix to several functions Tejun Heo
2008-11-20 14:23 ` [PATCH 2/5] FUSE: export symbols to be used by CUSE Tejun Heo
2008-11-22  8:05   ` [PATCH 2/5 UPDATED] " Tejun Heo
2008-11-20 14:23 ` [PATCH 3/5] FUSE: separate out fuse_conn_init() from new_conn() Tejun Heo
2008-11-20 14:23 ` [PATCH 4/5] FUSE: add fuse_conn->release() Tejun Heo
2008-11-20 14:23 ` [PATCH 5/5] CUSE: implement CUSE - Character device in Userspace Tejun Heo
2008-11-21 18:55   ` Miklos Szeredi
2008-11-22  5:05     ` Tejun Heo
2008-11-22  5:17       ` Andrew Morton
2008-11-22  7:29         ` Tejun Heo
2008-11-22  8:40       ` Miklos Szeredi
2008-11-22  8:48         ` Tejun Heo
2008-11-22  5:16   ` Andrew Morton [this message]
2008-11-22  8:02     ` Tejun Heo
2008-11-22  8:07       ` [PATCH 5/5 UPDATED] " Tejun Heo
2008-11-26 10:02         ` Miklos Szeredi
2008-11-26 10:17           ` Tejun Heo
2008-11-26 11:34             ` Miklos Szeredi
  -- strict thread matches above, loose matches on Subject: below --
2008-08-28 18:18 [PATCHSET] CUSE: implement CUSE Tejun Heo
2008-08-28 18:19 ` [PATCH 5/5] CUSE: implement CUSE - Character device in Userspace Tejun Heo
2008-08-28 20:07   ` Andrew Morton
2008-08-28 22:15     ` Greg KH
2008-08-28 22:32       ` Andrew Morton
2008-08-29  2:09     ` Tejun Heo
2008-08-29  2:20       ` Andrew Morton
2008-08-29 15:27       ` Nick Bowler

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=20081121211607.49e0ec84.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tj@kernel.org \
    /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

Powered by JetHome