From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem
Date: Fri Dec 21 15:10:33 2007 [thread overview]
Message-ID: <20071221230929.GA15533@tasint.org> (raw)
In-Reply-To: <1198193387-16606-16-git-send-email-sunil.mushran@oracle.com>
On Thu, Dec 20, 2007 at 03:29:34PM -0800, Sunil Mushran wrote:
> Commit 823bccfc4002296ba88c3ad0f049e1abd8108d30 in mainline removes struct
> subsystem from kobject.h. This patch allows one to build ocfs2 with kernels
> having/not having this change.
A subsystem is just a {kset, ...}, so the pointers are actually
still equal. I wouldn't introduce "struct kapi_kset". We don't need
it. You can just pass the kset on to mlog_sys_init(). See below.
>
> -int mlog_sys_init(struct kset *o2cb_subsys)
Just keep this as struct kset...
> +int mlog_sys_init(struct kapi_kset *o2cb_subsys)
> {
> int i = 0;
>
> diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
> index 75cd877..2b78a1b 100644
> --- a/fs/ocfs2/cluster/masklog.h
> +++ b/fs/ocfs2/cluster/masklog.h
> @@ -278,7 +278,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
>
> #include <linux/kobject.h>
> #include <linux/sysfs.h>
> -int mlog_sys_init(struct kset *o2cb_subsys);
Same here. The better way is to introduce "kapi_subsystem_kset()":
+#ifdef STRUCT_SUBSYSTEM_DEFINED
+# define kapi_subsystem_kset(_sub) &((_sub)->kset)
+#else
+# define kapi_subsystem_kset(_sub) (_sub)
+#endif
Then you can call "int mlog_sys_init(struct kset *kset)" like so:
mlog_sys_init(kapi_subsystem_kset(&o2cb_subsys));
> @@ -111,7 +111,7 @@ int o2cb_sys_init(void)
> {
> int ret;
>
> - o2cb_subsys.kobj.ktype = &o2cb_subsys_type;
> + o2cb_subsys.kapi_kobj.ktype = &o2cb_subsys_type;
> ret = subsystem_register(&o2cb_subsys);
becomes:
kapi_subsystem_kset(&o2cb_subsys)->kobj.ktype = &o2cb_subsys_type;
ret = subsystem_register(&o2cb_subsys);
and this:
> o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
> {
> struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
> - struct kset *sbs = to_kset(kobj);
> + struct kapi_kset *sbs = to_kapi_kset(kobj);
>
> BUG_ON(sbs != &o2cb_subsys);
becomes this:
o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
{
struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
struct kset *sbs = to_kset(kobj);
BUG_ON(sbs != &o2cb_subsys);
because the kset and subsystem pointers are identical. If gcc warns
about the types, you can say:
BUG_ON(sbs != kapi_subsystem_kset(&o2cb_subsys));
instead. Thoughts?
Joel
--
"And yet I fight,
And yet I fight this battle all alone.
No one to cry to;
No place to call home."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
next prev parent reply other threads:[~2007-12-21 15:10 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
2007-12-21 1:09 ` Joel Becker
2007-12-21 9:41 ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
2007-12-21 15:12 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
2007-12-24 13:32 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink Sunil Mushran
2007-12-21 11:39 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
2007-12-21 0:56 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
2007-12-21 0:54 ` Joel Becker
2007-12-21 9:39 ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
2007-12-22 3:51 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
2007-12-24 13:30 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
2007-12-22 3:51 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
2007-12-21 15:10 ` Joel Becker [this message]
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
2007-12-21 11:59 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
2007-12-24 13:30 ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
2007-12-24 13:21 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
2007-12-21 11:47 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
2007-12-21 15:10 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
2007-12-21 0:56 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
2007-12-24 13:23 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
2007-12-21 11:57 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
2007-12-21 11:57 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait Sunil Mushran
2007-12-21 11:37 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
2007-12-21 0:54 ` Joel Becker
2007-12-21 11:51 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink Sunil Mushran
2007-12-21 11:39 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
2007-12-24 13:23 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
2007-12-21 15:14 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
2007-12-21 15:12 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2007-12-24 13:28 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
2007-12-21 12:00 ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
2007-12-21 11:55 ` Joel Becker
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=20071221230929.GA15533@tasint.org \
--to=joel.becker@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.