drbd: Preparing the connector interface to operator on connections
Up to now it only operated on minor numbers. Now it can work also
on named connections.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index cbec5ff..4761426 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2196,6 +2196,21 @@
INIT_LIST_HEAD(&wq->q);
}
+struct drbd_tconn *conn_by_name(const char *name)
+{
+ struct drbd_tconn *tconn;
+
+ write_lock_irq(&global_state_lock);
+ list_for_each_entry(tconn, &drbd_tconns, all_tconn) {
+ if (!strcmp(tconn->name, name))
+ goto found;
+ }
+ tconn = NULL;
+found:
+ write_unlock_irq(&global_state_lock);
+ return tconn;
+}
+
struct drbd_tconn *drbd_new_tconn(char *name)
{
struct drbd_tconn *tconn;