Lines Matching +full:use +full:- +full:case
3 * SPDX-License-Identifier: Apache-2.0
24 struct nvme_namespace *ns = CONTAINER_OF(disk->name, in nvme_disk_read()
33 LOG_WRN("Data buffer pointer needs to be 4-bytes aligned"); in nvme_disk_read()
34 return -EINVAL; in nvme_disk_read()
37 nvme_lock(disk->dev); in nvme_disk_read()
44 ret = -ENOMEM; in nvme_disk_read()
48 nvme_namespace_read_cmd(&request->cmd, ns->id, in nvme_disk_read()
51 /* We use only the first ioq atm in nvme_disk_read()
52 * ToDo: use smp cpu id and use it to select ioq in nvme_disk_read()
54 nvme_cmd_qpair_submit_request(ns->ctrlr->ioq, request); in nvme_disk_read()
59 start_sector, num_sector, ns->name); in nvme_disk_read()
61 ret = -EIO; in nvme_disk_read()
64 nvme_unlock(disk->dev); in nvme_disk_read()
73 struct nvme_namespace *ns = CONTAINER_OF(disk->name, in nvme_disk_write()
82 LOG_WRN("Data buffer pointer needs to be 4-bytes aligned"); in nvme_disk_write()
83 return -EINVAL; in nvme_disk_write()
86 nvme_lock(disk->dev); in nvme_disk_write()
93 ret = -ENOMEM; in nvme_disk_write()
97 nvme_namespace_write_cmd(&request->cmd, ns->id, in nvme_disk_write()
100 /* We use only the first ioq atm in nvme_disk_write()
101 * ToDo: use smp cpu id and use it to select ioq in nvme_disk_write()
103 nvme_cmd_qpair_submit_request(ns->ctrlr->ioq, request); in nvme_disk_write()
108 start_sector, num_sector, ns->name); in nvme_disk_write()
110 ret = -EIO; in nvme_disk_write()
113 nvme_unlock(disk->dev); in nvme_disk_write()
125 return -ENOMEM; in nvme_disk_flush()
128 nvme_namespace_flush_cmd(&request->cmd, ns->id); in nvme_disk_flush()
130 /* We use only the first ioq in nvme_disk_flush()
131 * ToDo: use smp cpu id and use it to select ioq in nvme_disk_flush()
133 nvme_cmd_qpair_submit_request(ns->ctrlr->ioq, request); in nvme_disk_flush()
137 LOG_ERR("Flushing disk %s failed", ns->name); in nvme_disk_flush()
139 return -EIO; in nvme_disk_flush()
147 struct nvme_namespace *ns = CONTAINER_OF(disk->name, in nvme_disk_ioctl()
151 nvme_lock(disk->dev); in nvme_disk_ioctl()
154 case DISK_IOCTL_GET_SECTOR_COUNT: in nvme_disk_ioctl()
156 ret = -EINVAL; in nvme_disk_ioctl()
163 case DISK_IOCTL_GET_SECTOR_SIZE: in nvme_disk_ioctl()
165 ret = -EINVAL; in nvme_disk_ioctl()
172 case DISK_IOCTL_GET_ERASE_BLOCK_SZ: in nvme_disk_ioctl()
174 ret = -EINVAL; in nvme_disk_ioctl()
181 case DISK_IOCTL_CTRL_DEINIT: in nvme_disk_ioctl()
182 case DISK_IOCTL_CTRL_SYNC: in nvme_disk_ioctl()
185 case DISK_IOCTL_CTRL_INIT: in nvme_disk_ioctl()
189 ret = -EINVAL; in nvme_disk_ioctl()
192 nvme_unlock(disk->dev); in nvme_disk_ioctl()
212 disk->name = ns->name; in nvme_namespace_disk_setup()
213 disk->ops = &nvme_disk_ops; in nvme_namespace_disk_setup()
214 disk->dev = ns->ctrlr->dev; in nvme_namespace_disk_setup()