Commit 4c2c3b4aaf3c10a636490438e9648a314ce414f9

Authored by akpm@linux-foundation.org
Committed by Linus Torvalds
1 parent e953ac2195

ipc/ipc_sysctl.c: move the definition of ipc_auto_callback()

proc_ipcauto_dointvec_minmax() is the only user of ipc_auto_callback(),
since the former function is protected by CONFIG_PROC_FS, so should be the
latter one.

Just move its definition down.

Signed-off-by: WANG Cong <wangcong@zeuux.org>
Cc: Eric Biederman <ebiederm@xmision.com>
Cc: Nadia Derbey <Nadia.Derbey@bull.net>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 23 additions and 23 deletions Side-by-side Diff

... ... @@ -26,29 +26,6 @@
26 26 return which;
27 27 }
28 28  
29   -/*
30   - * Routine that is called when the file "auto_msgmni" has successfully been
31   - * written.
32   - * Two values are allowed:
33   - * 0: unregister msgmni's callback routine from the ipc namespace notifier
34   - * chain. This means that msgmni won't be recomputed anymore upon memory
35   - * add/remove or ipc namespace creation/removal.
36   - * 1: register back the callback routine.
37   - */
38   -static void ipc_auto_callback(int val)
39   -{
40   - if (!val)
41   - unregister_ipcns_notifier(current->nsproxy->ipc_ns);
42   - else {
43   - /*
44   - * Re-enable automatic recomputing only if not already
45   - * enabled.
46   - */
47   - recompute_msgmni(current->nsproxy->ipc_ns);
48   - cond_register_ipcns_notifier(current->nsproxy->ipc_ns);
49   - }
50   -}
51   -
52 29 #ifdef CONFIG_PROC_FS
53 30 static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp,
54 31 void __user *buffer, size_t *lenp, loff_t *ppos)
... ... @@ -92,6 +69,29 @@
92 69  
93 70 return proc_doulongvec_minmax(&ipc_table, write, filp, buffer,
94 71 lenp, ppos);
  72 +}
  73 +
  74 +/*
  75 + * Routine that is called when the file "auto_msgmni" has successfully been
  76 + * written.
  77 + * Two values are allowed:
  78 + * 0: unregister msgmni's callback routine from the ipc namespace notifier
  79 + * chain. This means that msgmni won't be recomputed anymore upon memory
  80 + * add/remove or ipc namespace creation/removal.
  81 + * 1: register back the callback routine.
  82 + */
  83 +static void ipc_auto_callback(int val)
  84 +{
  85 + if (!val)
  86 + unregister_ipcns_notifier(current->nsproxy->ipc_ns);
  87 + else {
  88 + /*
  89 + * Re-enable automatic recomputing only if not already
  90 + * enabled.
  91 + */
  92 + recompute_msgmni(current->nsproxy->ipc_ns);
  93 + cond_register_ipcns_notifier(current->nsproxy->ipc_ns);
  94 + }
95 95 }
96 96  
97 97 static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write,