patch-2.4.15 linux/net/netlink/netlink_dev.c
Next file: linux/net/sched/sch_api.c
Previous file: linux/net/irda/timer.c
Back to the patch index
Back to the overall index
- Lines: 48
- Date:
Fri Nov 9 14:12:55 2001
- Orig file:
v2.4.14/linux/net/netlink/netlink_dev.c
- Orig date:
Fri Feb 9 11:29:44 2001
diff -u --recursive --new-file v2.4.14/linux/net/netlink/netlink_dev.c linux/net/netlink/netlink_dev.c
@@ -28,10 +28,11 @@
#include <linux/devfs_fs_kernel.h>
#include <linux/smp_lock.h>
+#include <asm/bitops.h>
#include <asm/system.h>
#include <asm/uaccess.h>
-static unsigned open_map;
+static long open_map;
static struct socket *netlink_user[MAX_LINKS];
/*
@@ -111,11 +112,9 @@
if (minor>=MAX_LINKS)
return -ENODEV;
- if (open_map&(1<<minor))
+ if (test_and_set_bit(minor, &open_map))
return -EBUSY;
- open_map |= (1<<minor);
-
err = sock_create(PF_NETLINK, SOCK_RAW, minor, &sock);
if (err < 0)
goto out;
@@ -132,7 +131,7 @@
return 0;
out:
- open_map &= ~(1<<minor);
+ clear_bit(minor, &open_map);
return err;
}
@@ -141,11 +140,9 @@
unsigned int minor = MINOR(inode->i_rdev);
struct socket *sock;
- lock_kernel();
sock = netlink_user[minor];
netlink_user[minor] = NULL;
- open_map &= ~(1<<minor);
- unlock_kernel();
+ clear_bit(minor, &open_map);
sock_release(sock);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)