Skip to contentSkip to conversation

procfs : Move some extern declaration from fs/proc/proc_misc.c to include/linux/seq_file.h

PATCH In review Eric Dumazet 2 participants 2 messages Dec 18, 2007 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 procfs : Move some extern declaration from fs/proc/proc_misc.c to include/linux/seq_file.h

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.

 fs/proc/proc_misc.c      |    9 ---------
 include/linux/seq_file.h |   11 +++++++++++
 2 files changed, 11 insertions(+), 9 deletions(-)
fs/proc/proc_misc.c +0 -9
index e0d064e..6344881 100644
@@ -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,
include/linux/seq_file.h +11 -0
index ebbc02b..90a1cdd 100644
@@ -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
#1 lore raw
Quoted 8 lines · Eric Dumazet

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.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.