aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2005-09-28 17:32:57 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-29 11:46:26 -0400
commit666002218d59db271e5c1ede1d80227170c51987 (patch)
tree1fadcb278c817ce56a653e5c3c58637f5056feec /net/core
parentecba97d4aacf4e80c56eb73e39af0369cb8539a4 (diff)
[PATCH] proc_mkdir() should be used to create procfs directories
A bunch of create_proc_dir_entry() calls creating directories had crept in since the last sweep; converted to proc_mkdir(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/pktgen.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index ef430b1e8e42..b7f2d65a614f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -186,7 +186,7 @@
186 186
187/* Used to help with determining the pkts on receive */ 187/* Used to help with determining the pkts on receive */
188#define PKTGEN_MAGIC 0xbe9be955 188#define PKTGEN_MAGIC 0xbe9be955
189#define PG_PROC_DIR "pktgen" 189#define PG_PROC_DIR "net/pktgen"
190 190
191#define MAX_CFLOWS 65536 191#define MAX_CFLOWS 65536
192 192
@@ -1476,18 +1476,7 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer,
1476 1476
1477static int create_proc_dir(void) 1477static int create_proc_dir(void)
1478{ 1478{
1479 int len; 1479 pg_proc_dir = proc_mkdir(PG_PROC_DIR, NULL);
1480 /* does proc_dir already exists */
1481 len = strlen(PG_PROC_DIR);
1482
1483 for (pg_proc_dir = proc_net->subdir; pg_proc_dir; pg_proc_dir=pg_proc_dir->next) {
1484 if ((pg_proc_dir->namelen == len) &&
1485 (! memcmp(pg_proc_dir->name, PG_PROC_DIR, len)))
1486 break;
1487 }
1488
1489 if (!pg_proc_dir)
1490 pg_proc_dir = create_proc_entry(PG_PROC_DIR, S_IFDIR, proc_net);
1491 1480
1492 if (!pg_proc_dir) 1481 if (!pg_proc_dir)
1493 return -ENODEV; 1482 return -ENODEV;
@@ -1497,7 +1486,7 @@ static int create_proc_dir(void)
1497 1486
1498static int remove_proc_dir(void) 1487static int remove_proc_dir(void)
1499{ 1488{
1500 remove_proc_entry(PG_PROC_DIR, proc_net); 1489 remove_proc_entry(PG_PROC_DIR, NULL);
1501 return 0; 1490 return 0;
1502} 1491}
1503 1492
@@ -2908,7 +2897,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname)
2908 pkt_dev->udp_dst_max = 9; 2897 pkt_dev->udp_dst_max = 9;
2909 2898
2910 strncpy(pkt_dev->ifname, ifname, 31); 2899 strncpy(pkt_dev->ifname, ifname, 31);
2911 sprintf(pkt_dev->fname, "net/%s/%s", PG_PROC_DIR, ifname); 2900 sprintf(pkt_dev->fname, "%s/%s", PG_PROC_DIR, ifname);
2912 2901
2913 if (! pktgen_setup_dev(pkt_dev)) { 2902 if (! pktgen_setup_dev(pkt_dev)) {
2914 printk("pktgen: ERROR: pktgen_setup_dev failed.\n"); 2903 printk("pktgen: ERROR: pktgen_setup_dev failed.\n");
@@ -2981,7 +2970,7 @@ static int pktgen_create_thread(const char* name, int cpu)
2981 spin_lock_init(&t->if_lock); 2970 spin_lock_init(&t->if_lock);
2982 t->cpu = cpu; 2971 t->cpu = cpu;
2983 2972
2984 sprintf(t->fname, "net/%s/%s", PG_PROC_DIR, t->name); 2973 sprintf(t->fname, "%s/%s", PG_PROC_DIR, t->name);
2985 t->proc_ent = create_proc_entry(t->fname, 0600, NULL); 2974 t->proc_ent = create_proc_entry(t->fname, 0600, NULL);
2986 if (!t->proc_ent) { 2975 if (!t->proc_ent) {
2987 printk("pktgen: cannot create %s procfs entry.\n", t->fname); 2976 printk("pktgen: cannot create %s procfs entry.\n", t->fname);
@@ -3064,7 +3053,7 @@ static int __init pg_init(void)
3064 3053
3065 create_proc_dir(); 3054 create_proc_dir();
3066 3055
3067 sprintf(module_fname, "net/%s/pgctrl", PG_PROC_DIR); 3056 sprintf(module_fname, "%s/pgctrl", PG_PROC_DIR);
3068 module_proc_ent = create_proc_entry(module_fname, 0600, NULL); 3057 module_proc_ent = create_proc_entry(module_fname, 0600, NULL);
3069 if (!module_proc_ent) { 3058 if (!module_proc_ent) {
3070 printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname); 3059 printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname);