Commit e3b08ca8 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] remove s390 procfs abuses

massive crapectomy in s390 code - removed procfs abuses
parent 1d13173b
......@@ -71,7 +71,6 @@ static int debug_close(struct inode *inode, struct file *file);
static struct proc_dir_entry
*debug_create_proc_dir_entry(struct proc_dir_entry *root,
const char *name, mode_t mode,
struct inode_operations *iops,
struct file_operations *fops);
static void debug_delete_proc_dir_entry(struct proc_dir_entry *root,
struct proc_dir_entry *entry);
......@@ -151,28 +150,18 @@ unsigned int debug_feature_version = __DEBUG_FEATURE_VERSION;
static debug_info_t *debug_area_first = NULL;
static debug_info_t *debug_area_last = NULL;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
static struct semaphore debug_lock = MUTEX;
#else
DECLARE_MUTEX(debug_lock);
#endif
static int initialized = 0;
static struct file_operations debug_file_ops = {
owner: THIS_MODULE,
read: debug_output,
write: debug_input,
open: debug_open,
release: debug_close,
};
static struct inode_operations debug_inode_ops = {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
default_file_ops: &debug_file_ops, /* file ops */
#endif
};
static struct proc_dir_entry *debug_proc_root_entry;
/* functions */
......@@ -277,19 +266,15 @@ static debug_info_t* debug_info_create(char *name, int page_order,
/* create proc rood directory */
rc->proc_root_entry =
debug_create_proc_dir_entry(debug_proc_root_entry, rc->name,
S_IFDIR | S_IRUGO | S_IXUGO |
S_IWUSR | S_IWGRP, NULL, NULL);
rc->proc_root_entry = proc_mkdir(rc->name, debug_proc_root_entry);
/* append new element to linked list */
if(debug_area_first == NULL){
if (debug_area_first == NULL) {
/* first element in list */
debug_area_first = rc;
rc->prev = NULL;
}
else{
} else {
/* append element to end of list */
debug_area_last->next = rc;
rc->prev = debug_area_last;
......@@ -513,7 +498,6 @@ static int debug_open(struct inode *inode, struct file *file)
#ifdef DEBUG
printk("debug_open\n");
#endif
MOD_INC_USE_COUNT;
down(&debug_lock);
/* find debug log and view */
......@@ -523,8 +507,8 @@ static int debug_open(struct inode *inode, struct file *file)
for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
if (debug_info->views[i] == NULL)
continue;
else if (debug_info->proc_entries[i]->low_ino ==
file->f_dentry->d_inode->i_ino) {
else if (debug_info->proc_entries[i] ==
PDE(file->f_dentry->d_inode)) {
goto found; /* found view ! */
}
}
......@@ -566,8 +550,6 @@ static int debug_open(struct inode *inode, struct file *file)
out:
up(&debug_lock);
if (rc != 0)
MOD_DEC_USE_COUNT;
return rc;
}
......@@ -587,7 +569,6 @@ static int debug_close(struct inode *inode, struct file *file)
debug_info_free(p_info->debug_info_snap);
debug_info_put(p_info->debug_info_org);
kfree(file->private_data);
MOD_DEC_USE_COUNT;
return 0; /* success */
}
......@@ -598,42 +579,11 @@ static int debug_close(struct inode *inode, struct file *file)
static struct proc_dir_entry *debug_create_proc_dir_entry
(struct proc_dir_entry *root, const char *name, mode_t mode,
struct inode_operations *iops, struct file_operations *fops)
struct file_operations *fops)
{
struct proc_dir_entry *rc = NULL;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
const char *fn = name;
int len;
len = strlen(fn);
rc = (struct proc_dir_entry *) kmalloc(sizeof(struct proc_dir_entry)
+ len + 1, GFP_ATOMIC);
if (!rc)
goto out;
memset(rc, 0, sizeof(struct proc_dir_entry));
memcpy(((char *) rc) + sizeof(*rc), fn, len + 1);
rc->name = ((char *) rc) + sizeof(*rc);
rc->namelen = len;
rc->low_ino = 0, rc->mode = mode;
rc->nlink = 1;
rc->uid = 0;
rc->gid = 0;
rc->size = 0;
rc->get_info = NULL;
rc->ops = iops;
proc_register(root, rc);
#else
rc = create_proc_entry(name, mode, root);
if (!rc)
goto out;
if (fops)
struct proc_dir_entry *rc = create_proc_entry(name, mode, root);
if (rc && fops)
rc->proc_fops = fops;
#endif
out:
return rc;
}
......@@ -645,13 +595,7 @@ static struct proc_dir_entry *debug_create_proc_dir_entry
static void debug_delete_proc_dir_entry
(struct proc_dir_entry *root, struct proc_dir_entry *proc_entry)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
proc_unregister(root, proc_entry->low_ino);
kfree(proc_entry);
#else
remove_proc_entry(proc_entry->name, root);
#endif
}
/*
......@@ -906,11 +850,7 @@ int debug_init(void)
down(&debug_lock);
if (!initialized) {
debug_proc_root_entry =
debug_create_proc_dir_entry(&proc_root, DEBUG_DIR_ROOT,
S_IFDIR | S_IRUGO | S_IXUGO
| S_IWUSR | S_IWGRP, NULL,
NULL);
debug_proc_root_entry = proc_mkdir(DEBUG_DIR_ROOT, NULL);
printk(KERN_INFO "debug: Initialization complete\n");
initialized = 1;
}
......@@ -953,7 +893,6 @@ int debug_register_view(debug_info_t * id, struct debug_view *view)
id->proc_entries[i] =
debug_create_proc_dir_entry(id->proc_root_entry,
view->name, mode,
&debug_inode_ops,
&debug_file_ops);
rc = 0;
}
......@@ -1271,7 +1210,7 @@ void cleanup_module(void)
#ifdef DEBUG
printk("debug_cleanup_module: \n");
#endif
debug_delete_proc_dir_entry(&proc_root, debug_proc_root_entry);
debug_delete_proc_dir_entry(NULL, debug_proc_root_entry);
return;
}
......
......@@ -71,7 +71,6 @@ static int debug_close(struct inode *inode, struct file *file);
static struct proc_dir_entry
*debug_create_proc_dir_entry(struct proc_dir_entry *root,
const char *name, mode_t mode,
struct inode_operations *iops,
struct file_operations *fops);
static void debug_delete_proc_dir_entry(struct proc_dir_entry *root,
struct proc_dir_entry *entry);
......@@ -166,13 +165,6 @@ static struct file_operations debug_file_ops = {
release: debug_close,
};
static struct inode_operations debug_inode_ops = {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
default_file_ops: &debug_file_ops, /* file ops */
#endif
};
static struct proc_dir_entry *debug_proc_root_entry;
/* functions */
......@@ -277,11 +269,7 @@ static debug_info_t* debug_info_create(char *name, int page_order,
/* create proc rood directory */
rc->proc_root_entry =
debug_create_proc_dir_entry(debug_proc_root_entry, rc->name,
S_IFDIR | S_IRUGO | S_IXUGO |
S_IWUSR | S_IWGRP, NULL, NULL);
rc->proc_root_entry = proc_mkdir(rc->name, debug_proc_root_entry);
/* append new element to linked list */
if(debug_area_first == NULL){
......@@ -523,8 +511,8 @@ static int debug_open(struct inode *inode, struct file *file)
for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
if (debug_info->views[i] == NULL)
continue;
else if (debug_info->proc_entries[i]->low_ino ==
file->f_dentry->d_inode->i_ino) {
else if (debug_info->proc_entries[i] ==
PDE(file->f_dentry->d_inode)) {
goto found; /* found view ! */
}
}
......@@ -598,42 +586,11 @@ static int debug_close(struct inode *inode, struct file *file)
static struct proc_dir_entry *debug_create_proc_dir_entry
(struct proc_dir_entry *root, const char *name, mode_t mode,
struct inode_operations *iops, struct file_operations *fops)
struct file_operations *fops)
{
struct proc_dir_entry *rc = NULL;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
const char *fn = name;
int len;
len = strlen(fn);
rc = (struct proc_dir_entry *) kmalloc(sizeof(struct proc_dir_entry)
+ len + 1, GFP_ATOMIC);
if (!rc)
goto out;
memset(rc, 0, sizeof(struct proc_dir_entry));
memcpy(((char *) rc) + sizeof(*rc), fn, len + 1);
rc->name = ((char *) rc) + sizeof(*rc);
rc->namelen = len;
rc->low_ino = 0, rc->mode = mode;
rc->nlink = 1;
rc->uid = 0;
rc->gid = 0;
rc->size = 0;
rc->get_info = NULL;
rc->ops = iops;
proc_register(root, rc);
#else
rc = create_proc_entry(name, mode, root);
if (!rc)
goto out;
if (fops)
struct proc_dir_entry *rc = create_proc_entry(name, mode, root);
if (rc && fops)
rc->proc_fops = fops;
#endif
out:
return rc;
}
......@@ -645,13 +602,7 @@ static struct proc_dir_entry *debug_create_proc_dir_entry
static void debug_delete_proc_dir_entry
(struct proc_dir_entry *root, struct proc_dir_entry *proc_entry)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
proc_unregister(root, proc_entry->low_ino);
kfree(proc_entry);
#else
remove_proc_entry(proc_entry->name, root);
#endif
}
/*
......@@ -906,11 +857,7 @@ int debug_init(void)
down(&debug_lock);
if (!initialized) {
debug_proc_root_entry =
debug_create_proc_dir_entry(&proc_root, DEBUG_DIR_ROOT,
S_IFDIR | S_IRUGO | S_IXUGO
| S_IWUSR | S_IWGRP, NULL,
NULL);
debug_proc_root_entry = proc_mkdir(DEBUG_DIR_ROOT, NULL);
printk(KERN_INFO "debug: Initialization complete\n");
initialized = 1;
}
......@@ -953,7 +900,6 @@ int debug_register_view(debug_info_t * id, struct debug_view *view)
id->proc_entries[i] =
debug_create_proc_dir_entry(id->proc_root_entry,
view->name, mode,
&debug_inode_ops,
&debug_file_ops);
rc = 0;
}
......
......@@ -66,11 +66,6 @@ int __init sensors_init(void);
static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX];
static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX];
static unsigned short i2c_inodes[SENSORS_ENTRY_MAX];
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
static void i2c_fill_inode(struct inode *inode, int fill);
static void i2c_dir_fill_inode(struct inode *inode, int fill);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1) */
static ctl_table sysctl_table[] = {
{CTL_DEV, "dev", NULL, 0, 0555},
......@@ -198,14 +193,7 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id;
}
#endif /* DEBUG */
i2c_inodes[id - 256] =
new_header->ctl_table->child->child->de->low_ino;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27))
new_header->ctl_table->child->child->de->owner = controlling_mod;
#else
new_header->ctl_table->child->child->de->fill_inode =
&i2c_dir_fill_inode;
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27)) */
return id;
}
......@@ -227,49 +215,6 @@ void i2c_deregister_entry(int id)
}
}
/* Monitor access for /proc/sys/dev/sensors; make unloading i2c-proc.o
impossible if some process still uses it or some file in it */
void i2c_fill_inode(struct inode *inode, int fill)
{
if (fill)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
}
/* Monitor access for /proc/sys/dev/sensors/ directories; make unloading
the corresponding module impossible if some process still uses it or
some file in it */
void i2c_dir_fill_inode(struct inode *inode, int fill)
{
int i;
struct i2c_client *client;
#ifdef DEBUG
if (!inode) {
printk("i2c-proc.o: Warning: inode NULL in fill_inode()\n");
return;
}
#endif /* def DEBUG */
for (i = 0; i < SENSORS_ENTRY_MAX; i++)
if (i2c_clients[i]
&& (i2c_inodes[i] == inode->i_ino)) break;
#ifdef DEBUG
if (i == SENSORS_ENTRY_MAX) {
printk
("i2c-proc.o: Warning: inode (%ld) not found in fill_inode()\n",
inode->i_ino);
return;
}
#endif /* def DEBUG */
client = i2c_clients[i];
if (fill)
client->driver->inc_use(client);
else
client->driver->dec_use(client);
}
int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
void *buffer, size_t * lenp)
{
......@@ -867,12 +812,7 @@ int __init sensors_init(void)
if (!
(i2c_proc_header =
register_sysctl_table(i2c_proc, 0))) return -ENOMEM;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1))
i2c_proc_header->ctl_table->child->de->owner = THIS_MODULE;
#else
i2c_proc_header->ctl_table->child->de->fill_inode =
&i2c_fill_inode;
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)) */
i2c_initialized++;
return 0;
}
......
......@@ -255,7 +255,7 @@ hysdn_conf_open(struct inode *ino, struct file *filep)
card = card_root;
while (card) {
pd = card->procconf;
if (pd->low_ino == (ino->i_ino & 0xFFFF))
if (pd == PDE(ino))
break;
card = card->next; /* search next entry */
}
......@@ -340,7 +340,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
card = card_root;
while (card) {
pd = card->procconf;
if (pd->low_ino == (ino->i_ino & 0xFFFF))
if (pd == PDE(ino))
break;
card = card->next; /* search next entry */
}
......
......@@ -207,7 +207,7 @@ hysdn_log_read(struct file *file, char *buf, size_t count, loff_t * off)
{
struct log_data *inf;
int len;
word ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
struct procdata *pd = NULL;
hysdn_card *card;
......@@ -216,11 +216,10 @@ hysdn_log_read(struct file *file, char *buf, size_t count, loff_t * off)
return (-EAGAIN);
/* sorry, but we need to search the card */
ino = file->f_dentry->d_inode->i_ino & 0xFFFF; /* low-ino */
card = card_root;
while (card) {
pd = card->proclog;
if (pd->log->low_ino == ino)
if (pd->log == pde)
break;
card = card->next; /* search next entry */
}
......@@ -258,7 +257,7 @@ hysdn_log_open(struct inode *ino, struct file *filep)
card = card_root;
while (card) {
pd = card->proclog;
if (pd->log->low_ino == (ino->i_ino & 0xFFFF))
if (pd->log == PDE(ino))
break;
card = card->next; /* search next entry */
}
......@@ -323,7 +322,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
card = card_root;
while (card) {
pd = card->proclog;
if (pd->log->low_ino == (ino->i_ino & 0xFFFF))
if (pd->log == PDE(ino))
break;
card = card->next; /* search next entry */
}
......@@ -359,7 +358,7 @@ static unsigned int
hysdn_log_poll(struct file *file, poll_table * wait)
{
unsigned int mask = 0;
word ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
hysdn_card *card;
struct procdata *pd = NULL;
......@@ -367,11 +366,10 @@ hysdn_log_poll(struct file *file, poll_table * wait)
return (mask); /* no polling for write supported */
/* we need to search the card */
ino = file->f_dentry->d_inode->i_ino & 0xFFFF; /* low-ino */
card = card_root;
while (card) {
pd = card->proclog;
if (pd->log->low_ino == ino)
if (pd->log == pde)
break;
card = card->next; /* search next entry */
}
......
......@@ -2409,7 +2409,7 @@ static int munich_write_proc(struct file *file, const char *buffer,
/* Paranoia checking: */
if (file->f_dentry->d_inode->i_ino != entry->low_ino)
if (PDE(file->f_dentry->d_inode) != entry)
{
printk(KERN_ERR "munich_write_proc: file <-> data internal error\n");
return -EIO;
......
......@@ -942,8 +942,7 @@ static struct dentry *comx_lookup(struct inode *dir, struct dentry *dentry)
lock_kernel();
if ((de = PDE(dir)) != NULL) {
for (de = de->subdir ; de ; de = de->next) {
if ((de && de->low_ino) &&
(de->namelen == dentry->d_name.len) &&
if ((de->namelen == dentry->d_name.len) &&
(memcmp(dentry->d_name.name, de->name,
de->namelen) == 0)) {
if ((inode = proc_get_inode(dir->i_sb,
......
......@@ -210,12 +210,6 @@ static struct file_operations tape_devices_file_ops =
release:tape_devices_release, /* close */
};
static struct inode_operations tape_devices_inode_ops =
{
#if !(LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
default_file_ops:&tape_devices_file_ops /* file ops */
#endif /* LINUX_IS_24 */
};
#endif /* CONFIG_PROC_FS */
/* SECTION: Parameters for tape */
......@@ -271,9 +265,7 @@ tape_parm_call_setup (char *str)
return 1;
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,2,16))
__setup("tape=", tape_parm_call_setup);
#endif /* kernel <2.2.19 */
#endif /* not defined MODULE */
static inline int
......@@ -909,30 +901,10 @@ tape_init (void)
/* Allocate local buffer for the ccwcache */
tape_init_emergency_req ();
#ifdef CONFIG_PROC_FS
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
tape_devices_entry = create_proc_entry ("tapedevices",
S_IFREG | S_IRUGO | S_IWUSR,
&proc_root);
tape_devices_entry->proc_fops = &tape_devices_file_ops;
tape_devices_entry->proc_iops = &tape_devices_inode_ops;
#else
tape_devices_entry = (struct proc_dir_entry *) kmalloc
(sizeof (struct proc_dir_entry), GFP_ATOMIC);
if (tape_devices_entry) {
memset (tape_devices_entry, 0, sizeof (struct proc_dir_entry));
tape_devices_entry->name = "tapedevices";
tape_devices_entry->namelen = strlen ("tapedevices");
tape_devices_entry->low_ino = 0;
tape_devices_entry->mode = (S_IFREG | S_IRUGO | S_IWUSR);
tape_devices_entry->nlink = 1;
tape_devices_entry->uid = 0;
tape_devices_entry->gid = 0;
tape_devices_entry->size = 0;
tape_devices_entry->get_info = NULL;
tape_devices_entry->ops = &tape_devices_inode_ops;
proc_register (&proc_root, tape_devices_entry);
}
#endif
#endif /* CONFIG_PROC_FS */
return 0;
......@@ -996,12 +968,7 @@ cleanup_module (void)
devfs_unregister (tape_devfs_root_entry);
#endif CONFIG_DEVFS_FS
#ifdef CONFIG_PROC_FS
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
remove_proc_entry ("tapedevices", &proc_root);
#else
proc_unregister (&proc_root, tape_devices_entry->low_ino);
kfree (tape_devices_entry);
#endif /* LINUX_IS_24 */
#endif
#ifdef CONFIG_S390_TAPE_CHAR
tapechar_uninit();
......
This diff is collapsed.
This diff is collapsed.
......@@ -27,8 +27,6 @@ static loff_t proc_file_lseek(struct file *, loff_t, int);
int proc_match(int len, const char *name,struct proc_dir_entry * de)
{
if (!de || !de->low_ino)
return 0;
if (de->namelen != len)
return 0;
return !memcmp(name, de->name, len);
......@@ -266,8 +264,6 @@ struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry)
de = PDE(dir);
if (de) {
for (de = de->subdir; de ; de = de->next) {
if (!de || !de->low_ino)
continue;
if (de->namelen != dentry->d_name.len)
continue;
if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
......
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