提交 ccf94f1b 编写于 作者: F Fabian Frederick 提交者: Linus Torvalds

proc: constify seq_operations

proc_uid_seq_operations, proc_gid_seq_operations and
proc_projid_seq_operations are only called in proc_id_map_open with
seq_open as const struct seq_operations so we can constify the 3
structures and update proc_id_map_open prototype.

   text    data     bss     dec     hex filename
   6817     404    1984    9205    23f5 kernel/user_namespace.o-before
   6913     308    1984    9205    23f5 kernel/user_namespace.o-after
Signed-off-by: NFabian Frederick <fabf@skynet.be>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 108a8a11
...@@ -2449,7 +2449,7 @@ static int proc_tgid_io_accounting(struct task_struct *task, char *buffer) ...@@ -2449,7 +2449,7 @@ static int proc_tgid_io_accounting(struct task_struct *task, char *buffer)
#ifdef CONFIG_USER_NS #ifdef CONFIG_USER_NS
static int proc_id_map_open(struct inode *inode, struct file *file, static int proc_id_map_open(struct inode *inode, struct file *file,
struct seq_operations *seq_ops) const struct seq_operations *seq_ops)
{ {
struct user_namespace *ns = NULL; struct user_namespace *ns = NULL;
struct task_struct *task; struct task_struct *task;
......
...@@ -57,9 +57,9 @@ static inline void put_user_ns(struct user_namespace *ns) ...@@ -57,9 +57,9 @@ static inline void put_user_ns(struct user_namespace *ns)
} }
struct seq_operations; struct seq_operations;
extern struct seq_operations proc_uid_seq_operations; extern const struct seq_operations proc_uid_seq_operations;
extern struct seq_operations proc_gid_seq_operations; extern const struct seq_operations proc_gid_seq_operations;
extern struct seq_operations proc_projid_seq_operations; extern const struct seq_operations proc_projid_seq_operations;
extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *); extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *); extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *); extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
......
...@@ -526,21 +526,21 @@ static void m_stop(struct seq_file *seq, void *v) ...@@ -526,21 +526,21 @@ static void m_stop(struct seq_file *seq, void *v)
return; return;
} }
struct seq_operations proc_uid_seq_operations = { const struct seq_operations proc_uid_seq_operations = {
.start = uid_m_start, .start = uid_m_start,
.stop = m_stop, .stop = m_stop,
.next = m_next, .next = m_next,
.show = uid_m_show, .show = uid_m_show,
}; };
struct seq_operations proc_gid_seq_operations = { const struct seq_operations proc_gid_seq_operations = {
.start = gid_m_start, .start = gid_m_start,
.stop = m_stop, .stop = m_stop,
.next = m_next, .next = m_next,
.show = gid_m_show, .show = gid_m_show,
}; };
struct seq_operations proc_projid_seq_operations = { const struct seq_operations proc_projid_seq_operations = {
.start = projid_m_start, .start = projid_m_start,
.stop = m_stop, .stop = m_stop,
.next = m_next, .next = m_next,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册