Changeset 15855 in vbox for trunk/src/VBox
- Timestamp:
- Jan 8, 2009 11:09:10 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r15847 r15855 282 282 283 283 /** The serial numnber to use for IDENTIFY DEVICE commands. */ 284 char achSerialNumber[ATA_SERIAL_NUMBER_LENGTH+1];284 char szSerialNumber[ATA_SERIAL_NUMBER_LENGTH+1]; 285 285 /** The firmware revision to use for IDENTIFY DEVICE commands. */ 286 char achFirmwareRevision[ATA_FIRMWARE_REVISION_LENGTH+1];286 char szFirmwareRevision[ATA_FIRMWARE_REVISION_LENGTH+1]; 287 287 /** The model number to use for IDENTIFY DEVICE commands. */ 288 char achModelNumber[ATA_MODEL_NUMBER_LENGTH+1];288 char szModelNumber[ATA_MODEL_NUMBER_LENGTH+1]; 289 289 290 290 #if HC_ARCH_BITS == 64 … … 1113 1113 p[5] = RT_H2LE_U16(512); 1114 1114 p[6] = RT_H2LE_U16(s->PCHSGeometry.cSectors); 1115 ataPadString((uint8_t *)(p + 10), s-> achSerialNumber, ATA_SERIAL_NUMBER_LENGTH); /* serial number */1115 ataPadString((uint8_t *)(p + 10), s->szSerialNumber, ATA_SERIAL_NUMBER_LENGTH); /* serial number */ 1116 1116 p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ 1117 1117 p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ 1118 1118 p[22] = RT_H2LE_U16(0); /* ECC bytes per sector */ 1119 ataPadString((uint8_t *)(p + 23), s-> achFirmwareRevision, ATA_FIRMWARE_REVISION_LENGTH); /* firmware version */1120 ataPadString((uint8_t *)(p + 27), s-> achModelNumber, ATA_MODEL_NUMBER_LENGTH); /* model */1119 ataPadString((uint8_t *)(p + 23), s->szFirmwareRevision, ATA_FIRMWARE_REVISION_LENGTH); /* firmware version */ 1120 ataPadString((uint8_t *)(p + 27), s->szModelNumber, ATA_MODEL_NUMBER_LENGTH); /* model */ 1121 1121 #if ATA_MAX_MULT_SECTORS > 1 1122 1122 p[47] = RT_H2LE_U16(0x8000 | ATA_MAX_MULT_SECTORS); … … 1219 1219 /* Removable CDROM, 50us response, 12 byte packets */ 1220 1220 p[0] = RT_H2LE_U16(2 << 14 | 5 << 8 | 1 << 7 | 2 << 5 | 0 << 0); 1221 ataPadString((uint8_t *)(p + 10), s-> achSerialNumber, ATA_SERIAL_NUMBER_LENGTH); /* serial number */1221 ataPadString((uint8_t *)(p + 10), s->szSerialNumber, ATA_SERIAL_NUMBER_LENGTH); /* serial number */ 1222 1222 p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ 1223 1223 p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ 1224 ataPadString((uint8_t *)(p + 23), s-> achFirmwareRevision, ATA_FIRMWARE_REVISION_LENGTH); /* firmware version */1225 ataPadString((uint8_t *)(p + 27), s-> achModelNumber, ATA_MODEL_NUMBER_LENGTH); /* model */1224 ataPadString((uint8_t *)(p + 23), s->szFirmwareRevision, ATA_FIRMWARE_REVISION_LENGTH); /* firmware version */ 1225 ataPadString((uint8_t *)(p + 27), s->szModelNumber, ATA_MODEL_NUMBER_LENGTH); /* model */ 1226 1226 p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */ 1227 1227 p[50] = RT_H2LE_U16(1 << 14); /* No drive specific standby timer minimum */ … … 4303 4303 { 4304 4304 rc = RTSemEventWait(pCtl->SuspendIOSem, RT_INDEFINITE_WAIT); 4305 /* Continue if we got a signal by RTThreadPoke(). 4305 /* Continue if we got a signal by RTThreadPoke(). 4306 4306 * We will get notified if there is a request to process. 4307 4307 */ … … 4320 4320 rc = RTSemEventWait(pCtl->AsyncIOSem, RT_INDEFINITE_WAIT); 4321 4321 LogBird(("ata: %x: waking up\n", pCtl->IOPortBase1)); 4322 /* Continue if we got a signal by RTThreadPoke(). 4322 /* Continue if we got a signal by RTThreadPoke(). 4323 4323 * We will get notified if there is a request to process. 4324 4324 */ … … 6352 6352 { "SecondaryMaster", "SecondarySlave" } 6353 6353 }; 6354 char aSerial[ATA_SERIAL_NUMBER_LENGTH+1]; 6354 6355 /* Generate a default serial number. */ 6356 char szSerial[ATA_SERIAL_NUMBER_LENGTH+1]; 6355 6357 RTUUID Uuid; 6356 6358 if (pIf->pDrvBlock) … … 6362 6364 { 6363 6365 /* Generate a predictable serial for drives which don't have a UUID. */ 6364 RTStrPrintf( aSerial, sizeof(aSerial), "VB%x-%04x%04x",6366 RTStrPrintf(szSerial, sizeof(szSerial), "VB%x-%04x%04x", 6365 6367 pIf->iLUN + pDevIns->iInstance * 32, 6366 6368 pThis->aCts[i].IOPortBase1, pThis->aCts[i].IOPortBase2); 6367 6369 } 6368 6370 else 6369 RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); 6370 strncpy(pIf->achSerialNumber, aSerial, sizeof(pIf->achSerialNumber)); 6371 strncpy(pIf->achFirmwareRevision, "1.0", sizeof(pIf->achSerialNumber)); 6372 if (pIf->fATAPI) 6373 strncpy(pIf->achModelNumber, "VBOX CD-ROM", sizeof(pIf->achModelNumber)); 6374 else 6375 strncpy(pIf->achModelNumber, "VBOX HARDDISK", sizeof(pIf->achModelNumber)); 6376 6377 /* Check if the user provided some values to overwrite. */ 6371 RTStrPrintf(szSerial, sizeof(szSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); 6372 6373 /* Get user config if present using defaults otherwise. */ 6378 6374 PCFGMNODE pCfgNode = CFGMR3GetChild(pCfgHandle, s_apszCFGMKeys[i][j]); 6379 if (pCfgNode) 6375 rc = CFGMR3QueryStringDef(pCfgNode, "SerialNumber", pIf->szSerialNumber, sizeof(pIf->szSerialNumber), 6376 szSerial); 6377 if (RT_FAILURE(rc)) 6380 6378 { 6381 rc = CFGMR3QueryString(pCfgNode, "SerialNumber", pIf->achSerialNumber, sizeof(pIf->achSerialNumber));6382 6379 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 6383 {6384 6380 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 6385 6381 N_("PIIX3 configuration error: \"SerialNumber\" is longer than 20 bytes")); 6386 } 6387 else if (RT_FAILURE(rc) && (rc != VERR_CFGM_VALUE_NOT_FOUND)) 6388 return PDMDEV_SET_ERROR(pDevIns, rc, 6389 N_("PIIX3 configuration error: failed to read \"SerialNumber\" as string")); 6390 6391 rc = CFGMR3QueryString(pCfgNode, "FirmwareRevision", pIf->achFirmwareRevision, sizeof(pIf->achFirmwareRevision)); 6382 return PDMDEV_SET_ERROR(pDevIns, rc, 6383 N_("PIIX3 configuration error: failed to read \"SerialNumber\" as string")); 6384 } 6385 6386 rc = CFGMR3QueryStringDef(pCfgNode, "FirmwareRevision", pIf->szFirmwareRevision, sizeof(pIf->szFirmwareRevision), 6387 "1.0"); 6388 if (RT_FAILURE(rc)) 6389 { 6392 6390 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 6393 {6394 6391 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 6395 6392 N_("PIIX3 configuration error: \"FirmwareRevision\" is longer than 8 bytes")); 6396 } 6397 else if (RT_FAILURE(rc) && (rc != VERR_CFGM_VALUE_NOT_FOUND)) 6398 return PDMDEV_SET_ERROR(pDevIns, rc, 6399 N_("PIIX3 configuration error: failed to read \"FirmwareRevision\" as string")); 6400 6401 rc = CFGMR3QueryString(pCfgNode, "ModelNumber", pIf->achModelNumber, sizeof(pIf->achModelNumber)); 6393 return PDMDEV_SET_ERROR(pDevIns, rc, 6394 N_("PIIX3 configuration error: failed to read \"FirmwareRevision\" as string")); 6395 } 6396 6397 rc = CFGMR3QueryStringDef(pCfgNode, "ModelNumber", pIf->szModelNumber, sizeof(pIf->szModelNumber), 6398 pIf->fATAPI ? "VBOX CD-ROM" : "VBOX HARDDISK"); 6399 if (RT_FAILURE(rc)) 6400 { 6402 6401 if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) 6403 {6404 6402 return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, 6405 6403 N_("PIIX3 configuration error: \"ModelNumber\" is longer than 40 bytes")); 6406 } 6407 else if (RT_FAILURE(rc) && (rc != VERR_CFGM_VALUE_NOT_FOUND)) 6408 return PDMDEV_SET_ERROR(pDevIns, rc, 6409 N_("PIIX3 configuration error: failed to read \"ModelNumber\" as string")); 6404 return PDMDEV_SET_ERROR(pDevIns, rc, 6405 N_("PIIX3 configuration error: failed to read \"ModelNumber\" as string")); 6410 6406 } 6411 6407 } -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp
r15846 r15855 698 698 GEN_CHECK_OFF(ATADevState, pControllerR0); 699 699 GEN_CHECK_OFF(ATADevState, pControllerRC); 700 GEN_CHECK_OFF(ATADevState, achSerialNumber);701 GEN_CHECK_OFF(ATADevState, achSerialNumber[ATA_SERIAL_NUMBER_LENGTH]);702 GEN_CHECK_OFF(ATADevState, achFirmwareRevision);703 GEN_CHECK_OFF(ATADevState, achFirmwareRevision[ATA_FIRMWARE_REVISION_LENGTH]);704 GEN_CHECK_OFF(ATADevState, achModelNumber);705 GEN_CHECK_OFF(ATADevState, achModelNumber[ATA_MODEL_NUMBER_LENGTH]);700 GEN_CHECK_OFF(ATADevState, szSerialNumber); 701 GEN_CHECK_OFF(ATADevState, szSerialNumber[ATA_SERIAL_NUMBER_LENGTH]); 702 GEN_CHECK_OFF(ATADevState, szFirmwareRevision); 703 GEN_CHECK_OFF(ATADevState, szFirmwareRevision[ATA_FIRMWARE_REVISION_LENGTH]); 704 GEN_CHECK_OFF(ATADevState, szModelNumber); 705 GEN_CHECK_OFF(ATADevState, szModelNumber[ATA_MODEL_NUMBER_LENGTH]); 706 706 GEN_CHECK_SIZE(ATATransferRequest); 707 707 GEN_CHECK_OFF(ATATransferRequest, iIf); … … 1143 1143 GEN_CHECK_OFF(AHCIPort, fNotificationSend); 1144 1144 GEN_CHECK_OFF(AHCIPort, fPortReset); 1145 GEN_CHECK_OFF(AHCIPort, achSerialNumber);1146 GEN_CHECK_OFF(AHCIPort, achSerialNumber[AHCI_SERIAL_NUMBER_LENGTH]); /* One additional byte for the termination.*/1147 GEN_CHECK_OFF(AHCIPort, achFirmwareRevision);1148 GEN_CHECK_OFF(AHCIPort, achFirmwareRevision[AHCI_FIRMWARE_REVISION_LENGTH]); /* One additional byte for the termination.*/1149 GEN_CHECK_OFF(AHCIPort, achModelNumber);1150 GEN_CHECK_OFF(AHCIPort, achModelNumber[AHCI_MODEL_NUMBER_LENGTH]); /* One additional byte for the termination.*/1145 GEN_CHECK_OFF(AHCIPort, szSerialNumber); 1146 GEN_CHECK_OFF(AHCIPort, szSerialNumber[AHCI_SERIAL_NUMBER_LENGTH]); /* One additional byte for the termination.*/ 1147 GEN_CHECK_OFF(AHCIPort, szFirmwareRevision); 1148 GEN_CHECK_OFF(AHCIPort, szFirmwareRevision[AHCI_FIRMWARE_REVISION_LENGTH]); /* One additional byte for the termination.*/ 1149 GEN_CHECK_OFF(AHCIPort, szModelNumber); 1150 GEN_CHECK_OFF(AHCIPort, szModelNumber[AHCI_MODEL_NUMBER_LENGTH]); /* One additional byte for the termination.*/ 1151 1151 1152 1152 GEN_CHECK_SIZE(AHCI);
Note:
See TracChangeset
for help on using the changeset viewer.