[Devel] [PATCH 6/7][MQUEUE] Move sysctl management code under ifdef CONFIG_SYSCTL

Pavel Emelyanov xemul at openvz.org
Fri Nov 30 05:16:29 PST 2007


This includes the tables, the mq_sysctl_table ctl header 
and calls to register/unregister.

Just like with the quota patch, I hope this is OK to
keep the ifdefs inside the __init function, rather
than making handlers and stubs outside it.

Signed-off-by: Pavel Emelyanov <xemul at openvz.org>

---

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 7d1b8aa..9ff4abf 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -94,8 +94,6 @@ static unsigned int queues_max 	= DFLT_QUEUESMAX;
 static unsigned int msg_max 	= DFLT_MSGMAX;
 static unsigned int msgsize_max = DFLT_MSGSIZEMAX;
 
-static struct ctl_table_header * mq_sysctl_table;
-
 static inline struct mqueue_inode_info *MQUEUE_I(struct inode *inode)
 {
 	return container_of(inode, struct mqueue_inode_info, vfs_inode);
@@ -1201,6 +1199,7 @@ static int msg_max_limit_max = HARD_MSGMAX;
 static int msg_maxsize_limit_min = DFLT_MSGSIZEMAX;
 static int msg_maxsize_limit_max = INT_MAX;
 
+#ifdef CONFIG_SYSCTL
 static ctl_table mq_sysctls[] = {
 	{
 		.procname	= "queues_max",
@@ -1249,6 +1248,9 @@ static ctl_table mq_sysctl_root[] = {
 	{ .ctl_name = 0 }
 };
 
+static struct ctl_table_header *mq_sysctl_table;
+#endif
+
 static int __init init_mqueue_fs(void)
 {
 	int error;
@@ -1258,10 +1260,10 @@ static int __init init_mqueue_fs(void)
 				SLAB_HWCACHE_ALIGN, init_once);
 	if (mqueue_inode_cachep == NULL)
 		return -ENOMEM;
-
+#ifdef CONFIG_SYSCTL
 	/* ignore failues - they are not fatal */
 	mq_sysctl_table = register_sysctl_table(mq_sysctl_root);
-
+#endif
 	error = register_filesystem(&mqueue_fs_type);
 	if (error)
 		goto out_sysctl;
@@ -1280,8 +1282,10 @@ static int __init init_mqueue_fs(void)
 out_filesystem:
 	unregister_filesystem(&mqueue_fs_type);
 out_sysctl:
+#ifdef CONFIG_SYSCTL
 	if (mq_sysctl_table)
 		unregister_sysctl_table(mq_sysctl_table);
+#endif
 	kmem_cache_destroy(mqueue_inode_cachep);
 	return error;
 }
-- 
1.5.3.4





More information about the Devel mailing list