[RFC PATCH 1/8] nvme-core: add new interfaces

Logan Gunthorpe logang at deltatee.com
Fri Mar 30 10:48:19 PDT 2018



On 30/03/18 12:57 AM, Chaitanya Kulkarni wrote:
> +int nvme_get_ctrl_by_name(char *ctrl_name, struct nvme_ctrl **ctrl)
> +{
> +	int ret = -ENODEV;
> +	char str[256] = "/dev/";

Kernel code should not make assumptions about the layout of the
filesystem. Prepending "/dev/" to a controller name is icky. I'd suggest
looking at blkdev_get_by_path() and doing something similar. Also this
function should probably be called nvme_get_ctrl_by_path() seeing it
seems to be trying to take a path and not a name.

Logan



More information about the Linux-nvme mailing list