aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/rnbd/rnbd-common.c
diff options
context:
space:
mode:
authorJack Wang2020-05-11 15:51:21 +0200
committerJason Gunthorpe2020-05-17 18:57:15 -0300
commit219ace60770117fbe440904f9156ab2ab8f30e7d (patch)
tree27fef145fd68b0b6c0c55bd075936e02b25e177b /drivers/block/rnbd/rnbd-common.c
parent745b6a3d4a673c0b8de6e7c15b0620117614b75b (diff)
block/rnbd: private headers with rnbd protocol structs and helpers
These are common private headers with rnbd protocol structures, logging, sysfs and other helper functions, which are used on both client and server sides. Link: https://lore.kernel.org/r/20200511135131.27580-16-danil.kipnis@cloud.ionos.com Signed-off-by: Danil Kipnis <danil.kipnis@cloud.ionos.com> Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Acked-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/block/rnbd/rnbd-common.c')
-rw-r--r--drivers/block/rnbd/rnbd-common.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/block/rnbd/rnbd-common.c b/drivers/block/rnbd/rnbd-common.c
new file mode 100644
index 000000000000..596c3f732403
--- /dev/null
+++ b/drivers/block/rnbd/rnbd-common.c
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * RDMA Network Block Driver
+ *
+ * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
+ * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
+ * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
+ */
+#include "rnbd-proto.h"
+
+const char *rnbd_access_mode_str(enum rnbd_access_mode mode)
+{
+ switch (mode) {
+ case RNBD_ACCESS_RO:
+ return "ro";
+ case RNBD_ACCESS_RW:
+ return "rw";
+ case RNBD_ACCESS_MIGRATION:
+ return "migration";
+ default:
+ return "unknown";
+ }
+}