]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nvmet: constify struct nvmet_fabrics_ops
authorChristoph Hellwig <hch@lst.de>
Tue, 20 Mar 2018 19:41:35 +0000 (20:41 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Mar 2018 14:53:43 +0000 (08:53 -0600)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/core.c
drivers/nvme/target/fc.c
drivers/nvme/target/loop.c
drivers/nvme/target/nvmet.h
drivers/nvme/target/rdma.c

index a78029e4e5f481b58bd628537315d3e7e9882f1a..e95424f172fd0b124ae437d82c008a595a38d1aa 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "nvmet.h"
 
-static struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
+static const struct nvmet_fabrics_ops *nvmet_transports[NVMF_TRTYPE_MAX];
 static DEFINE_IDA(cntlid_ida);
 
 /*
@@ -137,7 +137,7 @@ static void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
        schedule_work(&ctrl->async_event_work);
 }
 
-int nvmet_register_transport(struct nvmet_fabrics_ops *ops)
+int nvmet_register_transport(const struct nvmet_fabrics_ops *ops)
 {
        int ret = 0;
 
@@ -152,7 +152,7 @@ int nvmet_register_transport(struct nvmet_fabrics_ops *ops)
 }
 EXPORT_SYMBOL_GPL(nvmet_register_transport);
 
-void nvmet_unregister_transport(struct nvmet_fabrics_ops *ops)
+void nvmet_unregister_transport(const struct nvmet_fabrics_ops *ops)
 {
        down_write(&nvmet_config_sem);
        nvmet_transports[ops->type] = NULL;
@@ -162,7 +162,7 @@ EXPORT_SYMBOL_GPL(nvmet_unregister_transport);
 
 int nvmet_enable_port(struct nvmet_port *port)
 {
-       struct nvmet_fabrics_ops *ops;
+       const struct nvmet_fabrics_ops *ops;
        int ret;
 
        lockdep_assert_held(&nvmet_config_sem);
@@ -195,7 +195,7 @@ int nvmet_enable_port(struct nvmet_port *port)
 
 void nvmet_disable_port(struct nvmet_port *port)
 {
-       struct nvmet_fabrics_ops *ops;
+       const struct nvmet_fabrics_ops *ops;
 
        lockdep_assert_held(&nvmet_config_sem);
 
@@ -500,7 +500,7 @@ int nvmet_sq_init(struct nvmet_sq *sq)
 EXPORT_SYMBOL_GPL(nvmet_sq_init);
 
 bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
-               struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops)
+               struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops)
 {
        u8 flags = req->cmd->common.flags;
        u16 status;
index 9f80f98d81d2c8cde41f8551b1819c73d5c33229..33ee8d3145f89ec8b56ce55ae7807c9d68abd8a4 100644 (file)
@@ -1563,7 +1563,7 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
 
 static void nvmet_fc_fcp_nvme_cmd_done(struct nvmet_req *nvme_req);
 
-static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops;
+static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops;
 
 static void
 nvmet_fc_xmt_ls_rsp_done(struct nvmefc_tgt_ls_req *lsreq)
@@ -2518,7 +2518,7 @@ nvmet_fc_remove_port(struct nvmet_port *port)
        /* nothing to do */
 }
 
-static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = {
+static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = {
        .owner                  = THIS_MODULE,
        .type                   = NVMF_TRTYPE_FC,
        .msdbd                  = 1,
index 861d1509b22bf412e2a9bfaee408a4fcb3ad3de4..a350765d2d5c3b5c9497f33ebe3215a76700863f 100644 (file)
@@ -71,7 +71,7 @@ static DEFINE_MUTEX(nvme_loop_ctrl_mutex);
 static void nvme_loop_queue_response(struct nvmet_req *nvme_req);
 static void nvme_loop_delete_ctrl(struct nvmet_ctrl *ctrl);
 
-static struct nvmet_fabrics_ops nvme_loop_ops;
+static const struct nvmet_fabrics_ops nvme_loop_ops;
 
 static inline int nvme_loop_queue_idx(struct nvme_loop_queue *queue)
 {
@@ -675,7 +675,7 @@ static void nvme_loop_remove_port(struct nvmet_port *port)
                nvmet_loop_port = NULL;
 }
 
-static struct nvmet_fabrics_ops nvme_loop_ops = {
+static const struct nvmet_fabrics_ops nvme_loop_ops = {
        .owner          = THIS_MODULE,
        .type           = NVMF_TRTYPE_LOOP,
        .add_port       = nvme_loop_add_port,
index 40afb5d6ed91133894911f7132e75ebcde50105f..15fd84ab21f80629df2a1d3e6150032e389c931e 100644 (file)
@@ -130,7 +130,7 @@ struct nvmet_ctrl {
        struct delayed_work     ka_work;
        struct work_struct      fatal_err_work;
 
-       struct nvmet_fabrics_ops *ops;
+       const struct nvmet_fabrics_ops *ops;
 
        char                    subsysnqn[NVMF_NQN_FIELD_LEN];
        char                    hostnqn[NVMF_NQN_FIELD_LEN];
@@ -233,7 +233,7 @@ struct nvmet_req {
        struct nvmet_port       *port;
 
        void (*execute)(struct nvmet_req *req);
-       struct nvmet_fabrics_ops *ops;
+       const struct nvmet_fabrics_ops *ops;
 };
 
 static inline void nvmet_set_status(struct nvmet_req *req, u16 status)
@@ -269,7 +269,7 @@ u16 nvmet_parse_discovery_cmd(struct nvmet_req *req);
 u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req);
 
 bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
-               struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops);
+               struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops);
 void nvmet_req_uninit(struct nvmet_req *req);
 void nvmet_req_execute(struct nvmet_req *req);
 void nvmet_req_complete(struct nvmet_req *req, u16 status);
@@ -303,8 +303,8 @@ void nvmet_ns_disable(struct nvmet_ns *ns);
 struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid);
 void nvmet_ns_free(struct nvmet_ns *ns);
 
-int nvmet_register_transport(struct nvmet_fabrics_ops *ops);
-void nvmet_unregister_transport(struct nvmet_fabrics_ops *ops);
+int nvmet_register_transport(const struct nvmet_fabrics_ops *ops);
+void nvmet_unregister_transport(const struct nvmet_fabrics_ops *ops);
 
 int nvmet_enable_port(struct nvmet_port *port);
 void nvmet_disable_port(struct nvmet_port *port);
index a59263d6d158c19220a826f43a8ca1c903eef48d..52e0c5d579a7aad180472faa0d53cd106e35c615 100644 (file)
@@ -136,7 +136,7 @@ static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc);
 static void nvmet_rdma_qp_event(struct ib_event *event, void *priv);
 static void nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue);
 
-static struct nvmet_fabrics_ops nvmet_rdma_ops;
+static const struct nvmet_fabrics_ops nvmet_rdma_ops;
 
 /* XXX: really should move to a generic header sooner or later.. */
 static inline u32 get_unaligned_le24(const u8 *p)
@@ -1453,7 +1453,7 @@ static void nvmet_rdma_disc_port_addr(struct nvmet_req *req,
        }
 }
 
-static struct nvmet_fabrics_ops nvmet_rdma_ops = {
+static const struct nvmet_fabrics_ops nvmet_rdma_ops = {
        .owner                  = THIS_MODULE,
        .type                   = NVMF_TRTYPE_RDMA,
        .sqe_inline_size        = NVMET_RDMA_INLINE_DATA_SIZE,