Commit 66600221 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[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: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ecba97d4
...@@ -376,7 +376,7 @@ static int __init drm_core_init(void) ...@@ -376,7 +376,7 @@ static int __init drm_core_init(void)
goto err_p2; goto err_p2;
} }
drm_proc_root = create_proc_entry("dri", S_IFDIR, NULL); drm_proc_root = proc_mkdir("dri", NULL);
if (!drm_proc_root) { if (!drm_proc_root) {
DRM_ERROR("Cannot create /proc/dri\n"); DRM_ERROR("Cannot create /proc/dri\n");
ret = -1; ret = -1;
......
...@@ -95,7 +95,7 @@ int drm_proc_init(drm_device_t *dev, int minor, ...@@ -95,7 +95,7 @@ int drm_proc_init(drm_device_t *dev, int minor,
char name[64]; char name[64];
sprintf(name, "%d", minor); sprintf(name, "%d", minor);
*dev_root = create_proc_entry(name, S_IFDIR, root); *dev_root = proc_mkdir(name, root);
if (!*dev_root) { if (!*dev_root) {
DRM_ERROR("Cannot create /proc/dri/%s\n", name); DRM_ERROR("Cannot create /proc/dri/%s\n", name);
return -1; return -1;
......
...@@ -287,12 +287,12 @@ divert_dev_init(void) ...@@ -287,12 +287,12 @@ divert_dev_init(void)
init_waitqueue_head(&rd_queue); init_waitqueue_head(&rd_queue);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
isdn_proc_entry = create_proc_entry("isdn", S_IFDIR | S_IRUGO | S_IXUGO, proc_net); isdn_proc_entry = proc_mkdir("net/isdn", NULL);
if (!isdn_proc_entry) if (!isdn_proc_entry)
return (-1); return (-1);
isdn_divert_entry = create_proc_entry("divert", S_IFREG | S_IRUGO, isdn_proc_entry); isdn_divert_entry = create_proc_entry("divert", S_IFREG | S_IRUGO, isdn_proc_entry);
if (!isdn_divert_entry) { if (!isdn_divert_entry) {
remove_proc_entry("isdn", proc_net); remove_proc_entry("net/isdn", NULL);
return (-1); return (-1);
} }
isdn_divert_entry->proc_fops = &isdn_fops; isdn_divert_entry->proc_fops = &isdn_fops;
...@@ -312,7 +312,7 @@ divert_dev_deinit(void) ...@@ -312,7 +312,7 @@ divert_dev_deinit(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
remove_proc_entry("divert", isdn_proc_entry); remove_proc_entry("divert", isdn_proc_entry);
remove_proc_entry("isdn", proc_net); remove_proc_entry("net/isdn", NULL);
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
return (0); return (0);
......
...@@ -30,8 +30,6 @@ static char *DRIVERNAME = ...@@ -30,8 +30,6 @@ static char *DRIVERNAME =
static char *DRIVERLNAME = "divadidd"; static char *DRIVERLNAME = "divadidd";
char *DRIVERRELEASE_DIDD = "2.0"; char *DRIVERRELEASE_DIDD = "2.0";
static char *main_proc_dir = "eicon";
MODULE_DESCRIPTION("DIDD table driver for diva drivers"); MODULE_DESCRIPTION("DIDD table driver for diva drivers");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks"); MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("Eicon diva drivers"); MODULE_SUPPORTED_DEVICE("Eicon diva drivers");
...@@ -89,7 +87,7 @@ proc_read(char *page, char **start, off_t off, int count, int *eof, ...@@ -89,7 +87,7 @@ proc_read(char *page, char **start, off_t off, int count, int *eof,
static int DIVA_INIT_FUNCTION create_proc(void) static int DIVA_INIT_FUNCTION create_proc(void)
{ {
proc_net_eicon = create_proc_entry(main_proc_dir, S_IFDIR, proc_net); proc_net_eicon = proc_mkdir("net/eicon", NULL);
if (proc_net_eicon) { if (proc_net_eicon) {
if ((proc_didd = if ((proc_didd =
...@@ -105,7 +103,7 @@ static int DIVA_INIT_FUNCTION create_proc(void) ...@@ -105,7 +103,7 @@ static int DIVA_INIT_FUNCTION create_proc(void)
static void DIVA_EXIT_FUNCTION remove_proc(void) static void DIVA_EXIT_FUNCTION remove_proc(void)
{ {
remove_proc_entry(DRIVERLNAME, proc_net_eicon); remove_proc_entry(DRIVERLNAME, proc_net_eicon);
remove_proc_entry(main_proc_dir, proc_net); remove_proc_entry("net/eicon", NULL);
} }
static int DIVA_INIT_FUNCTION divadidd_init(void) static int DIVA_INIT_FUNCTION divadidd_init(void)
......
...@@ -381,7 +381,7 @@ int create_adapter_proc(diva_os_xdi_adapter_t * a) ...@@ -381,7 +381,7 @@ int create_adapter_proc(diva_os_xdi_adapter_t * a)
char tmp[16]; char tmp[16];
sprintf(tmp, "%s%d", adapter_dir_name, a->controller); sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_eicon))) if (!(de = proc_mkdir(tmp, proc_net_eicon)))
return (0); return (0);
a->proc_adapter_dir = (void *) de; a->proc_adapter_dir = (void *) de;
......
...@@ -394,7 +394,7 @@ hysdn_procconf_init(void) ...@@ -394,7 +394,7 @@ hysdn_procconf_init(void)
hysdn_card *card; hysdn_card *card;
uchar conf_name[20]; uchar conf_name[20];
hysdn_proc_entry = create_proc_entry(PROC_SUBDIR_NAME, S_IFDIR | S_IRUGO | S_IXUGO, proc_net); hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net);
if (!hysdn_proc_entry) { if (!hysdn_proc_entry) {
printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n"); printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n");
return (-1); return (-1);
......
...@@ -1397,7 +1397,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam) ...@@ -1397,7 +1397,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam)
static void proc_cpia_create(void) static void proc_cpia_create(void)
{ {
cpia_proc_root = create_proc_entry("cpia", S_IFDIR, NULL); cpia_proc_root = proc_mkdir("cpia", NULL);
if (cpia_proc_root) if (cpia_proc_root)
cpia_proc_root->owner = THIS_MODULE; cpia_proc_root->owner = THIS_MODULE;
......
...@@ -99,7 +99,7 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance, struct pt_regs ...@@ -99,7 +99,7 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance, struct pt_regs
static inline void ibmveth_schedule_replenishing(struct ibmveth_adapter*); static inline void ibmveth_schedule_replenishing(struct ibmveth_adapter*);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
#define IBMVETH_PROC_DIR "ibmveth" #define IBMVETH_PROC_DIR "net/ibmveth"
static struct proc_dir_entry *ibmveth_proc_dir; static struct proc_dir_entry *ibmveth_proc_dir;
#endif #endif
...@@ -1010,7 +1010,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev) ...@@ -1010,7 +1010,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static void ibmveth_proc_register_driver(void) static void ibmveth_proc_register_driver(void)
{ {
ibmveth_proc_dir = create_proc_entry(IBMVETH_PROC_DIR, S_IFDIR, proc_net); ibmveth_proc_dir = proc_mkdir(IBMVETH_PROC_DIR, NULL);
if (ibmveth_proc_dir) { if (ibmveth_proc_dir) {
SET_MODULE_OWNER(ibmveth_proc_dir); SET_MODULE_OWNER(ibmveth_proc_dir);
} }
...@@ -1018,7 +1018,7 @@ static void ibmveth_proc_register_driver(void) ...@@ -1018,7 +1018,7 @@ static void ibmveth_proc_register_driver(void)
static void ibmveth_proc_unregister_driver(void) static void ibmveth_proc_unregister_driver(void)
{ {
remove_proc_entry(IBMVETH_PROC_DIR, proc_net); remove_proc_entry(IBMVETH_PROC_DIR, NULL);
} }
static void *ibmveth_seq_start(struct seq_file *seq, loff_t *pos) static void *ibmveth_seq_start(struct seq_file *seq, loff_t *pos)
......
...@@ -1875,11 +1875,11 @@ static int __init vlsi_mod_init(void) ...@@ -1875,11 +1875,11 @@ static int __init vlsi_mod_init(void)
sirpulse = !!sirpulse; sirpulse = !!sirpulse;
/* create_proc_entry returns NULL if !CONFIG_PROC_FS. /* proc_mkdir returns NULL if !CONFIG_PROC_FS.
* Failure to create the procfs entry is handled like running * Failure to create the procfs entry is handled like running
* without procfs - it's not required for the driver to work. * without procfs - it's not required for the driver to work.
*/ */
vlsi_proc_root = create_proc_entry(PROC_DIR, S_IFDIR, NULL); vlsi_proc_root = proc_mkdir(PROC_DIR, NULL);
if (vlsi_proc_root) { if (vlsi_proc_root) {
/* protect registered procdir against module removal. /* protect registered procdir against module removal.
* Because we are in the module init path there's no race * Because we are in the module init path there's no race
......
...@@ -1070,7 +1070,7 @@ static int __init pppoe_proc_init(void) ...@@ -1070,7 +1070,7 @@ static int __init pppoe_proc_init(void)
{ {
struct proc_dir_entry *p; struct proc_dir_entry *p;
p = create_proc_entry("pppoe", S_IRUGO, proc_net); p = create_proc_entry("net/pppoe", S_IRUGO, NULL);
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
...@@ -1142,7 +1142,7 @@ static void __exit pppoe_exit(void) ...@@ -1142,7 +1142,7 @@ static void __exit pppoe_exit(void)
dev_remove_pack(&pppoes_ptype); dev_remove_pack(&pppoes_ptype);
dev_remove_pack(&pppoed_ptype); dev_remove_pack(&pppoed_ptype);
unregister_netdevice_notifier(&pppoe_notifier); unregister_netdevice_notifier(&pppoe_notifier);
remove_proc_entry("pppoe", proc_net); remove_proc_entry("net/pppoe", NULL);
proto_unregister(&pppoe_sk_proto); proto_unregister(&pppoe_sk_proto);
} }
......
...@@ -235,7 +235,7 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr); ...@@ -235,7 +235,7 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
* Extern Function Prototypes * Extern Function Prototypes
* *
******************************************************************************/ ******************************************************************************/
static const char SKRootName[] = "sk98lin"; static const char SKRootName[] = "net/sk98lin";
static struct proc_dir_entry *pSkRootDir; static struct proc_dir_entry *pSkRootDir;
extern struct file_operations sk_proc_fops; extern struct file_operations sk_proc_fops;
...@@ -5242,20 +5242,20 @@ static int __init skge_init(void) ...@@ -5242,20 +5242,20 @@ static int __init skge_init(void)
{ {
int error; int error;
pSkRootDir = proc_mkdir(SKRootName, proc_net); pSkRootDir = proc_mkdir(SKRootName, NULL);
if (pSkRootDir) if (pSkRootDir)
pSkRootDir->owner = THIS_MODULE; pSkRootDir->owner = THIS_MODULE;
error = pci_register_driver(&skge_driver); error = pci_register_driver(&skge_driver);
if (error) if (error)
proc_net_remove(SKRootName); remove_proc_entry(SKRootName, NULL);
return error; return error;
} }
static void __exit skge_exit(void) static void __exit skge_exit(void)
{ {
pci_unregister_driver(&skge_driver); pci_unregister_driver(&skge_driver);
proc_net_remove(SKRootName); remove_proc_entry(SKRootName, NULL);
} }
......
...@@ -2849,8 +2849,7 @@ sg_proc_init(void) ...@@ -2849,8 +2849,7 @@ sg_proc_init(void)
struct proc_dir_entry *pdep; struct proc_dir_entry *pdep;
struct sg_proc_leaf * leaf; struct sg_proc_leaf * leaf;
sg_proc_sgp = create_proc_entry(sg_proc_sg_dirname, sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL);
S_IFDIR | S_IRUGO | S_IXUGO, NULL);
if (!sg_proc_sgp) if (!sg_proc_sgp)
return 1; return 1;
for (k = 0; k < num_leaves; ++k) { for (k = 0; k < num_leaves; ++k) {
......
...@@ -1148,7 +1148,7 @@ vicam_write_proc_gain(struct file *file, const char *buffer, ...@@ -1148,7 +1148,7 @@ vicam_write_proc_gain(struct file *file, const char *buffer,
static void static void
vicam_create_proc_root(void) vicam_create_proc_root(void)
{ {
vicam_proc_root = create_proc_entry("video/vicam", S_IFDIR, 0); vicam_proc_root = proc_mkdir("video/vicam", NULL);
if (vicam_proc_root) if (vicam_proc_root)
vicam_proc_root->owner = THIS_MODULE; vicam_proc_root->owner = THIS_MODULE;
...@@ -1181,7 +1181,7 @@ vicam_create_proc_entry(struct vicam_camera *cam) ...@@ -1181,7 +1181,7 @@ vicam_create_proc_entry(struct vicam_camera *cam)
sprintf(name, "video%d", cam->vdev.minor); sprintf(name, "video%d", cam->vdev.minor);
cam->proc_dir = create_proc_entry(name, S_IFDIR, vicam_proc_root); cam->proc_dir = proc_mkdir(name, vicam_proc_root);
if ( !cam->proc_dir ) if ( !cam->proc_dir )
return; // FIXME: We should probably return an error here return; // FIXME: We should probably return an error here
......
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
/* Used to help with determining the pkts on receive */ /* Used to help with determining the pkts on receive */
#define PKTGEN_MAGIC 0xbe9be955 #define PKTGEN_MAGIC 0xbe9be955
#define PG_PROC_DIR "pktgen" #define PG_PROC_DIR "net/pktgen"
#define MAX_CFLOWS 65536 #define MAX_CFLOWS 65536
...@@ -1476,18 +1476,7 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer, ...@@ -1476,18 +1476,7 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer,
static int create_proc_dir(void) static int create_proc_dir(void)
{ {
int len; pg_proc_dir = proc_mkdir(PG_PROC_DIR, NULL);
/* does proc_dir already exists */
len = strlen(PG_PROC_DIR);
for (pg_proc_dir = proc_net->subdir; pg_proc_dir; pg_proc_dir=pg_proc_dir->next) {
if ((pg_proc_dir->namelen == len) &&
(! memcmp(pg_proc_dir->name, PG_PROC_DIR, len)))
break;
}
if (!pg_proc_dir)
pg_proc_dir = create_proc_entry(PG_PROC_DIR, S_IFDIR, proc_net);
if (!pg_proc_dir) if (!pg_proc_dir)
return -ENODEV; return -ENODEV;
...@@ -1497,7 +1486,7 @@ static int create_proc_dir(void) ...@@ -1497,7 +1486,7 @@ static int create_proc_dir(void)
static int remove_proc_dir(void) static int remove_proc_dir(void)
{ {
remove_proc_entry(PG_PROC_DIR, proc_net); remove_proc_entry(PG_PROC_DIR, NULL);
return 0; return 0;
} }
...@@ -2908,7 +2897,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname) ...@@ -2908,7 +2897,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname)
pkt_dev->udp_dst_max = 9; pkt_dev->udp_dst_max = 9;
strncpy(pkt_dev->ifname, ifname, 31); strncpy(pkt_dev->ifname, ifname, 31);
sprintf(pkt_dev->fname, "net/%s/%s", PG_PROC_DIR, ifname); sprintf(pkt_dev->fname, "%s/%s", PG_PROC_DIR, ifname);
if (! pktgen_setup_dev(pkt_dev)) { if (! pktgen_setup_dev(pkt_dev)) {
printk("pktgen: ERROR: pktgen_setup_dev failed.\n"); printk("pktgen: ERROR: pktgen_setup_dev failed.\n");
...@@ -2981,7 +2970,7 @@ static int pktgen_create_thread(const char* name, int cpu) ...@@ -2981,7 +2970,7 @@ static int pktgen_create_thread(const char* name, int cpu)
spin_lock_init(&t->if_lock); spin_lock_init(&t->if_lock);
t->cpu = cpu; t->cpu = cpu;
sprintf(t->fname, "net/%s/%s", PG_PROC_DIR, t->name); sprintf(t->fname, "%s/%s", PG_PROC_DIR, t->name);
t->proc_ent = create_proc_entry(t->fname, 0600, NULL); t->proc_ent = create_proc_entry(t->fname, 0600, NULL);
if (!t->proc_ent) { if (!t->proc_ent) {
printk("pktgen: cannot create %s procfs entry.\n", t->fname); printk("pktgen: cannot create %s procfs entry.\n", t->fname);
...@@ -3064,7 +3053,7 @@ static int __init pg_init(void) ...@@ -3064,7 +3053,7 @@ static int __init pg_init(void)
create_proc_dir(); create_proc_dir();
sprintf(module_fname, "net/%s/pgctrl", PG_PROC_DIR); sprintf(module_fname, "%s/pgctrl", PG_PROC_DIR);
module_proc_ent = create_proc_entry(module_fname, 0600, NULL); module_proc_ent = create_proc_entry(module_fname, 0600, NULL);
if (!module_proc_ent) { if (!module_proc_ent) {
printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname); printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname);
......
...@@ -230,7 +230,7 @@ static int __init ieee80211_init(void) ...@@ -230,7 +230,7 @@ static int __init ieee80211_init(void)
struct proc_dir_entry *e; struct proc_dir_entry *e;
ieee80211_debug_level = debug; ieee80211_debug_level = debug;
ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net); ieee80211_proc = proc_mkdir(DRV_NAME, proc_net);
if (ieee80211_proc == NULL) { if (ieee80211_proc == NULL) {
IEEE80211_ERROR("Unable to create " DRV_NAME IEEE80211_ERROR("Unable to create " DRV_NAME
" proc directory\n"); " proc directory\n");
......
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