Re: [RFC PATCH 4/9] nvmet: add a controller "start" hook

From
Ming Lin <mlin@kernel.org>
Date
2015-11-20 05:31:10
Also in
linux-nvme, qemu-devel
On Fri, 2015-11-20 at 06:13 +0100, Christoph Hellwig wrote:
On Thu, Nov 19, 2015 at 04:21:03PM -0800, Ming Lin wrote:
quoted
 #define NVMET_SUBSYS_NAME_LEN		256
 	char			subsys_name[NVMET_SUBSYS_NAME_LEN];
+
+	void			*opaque;
+	void			(*start)(void *);
 };
Why can't vhost use container_of to get at the containing structure
similar to what the loop driver does?
struct nvme_loop_ctrl {

        struct nvme_ctrl        ctrl;

        struct nvmet_ctrl       *target_ctrl;
};

static inline struct nvme_loop_ctrl *to_loop_ctrl(struct nvme_ctrl *ctrl)
{
        return container_of(ctrl, struct nvme_loop_ctrl, ctrl);
}

loop driver's container_of is used for "nvme_ctrl", not "nvmet_ctrl"

Possibly change:
struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_subsys *subsys,
                const char *subsys_name)
to 
int nvmet_init_ctrl(struct nvmet_ctrl *, ....)
?

So we can embed "struct nvmet_ctrl" to upper layer structure.
In addition I think we'll eventually need an ops structure here,
but I can take care of that later.
Thread (1 message) 1 message, 1 author, last reply 2015-11-20
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help