From: Andrew Morton <akpm@linux-foundation.org>
To: Greg KH <greg@kroah.com>
Cc: tj@kernel.org, fuse-devel@lists.sourceforge.net,
miklos@szeredi.hu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] CUSE: implement CUSE - Character device in Userspace
Date: Thu, 28 Aug 2008 15:32:35 -0700 [thread overview]
Message-ID: <20080828153235.b005748f.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080828221525.GA2855@kroah.com>
On Thu, 28 Aug 2008 15:15:25 -0700
Greg KH <greg@kroah.com> wrote:
> On Thu, Aug 28, 2008 at 01:07:40PM -0700, Andrew Morton wrote:
> > On Fri, 29 Aug 2008 03:19:04 +0900
> > Tejun Heo <tj@kernel.org> wrote:
> > > +#define fc_to_cc(_fc) container_of((_fc), struct cuse_conn, fc)
> > > +#define cdev_to_cc(_cdev) container_of((_cdev), struct cuse_conn, cdev)
> > > +#define cuse_conn_get(cc) ({mntget((cc)->mnt); cc;})
> > > +#define cuse_conn_put(cc) mntput((cc)->mnt)
> >
> > I believe all the above could be implemented in C.
>
> "traditionally" container_of() is used in #define, not a function call
> as it is just pointer math that can be done at compile time.
>
Well yeah. But it isn't a very good tradition.
static inline struct cuse_conn *cdev_to_cc(struct cdev *cdev)
{
return container_of(cdev, struct cuse_conn, cdev);
}
should generate the same code and is prettier.
Unfortunately it has no additional type-safety. You can still pass it
the address of a tty_driver.cdev instead of a cuse_conn.cdev and the
compiler will happily swallow it. Not a big problem in practice though.
next prev parent reply other threads:[~2008-08-28 22:33 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 18:18 [PATCHSET] CUSE: implement CUSE Tejun Heo
2008-08-28 18:19 ` [PATCH 1/5] FUSE: add fuse_ prefix to several functions Tejun Heo
2008-08-28 18:19 ` [PATCH 2/5] FUSE: export symbols to be used by CUSE Tejun Heo
2008-08-28 18:19 ` [PATCH 3/5] FUSE: separate out fuse_conn_init() from new_conn() Tejun Heo
2008-08-28 18:19 ` [PATCH 4/5] FUSE: add fuse_conn->release() 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 [this message]
2008-08-29 2:09 ` Tejun Heo
2008-08-29 2:20 ` Andrew Morton
2008-08-29 15:27 ` Nick Bowler
2008-08-29 5:50 ` [fuse-devel] [PATCHSET] CUSE: implement CUSE Mike Hommey
2008-08-29 5:52 ` Tejun Heo
2008-08-29 18:50 ` Archie Cobbs
2008-08-30 12:30 ` Tejun Heo
2008-08-30 18:56 ` Mike Hommey
2008-09-01 7:20 ` Goswin von Brederlow
2008-09-01 7:38 ` Mike Hommey
2008-08-30 22:39 ` Archie Cobbs
2008-08-31 4:52 ` hooanon05
2008-08-30 16:35 ` Goswin von Brederlow
2008-11-20 14:22 [PATCHSET] CUSE: implement CUSE, take #2 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
2008-11-22 8:02 ` Tejun Heo
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=20080828153235.b005748f.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