Commit 18e9e312 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Hideaki Yoshifuji

[NET]: Convert packet scheduler API to seq_file.

parent 95cf467f
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <net/sock.h> #include <net/sock.h>
...@@ -1059,27 +1060,27 @@ int psched_us_per_tick = 1; ...@@ -1059,27 +1060,27 @@ int psched_us_per_tick = 1;
int psched_tick_per_us = 1; int psched_tick_per_us = 1;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int psched_read_proc(char *buffer, char **start, off_t offset, static int psched_show(struct seq_file *seq, void *v)
int length, int *eof, void *data)
{ {
int len; seq_printf(seq, "%08x %08x %08x %08x\n",
len = sprintf(buffer, "%08x %08x %08x %08x\n",
psched_tick_per_us, psched_us_per_tick, psched_tick_per_us, psched_us_per_tick,
1000000, HZ); 1000000, HZ);
len -= offset; return 0;
}
if (len > length)
len = length;
if(len < 0)
len = 0;
*start = buffer + offset;
*eof = 1;
return len; static int psched_open(struct inode *inode, struct file *file)
{
return single_open(file, psched_show, PDE(inode)->data);
} }
static struct file_operations psched_fops = {
.owner = THIS_MODULE,
.open = psched_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif #endif
#if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY #if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY
...@@ -1250,9 +1251,7 @@ int __init pktsched_init(void) ...@@ -1250,9 +1251,7 @@ int __init pktsched_init(void)
tc_filter_init(); tc_filter_init();
#endif #endif
#ifdef CONFIG_PROC_FS proc_net_fops_create("psched", 0, &psched_fops);
create_proc_read_entry("net/psched", 0, 0, psched_read_proc, NULL);
#endif
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment