Hi Stefan; Thanks for your advices! The existing PRManager only works with local scsi devices. This series will completely decouple devices and drivers. The device can not only be scsi, but also other devices such as nvme. The same is true for the driver, which is completely unrestricted. And block/file-posix.c can implement the new block driver, and pr_manager can be executed after splicing ioctl commands in these drivers. This will be implemented in subsequent patches.
v1->v2: - Add sg_persist --report-capabilities for SCSI protocol and enable oncs and rescap for NVMe protocol. - Add persistent reservation capabilities constants and helper functions for SCSI and NVMe protocol. - Add comments for necessary APIs. v1: - Add seven APIs about persistent reservation command for block layer. These APIs including reading keys, reading reservations, registering, reserving, releasing, clearing and preempting. - Add the necessary pr-related operation APIs for both the SCSI protocol and NVMe protocol at the device layer. - Add scsi driver at the driver layer to verify the functions. Changqi Lu (11): block: add persistent reservation in/out api block/raw: add persistent reservation in/out driver scsi/constant: add persistent reservation in/out protocol constants scsi/util: add helper functions for persistent reservation types conversion hw/scsi: add persistent reservation in/out api for scsi device block/nvme: add reservation command protocol constants hw/nvme: add helper functions for converting reservation types hw/nvme: enable ONCS reservations hw/nvme: enable namespace rescap function hw/nvme: add reservation protocal command block/iscsi: add persistent reservation in/out driver block/block-backend.c | 390 ++++++++++++++++++++++++++ block/io.c | 161 +++++++++++ block/iscsi.c | 448 ++++++++++++++++++++++++++++++ block/raw-format.c | 55 ++++ hw/nvme/ctrl.c | 307 +++++++++++++++++++- hw/nvme/ns.c | 7 + hw/nvme/nvme.h | 44 +++ hw/scsi/scsi-disk.c | 348 +++++++++++++++++++++++ include/block/block-common.h | 40 +++ include/block/block-io.h | 19 ++ include/block/block_int-common.h | 85 ++++++ include/block/nvme.h | 92 ++++++ include/scsi/constants.h | 52 ++++ include/scsi/utils.h | 8 + include/sysemu/block-backend-io.h | 22 ++ scsi/utils.c | 77 +++++ 16 files changed, 2153 insertions(+), 2 deletions(-) -- 2.20.1