Lines Matching +full:disk +full:- +full:name

3  * SPDX-License-Identifier: Apache-2.0
14 static int nvme_disk_status(struct disk_info *disk) in nvme_disk_status() argument
19 static int nvme_disk_read(struct disk_info *disk, in nvme_disk_read() argument
24 struct nvme_namespace *ns = CONTAINER_OF(disk->name, in nvme_disk_read()
25 struct nvme_namespace, name[0]); 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()
54 nvme_cmd_qpair_submit_request(ns->ctrlr->ioq, request); in nvme_disk_read()
58 LOG_WRN("Reading at sector %u (count %d) on disk %s failed", 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()
68 static int nvme_disk_write(struct disk_info *disk, in nvme_disk_write() argument
73 struct nvme_namespace *ns = CONTAINER_OF(disk->name, in nvme_disk_write()
74 struct nvme_namespace, name[0]); 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()
103 nvme_cmd_qpair_submit_request(ns->ctrlr->ioq, request); in nvme_disk_write()
107 LOG_WRN("Writing at sector %u (count %d) on disk %s failed", 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()
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()
145 static int nvme_disk_ioctl(struct disk_info *disk, uint8_t cmd, void *buff) in nvme_disk_ioctl() argument
147 struct nvme_namespace *ns = CONTAINER_OF(disk->name, in nvme_disk_ioctl()
148 struct nvme_namespace, name[0]); in nvme_disk_ioctl()
151 nvme_lock(disk->dev); in nvme_disk_ioctl()
156 ret = -EINVAL; in nvme_disk_ioctl()
165 ret = -EINVAL; in nvme_disk_ioctl()
174 ret = -EINVAL; in nvme_disk_ioctl()
189 ret = -EINVAL; in nvme_disk_ioctl()
192 nvme_unlock(disk->dev); in nvme_disk_ioctl()
196 static int nvme_disk_init(struct disk_info *disk) in nvme_disk_init() argument
198 return nvme_disk_ioctl(disk, DISK_IOCTL_CTRL_INIT, NULL); in nvme_disk_init()
210 struct disk_info *disk) in nvme_namespace_disk_setup() argument
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()
216 return disk_access_register(disk); in nvme_namespace_disk_setup()