- Timestamp:
- May 12, 2009 2:00:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvRawFile.cpp
r19624 r19626 41 41 *******************************************************************************/ 42 42 43 /** Converts a pointer to DRV OUTPUTFILE::IMedia to a PDRVOUTPUTFILE. */44 #define PDMISTREAM_2_DRV OUTPUTFILE(pInterface) ( (PDRVOUTPUTFILE)((uintptr_t)pInterface - RT_OFFSETOF(DRVOUTPUTFILE, IStream)) )43 /** Converts a pointer to DRVRAWFILE::IMedia to a PDRVRAWFILE. */ 44 #define PDMISTREAM_2_DRVRAWFILE(pInterface) ( (PDRVRAWFILE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWFILE, IStream)) ) 45 45 46 46 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */ … … 53 53 * Raw file output driver instance data. 54 54 */ 55 typedef struct DRV OUTPUTFILE55 typedef struct DRVRAWFILE 56 56 { 57 57 /** The stream interface. */ … … 63 63 /** Flag whether VirtualBox represents the server or client side. */ 64 64 RTFILE OutputFile; 65 /** Flag to signal listening thread to shut down. */ 66 bool fShutdown; 67 } DRVOUTPUTFILE, *PDRVOUTPUTFILE; 65 } DRVRAWFILE, *PDRVRAWFILE; 68 66 69 67 … … 74 72 75 73 /** @copydoc PDMISTREAM::pfnWrite */ 76 static DECLCALLBACK(int) drv OutputFileWrite(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite)74 static DECLCALLBACK(int) drvRawFileWrite(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite) 77 75 { 78 76 int rc = VINF_SUCCESS; 79 PDRV OUTPUTFILE pThis = PDMISTREAM_2_DRVOUTPUTFILE(pInterface);77 PDRVRAWFILE pThis = PDMISTREAM_2_DRVRAWFILE(pInterface); 80 78 LogFlow(("%s: pvBuf=%p *pcbWrite=%#x (%s)\n", __FUNCTION__, pvBuf, *pcbWrite, pThis->pszLocation)); 81 79 … … 104 102 * @thread Any thread. 105 103 */ 106 static DECLCALLBACK(void *) drv OutputFileQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)104 static DECLCALLBACK(void *) drvRawFileQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 107 105 { 108 106 PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface); 109 PDRV OUTPUTFILE pDrv = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);107 PDRVRAWFILE pDrv = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE); 110 108 switch (enmInterface) 111 109 { … … 130 128 * iInstance it's expected to be used a bit in this function. 131 129 */ 132 static DECLCALLBACK(int) drv OutputFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)130 static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle) 133 131 { 134 132 int rc; 135 133 char *pszLocation = NULL; 136 PDRV OUTPUTFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);134 PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE); 137 135 138 136 /* … … 142 140 pThis->pszLocation = NULL; 143 141 pThis->OutputFile = NIL_RTFILE; 144 pThis->fShutdown = false;145 142 /* IBase */ 146 pDrvIns->IBase.pfnQueryInterface = drv OutputFileQueryInterface;143 pDrvIns->IBase.pfnQueryInterface = drvRawFileQueryInterface; 147 144 /* IStream */ 148 pThis->IStream.pfnWrite = drv OutputFileWrite;145 pThis->IStream.pfnWrite = drvRawFileWrite; 149 146 150 147 /* … … 180 177 } 181 178 182 LogFlow(("drv OutputFileConstruct: location %s\n", pszLocation));179 LogFlow(("drvRawFileConstruct: location %s\n", pszLocation)); 183 180 LogRel(("RawFile: location %s\n", pszLocation)); 184 181 return VINF_SUCCESS; … … 194 191 * @param pDrvIns The driver instance data. 195 192 */ 196 static DECLCALLBACK(void) drv OutputFileDestruct(PPDMDRVINS pDrvIns)197 { 198 PDRV OUTPUTFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);193 static DECLCALLBACK(void) drvRawFileDestruct(PPDMDRVINS pDrvIns) 194 { 195 PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE); 199 196 LogFlow(("%s: %s\n", __FUNCTION__, pThis->pszLocation)); 200 197 … … 211 208 * @param pDrvIns The driver instance data. 212 209 */ 213 static DECLCALLBACK(void) drv OutputFilePowerOff(PPDMDRVINS pDrvIns)214 { 215 PDRV OUTPUTFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);210 static DECLCALLBACK(void) drvRawFilePowerOff(PPDMDRVINS pDrvIns) 211 { 212 PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE); 216 213 LogFlow(("%s: %s\n", __FUNCTION__, pThis->pszLocation)); 217 218 pThis->fShutdown = true;219 214 220 215 if (pThis->OutputFile != NIL_RTFILE) … … 241 236 ~0, 242 237 /* cbInstance */ 243 sizeof(DRV OUTPUTFILE),238 sizeof(DRVRAWFILE), 244 239 /* pfnConstruct */ 245 drv OutputFileConstruct,240 drvRawFileConstruct, 246 241 /* pfnDestruct */ 247 drv OutputFileDestruct,242 drvRawFileDestruct, 248 243 /* pfnIOCtl */ 249 244 NULL, … … 259 254 NULL, 260 255 /* pfnPowerOff */ 261 drv OutputFilePowerOff,256 drvRawFilePowerOff, 262 257 };
Note:
See TracChangeset
for help on using the changeset viewer.