summaryrefslogtreecommitdiff
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2011-06-14 20:28:09 +0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 19:57:46 +0400
commit089c075d88ac9407b8d7c5c8fc4b21c0d940bd82 (patch)
treec68e1a24d7813abe883702255a37dc704f2ea8fd /drivers/block/drbd/drbd_main.c
parent44e52cfaa22e44a0197b44cd72c3440bc2a6e1ed (diff)
downloadlinux-089c075d88ac9407b8d7c5c8fc4b21c0d940bd82.tar.xz
drbd: Convert the generic netlink interface to accept connection endpoints
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 178c711bc4af..79f275dc43a4 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2420,6 +2420,27 @@ found:
return tconn;
}
+struct drbd_tconn *conn_get_by_addrs(void *my_addr, int my_addr_len,
+ void *peer_addr, int peer_addr_len)
+{
+ struct drbd_tconn *tconn;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(tconn, &drbd_tconns, all_tconn) {
+ if (tconn->my_addr_len == my_addr_len &&
+ tconn->peer_addr_len == peer_addr_len &&
+ !memcmp(&tconn->my_addr, my_addr, my_addr_len) &&
+ !memcmp(&tconn->peer_addr, peer_addr, peer_addr_len)) {
+ kref_get(&tconn->kref);
+ goto found;
+ }
+ }
+ tconn = NULL;
+found:
+ rcu_read_unlock();
+ return tconn;
+}
+
static int drbd_alloc_socket(struct drbd_socket *socket)
{
socket->rbuf = (void *) __get_free_page(GFP_KERNEL);