VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/VSCSI/VSCSISense.cpp@ 35753

Last change on this file since 35753 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/* $Id: VSCSISense.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 * Virtual SCSI driver: Sense handling
4 */
5
6/*
7 * Copyright (C) 2006-2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#define LOG_GROUP LOG_GROUP_VSCSI
18#include <VBox/log.h>
19#include <iprt/assert.h>
20#include <iprt/string.h>
21
22#include "VSCSIInternal.h"
23
24int vscsiReqSenseOkSet(PVSCSIREQINT pVScsiReq)
25{
26 if (pVScsiReq->cbSense < 14)
27 return SCSI_STATUS_OK;
28
29 AssertMsgReturn(pVScsiReq->pbSense, ("Sense buffer pointer is NULL\n"), SCSI_STATUS_OK);
30 memset(pVScsiReq->pbSense, 0, pVScsiReq->cbSense);
31
32 pVScsiReq->pbSense[0] = (1 << 7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED; /* Fixed format */
33 pVScsiReq->pbSense[2] = SCSI_SENSE_NONE;
34 pVScsiReq->pbSense[7] = 10;
35 pVScsiReq->pbSense[12] = SCSI_ASC_NONE;
36 pVScsiReq->pbSense[13] = SCSI_ASC_NONE; /* Should be ASCQ but it has the same value for success. */
37
38 return SCSI_STATUS_OK;
39}
40
41int vscsiReqSenseErrorSet(PVSCSIREQINT pVScsiReq, uint8_t uSCSISenseKey, uint8_t uSCSIASC)
42{
43 AssertMsgReturn(pVScsiReq->cbSense >= 18, ("Sense buffer is not big enough\n"), SCSI_STATUS_OK);
44 AssertMsgReturn(pVScsiReq->pbSense, ("Sense buffer pointer is NULL\n"), SCSI_STATUS_OK);
45 memset(pVScsiReq->pbSense, 0, pVScsiReq->cbSense);
46 pVScsiReq->pbSense[0] = (1 << 7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED; /* Fixed format */
47 pVScsiReq->pbSense[2] = uSCSISenseKey;
48 pVScsiReq->pbSense[7] = 10;
49 pVScsiReq->pbSense[12] = uSCSIASC;
50 pVScsiReq->pbSense[13] = 0x00; /** @todo: Provide more info. */
51 return SCSI_STATUS_CHECK_CONDITION;
52}
53
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette