Changeset 22277 in vbox for trunk/src/VBox/Devices/Serial
- Timestamp:
- Aug 16, 2009 9:12:50 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 51119
- Location:
- trunk/src/VBox/Devices/Serial
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvChar.cpp
r19624 r22277 288 288 /** 289 289 * Construct a char driver instance. 290 * 291 * @returns VBox status. 292 * @param pDrvIns The driver instance data. 293 * If the registration structure is needed, 294 * pDrvIns->pDrvReg points to it. 295 * @param pCfgHandle Configuration node handle for the driver. Use this to 296 * obtain the configuration of the driver instance. It's 297 * also found in pDrvIns->pCfgHandle as it's expected to 298 * be used frequently in this function. 299 */ 300 static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle) 290 * 291 * @copydoc FNPDMDRVCONSTRUCT 292 */ 293 static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags) 301 294 { 302 295 PDRVCHAR pThis = PDMINS_2_DATA(pDrvIns, PDRVCHAR); … … 326 319 */ 327 320 PPDMIBASE pBase; 328 int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);321 int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBase); 329 322 if (RT_FAILURE(rc)) 330 323 return rc; /* Don't call PDMDrvHlpVMSetError here as we assume that the driver already set an appropriate error */ … … 428 421 /* pfnResume */ 429 422 NULL, 423 /* pfnAttach */ 424 NULL, 430 425 /* pfnDetach */ 431 NULL, 432 /** pfnPowerOff */ 433 NULL 426 NULL, 427 /* pfnPowerOff */ 428 NULL, 429 /* pfnSoftReset */ 430 NULL, 431 /* u32EndVersion */ 432 PDM_DRVREG_VERSION 434 433 }; 435 434 -
trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp
r22072 r22277 1178 1178 /** 1179 1179 * Construct a char driver instance. 1180 * 1181 * @returns VBox status. 1182 * @param pDrvIns The driver instance data. 1183 * If the registration structure is needed, 1184 * pDrvIns->pDrvReg points to it. 1185 * @param pCfgHandle Configuration node handle for the driver. Use this to 1186 * obtain the configuration of the driver instance. It's 1187 * also found in pDrvIns->pCfgHandle as it's expected to 1188 * be used frequently in this function. 1180 * 1181 * @copydoc FNPDMDRVCONSTRUCT 1189 1182 */ 1190 static DECLCALLBACK(int) drvHostSerialConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle )1183 static DECLCALLBACK(int) drvHostSerialConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags) 1191 1184 { 1192 1185 PDRVHOSTSERIAL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL); … … 1465 1458 /* pfnResume */ 1466 1459 NULL, 1460 /* pfnAttach */ 1461 NULL, 1467 1462 /* pfnDetach */ 1463 NULL, 1464 /* pfnPowerOff */ 1465 NULL, 1466 /* pfnSoftReset */ 1468 1467 NULL, 1469 /* * pfnPowerOff*/1470 NULL1468 /* u32EndVersion */ 1469 PDM_DRVREG_VERSION 1471 1470 }; 1472 1471 -
trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
r18443 r22277 396 396 * Construct a named pipe stream driver instance. 397 397 * 398 * @returns VBox status. 399 * @param pDrvIns The driver instance data. 400 * If the registration structure is needed, pDrvIns->pDrvReg points to it. 401 * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration 402 * of the driver instance. It's also found in pDrvIns->pCfgHandle, but like 403 * iInstance it's expected to be used a bit in this function. 404 */ 405 static DECLCALLBACK(int) drvNamedPipeConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle) 398 * @copydoc FNPDMDRVCONSTRUCT 399 */ 400 static DECLCALLBACK(int) drvNamedPipeConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags) 406 401 { 407 402 int rc; … … 646 641 /* pfnResume */ 647 642 NULL, 643 /* pfnAttach */ 644 NULL, 648 645 /* pfnDetach */ 649 646 NULL, 650 647 /* pfnPowerOff */ 651 648 drvNamedPipePowerOff, 649 /* pfnSoftReset */ 650 NULL, 651 /* u32EndVersion */ 652 PDM_DRVREG_VERSION 652 653 }; 654 -
trunk/src/VBox/Devices/Serial/DrvRawFile.cpp
r19626 r22277 1 /** @file 2 * 3 * VBox stream devices: 4 * Raw file output 1 /* $Id$ */ 2 /** @file 3 * VBox stream drivers - Raw file output. 5 4 */ 6 5 … … 25 24 * Header Files * 26 25 *******************************************************************************/ 27 #define LOG_GROUP LOG_GROUP_D RV_NAMEDPIPE26 #define LOG_GROUP LOG_GROUP_DEFAULT 28 27 #include <VBox/pdmdrv.h> 29 28 #include <iprt/assert.h> … … 60 59 PPDMDRVINS pDrvIns; 61 60 /** Pointer to the file name. (Freed by MM) */ 62 char 61 char *pszLocation; 63 62 /** Flag whether VirtualBox represents the server or client side. */ 64 63 RTFILE OutputFile; … … 121 120 * Construct a raw output stream driver instance. 122 121 * 123 * @returns VBox status. 124 * @param pDrvIns The driver instance data. 125 * If the registration structure is needed, pDrvIns->pDrvReg points to it. 126 * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration 127 * of the driver instance. It's also found in pDrvIns->pCfgHandle, but like 128 * iInstance it's expected to be used a bit in this function. 129 */ 130 static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle) 131 { 132 int rc; 133 char *pszLocation = NULL; 122 * @copydoc FNPDMDRVCONSTRUCT 123 */ 124 static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags) 125 { 134 126 PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE); 135 127 … … 149 141 */ 150 142 if (!CFGMR3AreValuesValid(pCfgHandle, "Location\0")) 151 { 152 rc = VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 153 goto out; 154 } 155 156 rc = CFGMR3QueryStringAlloc(pCfgHandle, "Location", &pszLocation); 143 AssertFailedReturn(VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES); 144 145 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Location", &pThis->pszLocation); 146 if (RT_FAILURE(rc)) 147 AssertMsgFailedReturn(("Configuration error: query \"Location\" resulted in %Rrc.\n", rc), rc); 148 149 /* 150 * Open the raw file. 151 */ 152 rc = RTFileOpen(&pThis->OutputFile, pThis->pszLocation, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 157 153 if (RT_FAILURE(rc)) 158 154 { 159 AssertMsgFailed(("Configuration error: query \"Location\" resulted in %Rrc.\n", rc)); 160 goto out; 161 } 162 pThis->pszLocation = pszLocation; 163 164 rc = RTFileOpen(&pThis->OutputFile, pThis->pszLocation, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE); 165 if (RT_FAILURE(rc)) 166 { 167 LogRel(("RawFile%d: CreateFile failed rc=%Rrc\n", pThis->pDrvIns->iInstance)); 168 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to create the raw output file %s"), pDrvIns->iInstance, pszLocation); 169 } 170 171 out: 172 if (RT_FAILURE(rc)) 173 { 174 if (pszLocation) 175 MMR3HeapFree(pszLocation); 176 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to initialize"), pDrvIns->iInstance); 177 } 178 179 LogFlow(("drvRawFileConstruct: location %s\n", pszLocation)); 180 LogRel(("RawFile: location %s\n", pszLocation)); 155 LogRel(("RawFile%d: CreateFile failed rc=%Rrc\n", pDrvIns->iInstance)); 156 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to create the raw output file %s"), pDrvIns->iInstance, pThis->pszLocation); 157 } 158 159 LogFlow(("drvRawFileConstruct: location %s\n", pThis->pszLocation)); 160 LogRel(("RawFile#%u: location %s\n", pDrvIns->iInstance, pThis->pszLocation)); 181 161 return VINF_SUCCESS; 182 162 } … … 198 178 if (pThis->pszLocation) 199 179 MMR3HeapFree(pThis->pszLocation); 180 181 if (pThis->OutputFile != NIL_RTFILE) 182 { 183 RTFileClose(pThis->OutputFile); 184 pThis->OutputFile = NIL_RTFILE; 185 } 200 186 } 201 187 … … 214 200 215 201 if (pThis->OutputFile != NIL_RTFILE) 202 { 216 203 RTFileClose(pThis->OutputFile); 204 pThis->OutputFile = NIL_RTFILE; 205 } 217 206 } 218 207 … … 251 240 /* pfnResume */ 252 241 NULL, 242 /* pfnAttach */ 243 NULL, 253 244 /* pfnDetach */ 254 245 NULL, 255 246 /* pfnPowerOff */ 256 247 drvRawFilePowerOff, 248 /* pfnSoftReset */ 249 NULL, 250 /* u32EndVersion */ 251 PDM_DRVREG_VERSION 257 252 }; 253
Note:
See TracChangeset
for help on using the changeset viewer.