hw/scsi: Use error_setg_file_open() for a better error message

The error message changes from

    vhost-scsi: open vhost char device failed: REASON

to

    Could not open '/dev/vhost-scsi': REASON

I think the exact file name is more useful to know than the file's
purpose.

We could put back the "vhost-scsi: " prefix with error_prepend().  Not
worth the bother.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251121121438.1249498-7-armbru@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Markus Armbruster 2025-11-21 13:14:29 +01:00 committed by Philippe Mathieu-Daudé
parent 622a0c9dee
commit 6d85f1d449

View file

@ -245,8 +245,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
} else {
vhostfd = open("/dev/vhost-scsi", O_RDWR);
if (vhostfd < 0) {
error_setg(errp, "vhost-scsi: open vhost char device failed: %s",
strerror(errno));
error_setg_file_open(errp, errno, "/dev/vhost-scsi");
return;
}
}