Changeset 10031 in vbox for trunk/src/VBox
- Timestamp:
- Jun 30, 2008 5:00:39 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r9694 r10031 82 82 /** The SUPR0 object id. */ 83 83 void *pvObj; 84 } INTNETIF, *PINTNETIF; 84 } INTNETIF; 85 typedef INTNETIF *PINTNETIF; 85 86 86 87 … … 108 109 /** The network name. */ 109 110 char szName[INTNET_MAX_NETWORK_NAME]; 110 } INTNETNETWORK, *PINTNETNETWORK; 111 } INTNETNETWORK; 112 typedef INTNETNETWORK *PINTNETNETWORK; 111 113 112 114 … … 117 119 { 118 120 /** Pointer to the object we're a handle for. */ 119 PINTNETIF pIF;121 PINTNETIF pIF; 120 122 /** Index to the next free entry. */ 121 uintptr_t iNext; 122 } INTNETHTE, *PINTNETHTE; 123 uintptr_t iNext; 124 } INTNETHTE; 125 typedef INTNETHTE *PINTNETHTE; 123 126 124 127 … … 129 132 { 130 133 /** Pointer to the handle table. */ 131 PINTNETHTE paEntries;134 PINTNETHTE paEntries; 132 135 /** The number of allocated handles. */ 133 uint32_t cAllocated;136 uint32_t cAllocated; 134 137 /** The index of the first free handle entry. 135 * ~0Umeans empty list. */136 uint32_t volatile iHead;138 * UINT32_MAX means empty list. */ 139 uint32_t volatile iHead; 137 140 /** The index of the last free handle entry. 138 * ~0U means empty list. */ 139 uint32_t volatile iTail; 140 } INTNETHT, *PINTNETHT; 141 * UINT32_MAX means empty list. */ 142 uint32_t volatile iTail; 143 } INTNETHT; 144 typedef INTNETHT *PINTNETHT; 141 145 142 146 … … 181 185 if ( i < pHT->cAllocated 182 186 && pHT->paEntries[i].iNext >= INTNET_HANDLE_MAX 183 && pHT->paEntries[i].iNext != ~0U)187 && pHT->paEntries[i].iNext != UINT32_MAX) 184 188 pIF = pHT->paEntries[i].pIF; 185 189 … … 214 218 */ 215 219 uint32_t i = pHT->iHead; 216 if (i != ~0U)220 if (i != UINT32_MAX) 217 221 { 218 222 pHT->iHead = pHT->paEntries[i].iNext; 219 if (pHT->iHead == ~0U)220 pHT->iTail = ~0U;223 if (pHT->iHead == UINT32_MAX) 224 pHT->iTail = UINT32_MAX; 221 225 222 226 pHT->paEntries[i].pIF = pIF; … … 253 257 i = pHT->cAllocated; 254 258 uint32_t iTail = pHT->iTail; 255 if (iTail == ~0U)259 if (iTail == UINT32_MAX) 256 260 pHT->iHead = iTail = i++; 257 261 while (i < cNew) … … 260 264 iTail = i++; 261 265 } 262 paNew[iTail].iNext = ~0U;266 paNew[iTail].iNext = UINT32_MAX; 263 267 pHT->iTail = iTail; 264 268 … … 297 301 * Insert at the end of the free list. 298 302 */ 299 pHT->paEntries[i].iNext = ~0U;303 pHT->paEntries[i].iNext = UINT32_MAX; 300 304 const uint32_t iTail = pHT->iTail; 301 if (iTail != ~0U)305 if (iTail != UINT32_MAX) 302 306 pHT->paEntries[iTail].iNext = i; 303 307 else … … 446 450 PDMMAC MacDst; 447 451 PDMMAC MacSrc; 448 } INTNETETHERHDR , *PINTNETETHERHDR;452 } INTNETETHERHDR; 449 453 #pragma pack() 454 typedef INTNETETHERHDR *PINTNETETHERHDR; 450 455 451 456 … … 1558 1563 //pIntNet->IfHandles.paEntries = NULL; 1559 1564 //pIntNet->IfHandles.cAllocated = 0; 1560 pIntNet->IfHandles.iHead = ~0U;1561 pIntNet->IfHandles.iTail = ~0U;1565 pIntNet->IfHandles.iHead = UINT32_MAX; 1566 pIntNet->IfHandles.iTail = UINT32_MAX; 1562 1567 1563 1568 rc = RTSemFastMutexCreate(&pIntNet->FastMutex);
Note:
See TracChangeset
for help on using the changeset viewer.