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();
......
......@@ -77,16 +77,7 @@
#define FREE_IRQ free_irq
#endif
#if LINUX_VERSION_CODE >= 0x020213
# include <asm/idals.h>
#else
# define set_normalized_cda(ccw, addr) ((ccw)->cda = (addr),0)
# define clear_normalized_cda(ccw)
#endif
#if LINUX_VERSION_CODE < 0x020400
# define s390_dev_info_t dev_info_t
# define dev_kfree_skb_irq(a) dev_kfree_skb(a)
#endif
#include <asm/idals.h>
#include <asm/irq.h>
......@@ -319,9 +310,7 @@ static int activated;
typedef struct ctc_priv_t {
struct net_device_stats stats;
#if LINUX_VERSION_CODE >= 0x02032D
unsigned long tbusy;
#endif
/**
* The finite state machine of this interface.
*/
......@@ -351,20 +340,6 @@ typedef struct ll_header_t {
* Compatibility macros for busy handling
* of network devices.
*/
#if LINUX_VERSION_CODE < 0x02032D
static __inline__ void ctc_clear_busy(net_device *dev)
{
clear_bit(0 ,(void *)&dev->tbusy);
mark_bh(NET_BH);
}
static __inline__ int ctc_test_and_set_busy(net_device *dev)
{
return(test_and_set_bit(0, (void *)&dev->tbusy));
}
#define SET_DEVICE_START(device, value) dev->start = value
#else
static __inline__ void ctc_clear_busy(net_device *dev)
{
clear_bit(0, &(((ctc_priv *)dev->priv)->tbusy));
......@@ -378,7 +353,6 @@ static __inline__ int ctc_test_and_set_busy(net_device *dev)
}
#define SET_DEVICE_START(device, value)
#endif
/**
* Print Banner.
......@@ -1351,11 +1325,7 @@ static void ch_action_start(fsm_instance *fi, int event, void *arg)
dev->name,
(CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
#if LINUX_VERSION_CODE >= 0x020400
INIT_LIST_HEAD(&ch->tq.list);
#else
ch->tq.next = NULL;
#endif
ch->tq.sync = 0;
ch->tq.routine = (void *)(void *)ctc_bh;
ch->tq.data = ch;
......@@ -2695,7 +2665,7 @@ static struct net_device_stats *ctc_stats(net_device *dev) {
* procfs related structures and routines
*****************************************************************************/
static net_device *find_netdev_by_ino(unsigned long ino)
static net_device *find_netdev_by_ino(struct proc_dir_entry *pde)
{
channel *ch = channels;
net_device *dev = NULL;
......@@ -2706,8 +2676,8 @@ static net_device *find_netdev_by_ino(unsigned long ino)
dev = ch->netdev;
privptr = (ctc_priv *)dev->priv;
if ((privptr->proc_ctrl_entry->low_ino == ino) ||
(privptr->proc_stat_entry->low_ino == ino))
if ((privptr->proc_ctrl_entry == pde) ||
(privptr->proc_stat_entry == pde))
return dev;
}
ch = ch->next;
......@@ -2715,20 +2685,6 @@ static net_device *find_netdev_by_ino(unsigned long ino)
return NULL;
}
#if LINUX_VERSION_CODE < 0x020363
/**
* Lock the module, if someone changes into
* our proc directory.
*/
static void ctc_fill_inode(struct inode *inode, int fill)
{
if (fill) {
MOD_INC_USE_COUNT;
} else
MOD_DEC_USE_COUNT;
}
#endif
#define CTRL_BUFSIZE 40
static int ctc_ctrl_open(struct inode *inode, struct file *file)
......@@ -2750,14 +2706,14 @@ static int ctc_ctrl_close(struct inode *inode, struct file *file)
static ssize_t ctc_ctrl_write(struct file *file, const char *buf, size_t count,
loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
net_device *dev;
ctc_priv *privptr;
char *e;
int bs1;
char tmp[40];
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -2795,7 +2751,7 @@ static ssize_t ctc_ctrl_write(struct file *file, const char *buf, size_t count,
static ssize_t ctc_ctrl_read(struct file *file, char *buf, size_t count,
loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
char *sbuf = (char *)file->private_data;
net_device *dev;
ctc_priv *privptr;
......@@ -2803,7 +2759,7 @@ static ssize_t ctc_ctrl_read(struct file *file, char *buf, size_t count,
char *p = sbuf;
int l;
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -2847,11 +2803,11 @@ static int ctc_stat_close(struct inode *inode, struct file *file)
static ssize_t ctc_stat_write(struct file *file, const char *buf, size_t count,
loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
net_device *dev;
ctc_priv *privptr;
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
privptr = (ctc_priv *)dev->priv;
privptr->channel[WRITE]->prof.maxmulti = 0;
......@@ -2866,7 +2822,7 @@ static ssize_t ctc_stat_write(struct file *file, const char *buf, size_t count,
static ssize_t ctc_stat_read(struct file *file, char *buf, size_t count,
loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
char *sbuf = (char *)file->private_data;
net_device *dev;
ctc_priv *privptr;
......@@ -2874,7 +2830,7 @@ static ssize_t ctc_stat_read(struct file *file, char *buf, size_t count,
char *p = sbuf;
int l;
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -2928,74 +2884,7 @@ static struct file_operations ctc_ctrl_fops = {
release: ctc_ctrl_close,
};
static struct inode_operations ctc_stat_iops = {
#if LINUX_VERSION_CODE < 0x020363
default_file_ops: &ctc_stat_fops
#endif
};
static struct inode_operations ctc_ctrl_iops = {
#if LINUX_VERSION_CODE < 0x020363
default_file_ops: &ctc_ctrl_fops
#endif
};
static struct proc_dir_entry stat_entry = {
0, /* low_ino */
10, /* namelen */
"statistics", /* name */
S_IFREG | S_IRUGO | S_IWUSR, /* mode */
1, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
&ctc_stat_iops /* ops */
};
static struct proc_dir_entry ctrl_entry = {
0, /* low_ino */
10, /* namelen */
"buffersize", /* name */
S_IFREG | S_IRUSR | S_IWUSR, /* mode */
1, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
&ctc_ctrl_iops /* ops */
};
#if LINUX_VERSION_CODE < 0x020363
static struct proc_dir_entry ctc_dir = {
0, /* low_ino */
3, /* namelen */
"ctc", /* name */
S_IFDIR | S_IRUGO | S_IXUGO, /* mode */
2, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
0, /* ops */
0, /* get_info */
ctc_fill_inode /* fill_ino (for locking) */
};
static struct proc_dir_entry ctc_template =
{
0, /* low_ino */
0, /* namelen */
"", /* name */
S_IFDIR | S_IRUGO | S_IXUGO, /* mode */
2, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
0, /* ops */
0, /* get_info */
ctc_fill_inode /* fill_ino (for locking) */
};
#else
static struct proc_dir_entry *ctc_dir = NULL;
static struct proc_dir_entry *ctc_template = NULL;
#endif
/**
* Create the driver's main directory /proc/net/ctc
......@@ -3004,13 +2893,8 @@ static void ctc_proc_create_main(void) {
/**
* If not registered, register main proc dir-entry now
*/
#if LINUX_VERSION_CODE > 0x020362
if (!ctc_dir)
ctc_dir = proc_mkdir("ctc", proc_net);
#else
if (ctc_dir.low_ino == 0)
proc_net_register(&ctc_dir);
#endif
}
#ifdef MODULE
......@@ -3018,11 +2902,7 @@ static void ctc_proc_create_main(void) {
* Destroy /proc/net/ctc
*/
static void ctc_proc_destroy_main(void) {
#if LINUX_VERSION_CODE > 0x020362
remove_proc_entry("ctc", proc_net);
#else
proc_net_unregister(ctc_dir.low_ino);
#endif
}
#endif MODULE
......@@ -3037,27 +2917,17 @@ static void ctc_proc_destroy_main(void) {
static void ctc_proc_create_sub(net_device *dev) {
ctc_priv *privptr = dev->priv;
#if LINUX_VERSION_CODE > 0x020362
privptr->proc_dentry = proc_mkdir(dev->name, ctc_dir);
privptr->proc_stat_entry =
create_proc_entry("statistics",
S_IFREG | S_IRUSR | S_IWUSR,
privptr->proc_dentry);
privptr->proc_stat_entry->proc_fops = &ctc_stat_fops;
privptr->proc_stat_entry->proc_iops = &ctc_stat_iops;
privptr->proc_ctrl_entry =
create_proc_entry("buffersize",
S_IFREG | S_IRUSR | S_IWUSR,
privptr->proc_dentry);
privptr->proc_ctrl_entry->proc_fops = &ctc_ctrl_fops;
privptr->proc_ctrl_entry->proc_iops = &ctc_ctrl_iops;
#else
privptr->proc_dentry->name = dev->name;
privptr->proc_dentry->namelen = strlen(dev->name);
proc_register(&ctc_dir, privptr->proc_dentry);
proc_register(privptr->proc_dentry, privptr->proc_stat_entry);
proc_register(privptr->proc_dentry, privptr->proc_ctrl_entry);
#endif
privptr->proc_registered = 1;
}
......@@ -3070,18 +2940,9 @@ static void ctc_proc_create_sub(net_device *dev) {
static void ctc_proc_destroy_sub(ctc_priv *privptr) {
if (!privptr->proc_registered)
return;
#if LINUX_VERSION_CODE > 0x020362
remove_proc_entry("statistics", privptr->proc_dentry);
remove_proc_entry("buffersize", privptr->proc_dentry);
remove_proc_entry(privptr->proc_dentry->name, ctc_dir);
#else
proc_unregister(privptr->proc_dentry,
privptr->proc_stat_entry->low_ino);
proc_unregister(privptr->proc_dentry,
privptr->proc_ctrl_entry->low_ino);
proc_unregister(&ctc_dir,
privptr->proc_dentry->low_ino);
#endif
privptr->proc_registered = 0;
}
......@@ -3263,14 +3124,8 @@ static param *find_param(char *name) {
static void ctc_setup(char *setup)
# define ctc_setup_return return
#else MODULE
# if LINUX_VERSION_CODE < 0x020300
__initfunc(void ctc_setup(char *setup, int *ints))
# define ctc_setup_return return
# define ints local_ints
# else
static int __init ctc_setup(char *setup)
# define ctc_setup_return return(1)
# endif
#endif MODULE
{
int write_dev;
......@@ -3368,9 +3223,7 @@ static param *find_param(char *name) {
ctc_setup_return;
}
#if LINUX_VERSION_CODE >= 0x020300
__setup("ctc=", ctc_setup);
#endif
#endif /* !CTC_CHANDEV */
......@@ -3443,17 +3296,12 @@ ctc_init_netdevice(net_device *dev, int alloc_device)
ctc_priv *privptr;
int priv_size;
if (alloc_device) {
dev = kmalloc(sizeof(net_device)
#if LINUX_VERSION_CODE < 0x020300
+ 11 /* name + zero */
#endif
, GFP_KERNEL);
dev = kmalloc(sizeof(net_device), GFP_KERNEL);
if (!dev)
return NULL;
memset(dev, 0, sizeof(net_device));
}
priv_size = sizeof(ctc_priv) + sizeof(ctc_template) +
sizeof(stat_entry) + sizeof(ctrl_entry);
priv_size = sizeof(ctc_priv);
dev->priv = kmalloc(priv_size, GFP_KERNEL);
if (dev->priv == NULL) {
if (alloc_device)
......@@ -3462,17 +3310,6 @@ ctc_init_netdevice(net_device *dev, int alloc_device)
}
memset(dev->priv, 0, priv_size);
privptr = (ctc_priv *)dev->priv;
privptr->proc_dentry = (struct proc_dir_entry *)
(((char *)privptr) + sizeof(ctc_priv));
privptr->proc_stat_entry = (struct proc_dir_entry *)
(((char *)privptr) + sizeof(ctc_priv) +
sizeof(ctc_template));
privptr->proc_ctrl_entry = (struct proc_dir_entry *)
(((char *)privptr) + sizeof(ctc_priv) +
sizeof(ctc_template) + sizeof(stat_entry));
memcpy(privptr->proc_dentry, &ctc_template, sizeof(ctc_template));
memcpy(privptr->proc_stat_entry, &stat_entry, sizeof(stat_entry));
memcpy(privptr->proc_ctrl_entry, &ctrl_entry, sizeof(ctrl_entry));
privptr->fsm = init_fsm("ctcdev", dev_state_names,
dev_event_names, NR_DEV_STATES, NR_DEV_EVENTS,
dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
......@@ -3890,9 +3727,6 @@ int ctc_init(void) {
ret = -ENOMEM;
break;
}
#if LINUX_VERSION_CODE < 0x020300
dev->name = (unsigned char *)dev + sizeof(net_device);
#endif
if (par && par->name) {
char *p;
int n;
......@@ -3989,9 +3823,7 @@ int ctc_init(void) {
}
#ifndef MODULE
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,3,0))
__initcall(ctc_init);
#endif /* LINUX_VERSION_CODE */
#endif /* MODULE */
/* --- This is the END my friend --- */
......@@ -75,14 +75,7 @@ MODULE_PARM_DESC (iucv,
static char *iucv = "";
/**
* compatibility stuff
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0))
typedef struct net_device net_device;
#else
typedef struct device net_device;
#endif
/**
......@@ -141,9 +134,7 @@ typedef struct iucv_event_t {
*/
typedef struct netiucv_priv_t {
struct net_device_stats stats;
#if LINUX_VERSION_CODE >= 0x02032D
unsigned long tbusy;
#endif
fsm_instance *fsm;
iucv_connection *conn;
struct proc_dir_entry *proc_dentry;
......@@ -172,20 +163,6 @@ typedef struct ll_header_t {
* Compatibility macros for busy handling
* of network devices.
*/
#if LINUX_VERSION_CODE < 0x02032D
static __inline__ void netiucv_clear_busy(net_device *dev)
{
clear_bit(0 ,(void *)&dev->tbusy);
mark_bh(NET_BH);
}
static __inline__ int netiucv_test_and_set_busy(net_device *dev)
{
return(test_and_set_bit(0, (void *)&dev->tbusy));
}
#define SET_DEVICE_START(device, value) dev->start = value
#else
static __inline__ void netiucv_clear_busy(net_device *dev)
{
clear_bit(0, &(((netiucv_priv *)dev->priv)->tbusy));
......@@ -199,11 +176,6 @@ static __inline__ int netiucv_test_and_set_busy(net_device *dev)
}
#define SET_DEVICE_START(device, value)
#endif
#if LINUX_VERSION_CODE < 0x020400
# define dev_kfree_skb_irq(a) dev_kfree_skb(a)
#endif
__u8 iucv_host[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
__u8 iucvMagic[16] = {
......@@ -1282,7 +1254,7 @@ netiucv_change_mtu (net_device * dev, int new_mtu)
*****************************************************************************/
static net_device *
find_netdev_by_ino(unsigned long ino)
find_netdev_by_ino(struct proc_dir_entry *pde)
{
iucv_connection *conn = connections;
net_device *dev = NULL;
......@@ -1293,9 +1265,9 @@ find_netdev_by_ino(unsigned long ino)
dev = conn->netdev;
privptr = (netiucv_priv *)dev->priv;
if ((privptr->proc_buffer_entry->low_ino == ino) ||
(privptr->proc_user_entry->low_ino == ino) ||
(privptr->proc_stat_entry->low_ino == ino) )
if ((privptr->proc_buffer_entry == pde) ||
(privptr->proc_user_entry == pde) ||
(privptr->proc_stat_entry == pde) )
return dev;
}
conn = conn->next;
......@@ -1303,21 +1275,6 @@ find_netdev_by_ino(unsigned long ino)
return NULL;
}
#if LINUX_VERSION_CODE < 0x020363
/**
* Lock the module, if someone changes into
* our proc directory.
*/
static void
netiucv_fill_inode(struct inode *inode, int fill)
{
if (fill) {
MOD_INC_USE_COUNT;
} else
MOD_DEC_USE_COUNT;
}
#endif
#define CTRL_BUFSIZE 40
static int
......@@ -1342,14 +1299,14 @@ static ssize_t
netiucv_buffer_write(struct file *file, const char *buf, size_t count,
loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
net_device *dev;
netiucv_priv *privptr;
char *e;
int bs1;
char tmp[CTRL_BUFSIZE];
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -1385,7 +1342,7 @@ netiucv_buffer_write(struct file *file, const char *buf, size_t count,
static ssize_t
netiucv_buffer_read(struct file *file, char *buf, size_t count, loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
char *sbuf = (char *)file->private_data;
net_device *dev;
netiucv_priv *privptr;
......@@ -1393,7 +1350,7 @@ netiucv_buffer_read(struct file *file, char *buf, size_t count, loff_t *off)
char *p = sbuf;
int l;
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -1438,7 +1395,7 @@ static ssize_t
netiucv_user_write(struct file *file, const char *buf, size_t count,
loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
net_device *dev;
netiucv_priv *privptr;
int i;
......@@ -1446,7 +1403,7 @@ netiucv_user_write(struct file *file, const char *buf, size_t count,
char tmp[CTRL_BUFSIZE];
char user[9];
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -1480,7 +1437,7 @@ netiucv_user_write(struct file *file, const char *buf, size_t count,
static ssize_t
netiucv_user_read(struct file *file, char *buf, size_t count, loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
char *sbuf = (char *)file->private_data;
net_device *dev;
netiucv_priv *privptr;
......@@ -1488,7 +1445,7 @@ netiucv_user_read(struct file *file, char *buf, size_t count, loff_t *off)
char *p = sbuf;
int l;
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -1536,11 +1493,11 @@ netiucv_stat_close(struct inode *inode, struct file *file)
static ssize_t
netiucv_stat_write(struct file *file, const char *buf, size_t count, loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
net_device *dev;
netiucv_priv *privptr;
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
privptr = (netiucv_priv *)dev->priv;
privptr->conn->prof.maxmulti = 0;
......@@ -1555,7 +1512,7 @@ netiucv_stat_write(struct file *file, const char *buf, size_t count, loff_t *off
static ssize_t
netiucv_stat_read(struct file *file, char *buf, size_t count, loff_t *off)
{
unsigned int ino = ((struct inode *)file->f_dentry->d_inode)->i_ino;
struct proc_dir_entry *pde = PDE(file->f_dentry->d_inode);
char *sbuf = (char *)file->private_data;
net_device *dev;
netiucv_priv *privptr;
......@@ -1563,7 +1520,7 @@ netiucv_stat_read(struct file *file, char *buf, size_t count, loff_t *off)
char *p = sbuf;
int l;
if (!(dev = find_netdev_by_ino(ino)))
if (!(dev = find_netdev_by_ino(pde)))
return -ENODEV;
if (off != &file->f_pos)
return -ESPIPE;
......@@ -1624,92 +1581,8 @@ static struct file_operations netiucv_user_fops = {
release: netiucv_user_close,
};
static struct inode_operations netiucv_stat_iops = {
#if LINUX_VERSION_CODE < 0x020363
default_file_ops: &netiucv_stat_fops
#endif
};
static struct inode_operations netiucv_buffer_iops = {
#if LINUX_VERSION_CODE < 0x020363
default_file_ops: &netiucv_buffer_fops
#endif
};
static struct inode_operations netiucv_user_iops = {
#if LINUX_VERSION_CODE < 0x020363
default_file_ops: &netiucv_user_fops
#endif
};
static struct proc_dir_entry stat_entry = {
0, /* low_ino */
10, /* namelen */
"statistics", /* name */
S_IFREG | S_IRUGO | S_IWUSR, /* mode */
1, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
&netiucv_stat_iops /* ops */
};
static struct proc_dir_entry buffer_entry = {
0, /* low_ino */
10, /* namelen */
"buffersize", /* name */
S_IFREG | S_IRUSR | S_IWUSR, /* mode */
1, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
&netiucv_buffer_iops /* ops */
};
static struct proc_dir_entry user_entry = {
0, /* low_ino */
8, /* namelen */
"username", /* name */
S_IFREG | S_IRUSR | S_IWUSR, /* mode */
1, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
&netiucv_user_iops /* ops */
};
#if LINUX_VERSION_CODE < 0x020363
static struct proc_dir_entry netiucv_dir = {
0, /* low_ino */
4, /* namelen */
"iucv", /* name */
S_IFDIR | S_IRUGO | S_IXUGO, /* mode */
2, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
0, /* ops */
0, /* get_info */
netiucv_fill_inode /* fill_ino (for locking) */
};
static struct proc_dir_entry netiucv_template =
{
0, /* low_ino */
0, /* namelen */
"", /* name */
S_IFDIR | S_IRUGO | S_IXUGO, /* mode */
2, /* nlink */
0, /* uid */
0, /* gid */
0, /* size */
0, /* ops */
0, /* get_info */
netiucv_fill_inode /* fill_ino (for locking) */
};
#else
static struct proc_dir_entry *netiucv_dir = NULL;
static struct proc_dir_entry *netiucv_template = NULL;
#endif
/**
* Create the driver's main directory /proc/net/iucv
......@@ -1720,13 +1593,8 @@ netiucv_proc_create_main(void)
/**
* If not registered, register main proc dir-entry now
*/
#if LINUX_VERSION_CODE > 0x020362
if (!netiucv_dir)
netiucv_dir = proc_mkdir("iucv", proc_net);
#else
if (netiucv_dir.low_ino == 0)
proc_net_register(&netiucv_dir);
#endif
}
#ifdef MODULE
......@@ -1736,11 +1604,7 @@ netiucv_proc_create_main(void)
static void
netiucv_proc_destroy_main(void)
{
#if LINUX_VERSION_CODE > 0x020362
remove_proc_entry("iucv", proc_net);
#else
proc_net_unregister(netiucv_dir.low_ino);
#endif
}
#endif MODULE
......@@ -1756,34 +1620,22 @@ static void
netiucv_proc_create_sub(net_device *dev) {
netiucv_priv *privptr = dev->priv;
#if LINUX_VERSION_CODE > 0x020362
privptr->proc_dentry = proc_mkdir(dev->name, netiucv_dir);
privptr->proc_stat_entry =
create_proc_entry("statistics",
S_IFREG | S_IRUSR | S_IWUSR,
privptr->proc_dentry);
privptr->proc_stat_entry->proc_fops = &netiucv_stat_fops;
privptr->proc_stat_entry->proc_iops = &netiucv_stat_iops;
privptr->proc_buffer_entry =
create_proc_entry("buffersize",
S_IFREG | S_IRUSR | S_IWUSR,
privptr->proc_dentry);
privptr->proc_buffer_entry->proc_fops = &netiucv_buffer_fops;
privptr->proc_buffer_entry->proc_iops = &netiucv_buffer_iops;
privptr->proc_user_entry =
create_proc_entry("username",
S_IFREG | S_IRUSR | S_IWUSR,
privptr->proc_dentry);
privptr->proc_user_entry->proc_fops = &netiucv_user_fops;
privptr->proc_user_entry->proc_iops = &netiucv_user_iops;
#else
privptr->proc_dentry->name = dev->name;
privptr->proc_dentry->namelen = strlen(dev->name);
proc_register(&netiucv_dir, privptr->proc_dentry);
proc_register(privptr->proc_dentry, privptr->proc_stat_entry);
proc_register(privptr->proc_dentry, privptr->proc_buffer_entry);
proc_register(privptr->proc_dentry, privptr->proc_user_entry);
#endif
privptr->proc_registered = 1;
}
......@@ -1797,21 +1649,10 @@ static void
netiucv_proc_destroy_sub(netiucv_priv *privptr) {
if (!privptr->proc_registered)
return;
#if LINUX_VERSION_CODE > 0x020362
remove_proc_entry("statistics", privptr->proc_dentry);
remove_proc_entry("buffersize", privptr->proc_dentry);
remove_proc_entry("username", privptr->proc_dentry);
remove_proc_entry(privptr->proc_dentry->name, netiucv_dir);
#else
proc_unregister(privptr->proc_dentry,
privptr->proc_stat_entry->low_ino);
proc_unregister(privptr->proc_dentry,
privptr->proc_buffer_entry->low_ino);
proc_unregister(privptr->proc_dentry,
privptr->proc_user_entry->low_ino);
proc_unregister(&netiucv_dir,
privptr->proc_dentry->low_ino);
#endif
privptr->proc_registered = 0;
}
......@@ -1904,21 +1745,13 @@ netiucv_init_netdevice(int ifno, char *username)
netiucv_priv *privptr;
int priv_size;
net_device *dev = kmalloc(sizeof(net_device)
#if LINUX_VERSION_CODE < 0x020300
+ 11 /* name + zero */
#endif
, GFP_KERNEL);
net_device *dev = kmalloc(sizeof(net_device), GFP_KERNEL);
if (!dev)
return NULL;
memset(dev, 0, sizeof(net_device));
#if LINUX_VERSION_CODE < 0x020300
dev->name = (char *)dev + sizeof(net_device);
#endif
sprintf(dev->name, "iucv%d", ifno);
priv_size = sizeof(netiucv_priv) + sizeof(netiucv_template) +
sizeof(stat_entry) + sizeof(buffer_entry) + sizeof(user_entry);
priv_size = sizeof(netiucv_priv);
dev->priv = kmalloc(priv_size, GFP_KERNEL);
if (dev->priv == NULL) {
kfree(dev);
......@@ -1926,23 +1759,6 @@ netiucv_init_netdevice(int ifno, char *username)
}
memset(dev->priv, 0, priv_size);
privptr = (netiucv_priv *)dev->priv;
privptr->proc_dentry = (struct proc_dir_entry *)
(((char *)privptr) + sizeof(netiucv_priv));
privptr->proc_stat_entry = (struct proc_dir_entry *)
(((char *)privptr) + sizeof(netiucv_priv) +
sizeof(netiucv_template));
privptr->proc_buffer_entry = (struct proc_dir_entry *)
(((char *)privptr) + sizeof(netiucv_priv) +
sizeof(netiucv_template) + sizeof(stat_entry));
privptr->proc_user_entry = (struct proc_dir_entry *)
(((char *)privptr) + sizeof(netiucv_priv) +
sizeof(netiucv_template) + sizeof(stat_entry) +
sizeof(buffer_entry));
memcpy(privptr->proc_dentry, &netiucv_template,
sizeof(netiucv_template));
memcpy(privptr->proc_stat_entry, &stat_entry, sizeof(stat_entry));
memcpy(privptr->proc_buffer_entry, &buffer_entry, sizeof(buffer_entry));
memcpy(privptr->proc_user_entry, &user_entry, sizeof(user_entry));
privptr->fsm = init_fsm("netiucvdev", dev_state_names,
dev_event_names, NR_DEV_STATES, NR_DEV_EVENTS,
dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
......@@ -2015,14 +1831,9 @@ netiucv_banner(void)
}
#ifndef MODULE
# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0))
# define init_return(a) return a
static int __init
iucv_setup(char *param)
# else
# define init_return(a) return
__initfunc (void iucv_setup(char *param, int *ints))
# endif
{
/**
* We do not parse parameters here because at the time of
......@@ -2034,9 +1845,7 @@ __initfunc (void iucv_setup(char *param, int *ints))
init_return(1);
}
# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0))
__setup ("iucv=", iucv_setup);
# endif
#else
static void
netiucv_exit(void)
......
......@@ -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