public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] procfs : Move some extern declaration from fs/proc/proc_misc.c to include/linux/seq_file.h
@ 2007-12-18 21:25 Eric Dumazet
  2007-12-18 22:22 ` Matt Mackall
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2007-12-18 21:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux kernel

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

Some 'extern struct seq_operations' are wrongly defined in fs/proc/proc_misc.c 
(they miss a const qualifier)

In order to fix this correctly, move the "extern ... " declaration from .c 
file to an appropriate include file, as advised by checkpatch.pl

Note : "extern struct seq_operations cpuinfo_op;" will be taken into account
in a separate patch, since its const status is arch dependant.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

  fs/proc/proc_misc.c      |    9 ---------
  include/linux/seq_file.h |   11 +++++++++++
  2 files changed, 11 insertions(+), 9 deletions(-)


[-- Attachment #2: seq.patch --]
[-- Type: text/plain, Size: 3360 bytes --]

diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index e0d064e..6344881 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -216,7 +216,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
 #undef K
 }
 
-extern struct seq_operations fragmentation_op;
 static int fragmentation_open(struct inode *inode, struct file *file)
 {
 	(void)inode;
@@ -230,7 +229,6 @@ static const struct file_operations fragmentation_file_operations = {
 	.release	= seq_release,
 };
 
-extern struct seq_operations pagetypeinfo_op;
 static int pagetypeinfo_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &pagetypeinfo_op);
@@ -243,7 +241,6 @@ static const struct file_operations pagetypeinfo_file_ops = {
 	.release	= seq_release,
 };
 
-extern struct seq_operations zoneinfo_op;
 static int zoneinfo_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &zoneinfo_op);
@@ -340,7 +337,6 @@ static const struct file_operations proc_devinfo_operations = {
 	.release	= seq_release,
 };
 
-extern struct seq_operations vmstat_op;
 static int vmstat_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &vmstat_op);
@@ -371,7 +367,6 @@ static int stram_read_proc(char *page, char **start, off_t off,
 #endif
 
 #ifdef CONFIG_BLOCK
-extern struct seq_operations partitions_op;
 static int partitions_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &partitions_op);
@@ -383,7 +378,6 @@ static const struct file_operations proc_partitions_operations = {
 	.release	= seq_release,
 };
 
-extern struct seq_operations diskstats_op;
 static int diskstats_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &diskstats_op);
@@ -397,7 +391,6 @@ static const struct file_operations proc_diskstats_operations = {
 #endif
 
 #ifdef CONFIG_MODULES
-extern struct seq_operations modules_op;
 static int modules_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &modules_op);
@@ -424,7 +417,6 @@ static const struct file_operations proc_slabinfo_operations = {
 };
 
 #ifdef CONFIG_DEBUG_SLAB_LEAK
-extern struct seq_operations slabstats_op;
 static int slabstats_open(struct inode *inode, struct file *file)
 {
 	unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL);
@@ -598,7 +590,6 @@ static void int_seq_stop(struct seq_file *f, void *v)
 }
 
 
-extern int show_interrupts(struct seq_file *f, void *v); /* In arch code */
 static struct seq_operations int_seq_ops = {
 	.start = int_seq_start,
 	.next  = int_seq_next,
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index ebbc02b..90a1cdd 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -63,5 +63,16 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
 extern struct list_head *seq_list_next(void *v, struct list_head *head,
 		loff_t *ppos);
 
+int show_interrupts(struct seq_file *f, void *v); /* In arch code */
+
+extern const struct seq_operations modules_op;
+extern const struct seq_operations slabstats_op;
+extern struct seq_operations diskstats_op;
+extern struct seq_operations partitions_op;
+extern const struct seq_operations vmstat_op;
+extern const struct seq_operations zoneinfo_op;
+extern const struct seq_operations pagetypeinfo_op;
+extern const struct seq_operations fragmentation_op;
+
 #endif
 #endif

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] procfs : Move some extern declaration from fs/proc/proc_misc.c to include/linux/seq_file.h
  2007-12-18 21:25 [PATCH] procfs : Move some extern declaration from fs/proc/proc_misc.c to include/linux/seq_file.h Eric Dumazet
@ 2007-12-18 22:22 ` Matt Mackall
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Mackall @ 2007-12-18 22:22 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Andrew Morton, Linux kernel

On Tue, Dec 18, 2007 at 10:25:50PM +0100, Eric Dumazet wrote:
> Some 'extern struct seq_operations' are wrongly defined in 
> fs/proc/proc_misc.c (they miss a const qualifier)
> 
> In order to fix this correctly, move the "extern ... " declaration from .c 
> file to an appropriate include file, as advised by checkpatch.pl
> 
> Note : "extern struct seq_operations cpuinfo_op;" will be taken into account
> in a separate patch, since its const status is arch dependant.

seq_file.h doesn't seem the best place for these, as it's otherwise
unpolluted with anything but seq_file internals.

Most of these things perhaps ought to be pushed out to their relevant
subsystems and then no .h file declaration will be needed.

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-18 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18 21:25 [PATCH] procfs : Move some extern declaration from fs/proc/proc_misc.c to include/linux/seq_file.h Eric Dumazet
2007-12-18 22:22 ` Matt Mackall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox