From 4a5d9e324654d1ca608ba6c4d8f797284bc7b34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 28 Oct 2004 19:08:40 +0000 Subject: [PATCH] The scsi_periph module is now nice to Ingo: B_GET_MEDIA_STATUS now returns B_OK in case the device is not removable; IOW we always have the medium, dude. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9622 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/generic/scsi_periph/io.c | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/generic/scsi_periph/io.c b/src/add-ons/kernel/generic/scsi_periph/io.c index 38c4a6fbc6..faab005396 100644 --- a/src/add-ons/kernel/generic/scsi_periph/io.c +++ b/src/add-ons/kernel/generic/scsi_periph/io.c @@ -1,6 +1,6 @@ /* ** Copyright 2002/03, Thomas Kurschel. All rights reserved. -** Distributed under the terms of the OpenBeOS License. +** Distributed under the terms of the Haiku License. */ /* @@ -258,7 +258,7 @@ raw_command(scsi_periph_device_info *device, raw_device_command *cmd) if ((request->subsys_status & SCSI_AUTOSNS_VALID) != 0 && cmd->sense_data) { memcpy(cmd->sense_data, request->sense, - min(cmd->sense_data_length, SCSI_MAX_SENSE_SIZE - request->sense_resid)); + min(cmd->sense_data_length, (size_t)SCSI_MAX_SENSE_SIZE - request->sense_resid)); } if ((cmd->flags & B_RAW_DEVICE_REPORT_RESIDUAL) != 0) { @@ -276,31 +276,29 @@ raw_command(scsi_periph_device_info *device, raw_device_command *cmd) status_t -periph_ioctl(scsi_periph_handle_info *handle, int op, void *buf, size_t len) +periph_ioctl(scsi_periph_handle_info *handle, int op, void *buffer, size_t length) { switch (op) { case B_GET_MEDIA_STATUS: { - status_t res; + status_t res = B_OK; - if (!handle->device->removable) - return B_BAD_VALUE; + if (handle->device->removable) + res = periph_get_media_status(handle); - res = periph_get_media_status(handle); SHOW_FLOW(2, "%s", strerror(res)); - *(status_t *)buf = res; - + *(status_t *)buffer = res; return B_OK; } case B_SCSI_INQUIRY: - return inquiry(handle->device, (scsi_inquiry *)buf); + return inquiry(handle->device, (scsi_inquiry *)buffer); case B_SCSI_PREVENT_ALLOW: - return prevent_allow(handle->device, *(bool *)buf); + return prevent_allow(handle->device, *(bool *)buffer); case B_RAW_DEVICE_COMMAND: - return raw_command(handle->device, buf); + return raw_command(handle->device, buffer); default: SHOW_ERROR(4, "Unknown ioctl: %x", op);