儲存庫 vbox 的更動 11966
- 時間撮記:
- 2008-9-2 上午10:00:59 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r11927 r11966 201 201 LogRel((DEVICE_NAME ":failed to disable autounloading!\n")); 202 202 203 int rc = ddi_soft_state_init(&g_pVBoxDrvSolarisState, sizeof(vbox_devstate_t), 8); 204 if (!rc) 205 { 206 rc = mod_install(&g_VBoxDrvSolarisModLinkage); 207 if (!rc) 208 return 0; /* success */ 209 210 ddi_soft_state_fini(&g_pVBoxDrvSolarisState); 211 LogRel((DEVICE_NAME ":mod_install failed! rc=%d\n", rc)); 203 /* 204 * Initialize IPRT R0 driver, which internally calls OS-specific r0 init. 205 */ 206 int rc = RTR0Init(0); 207 if (RT_SUCCESS(rc)) 208 { 209 /* 210 * Initialize the device extension 211 */ 212 rc = supdrvInitDevExt(&g_DevExt); 213 if (RT_SUCCESS(rc)) 214 { 215 /* 216 * Initialize the session hash table. 217 */ 218 memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); 219 rc = RTSpinlockCreate(&g_Spinlock); 220 if (RT_SUCCESS(rc)) 221 { 222 int rc = ddi_soft_state_init(&g_pVBoxDrvSolarisState, sizeof(vbox_devstate_t), 8); 223 if (!rc) 224 { 225 rc = mod_install(&g_VBoxDrvSolarisModLinkage); 226 if (!rc) 227 return 0; /* success */ 228 229 ddi_soft_state_fini(&g_pVBoxDrvSolarisState); 230 LogRel((DEVICE_NAME ":mod_install failed! rc=%d\n", rc)); 231 } 232 else 233 LogRel((DEVICE_NAME ":failed to initialize soft state.\n")); 234 235 RTSpinlockDestroy(g_Spinlock); 236 g_Spinlock = NIL_RTSPINLOCK; 237 } 238 else 239 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: RTSpinlockCreate failed\n")); 240 supdrvDeleteDevExt(&g_DevExt); 241 } 242 else 243 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: supdrvInitDevExt failed\n")); 244 RTR0Term(); 212 245 } 213 246 else 214 LogRel((DEVICE_NAME ":failed to initialize soft state.\n")); 215 216 return rc; 247 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: failed to init R0Drv\n")); 248 memset(&g_DevExt, 0, sizeof(g_DevExt)); 249 250 return -1; 217 251 } 218 252 … … 222 256 LogFlow((DEVICE_NAME ":_fini\n")); 223 257 224 int e = mod_remove(&g_VBoxDrvSolarisModLinkage); 225 if (e != 0) 226 return e; 258 /* 259 * Undo the work we did at start (in the reverse order). 260 */ 261 int rc = mod_remove(&g_VBoxDrvSolarisModLinkage); 262 if (rc != 0) 263 return rc; 264 265 supdrvDeleteDevExt(&g_DevExt); 266 267 rc = RTSpinlockDestroy(g_Spinlock); 268 AssertRC(rc); 269 g_Spinlock = NIL_RTSPINLOCK; 270 271 RTR0Term(); 272 273 memset(&g_DevExt, 0, sizeof(g_DevExt)); 227 274 228 275 ddi_soft_state_fini(&g_pVBoxDrvSolarisState); 229 return e;276 return 0; 230 277 } 231 278 … … 270 317 271 318 /* 272 * Initialize IPRT R0 driver, which internally calls OS-specific r0 init.319 * Register ourselves as a character device, pseudo-driver 273 320 */ 274 rc = RTR0Init(0); 275 if (RT_SUCCESS(rc)) 321 #ifdef VBOX_WITH_HARDENING 322 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 323 0, "all", "all", 0600); 324 #else 325 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 326 0, "none", "none", 0666); 327 #endif 328 if (rc == DDI_SUCCESS) 276 329 { 277 /* 278 * Initialize the device extension 279 */ 280 rc = supdrvInitDevExt(&g_DevExt); 281 if (RT_SUCCESS(rc)) 282 { 283 /* 284 * Initialize the session hash table. 285 */ 286 memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); 287 rc = RTSpinlockCreate(&g_Spinlock); 288 if (RT_SUCCESS(rc)) 289 { 290 /* 291 * Register ourselves as a character device, pseudo-driver 292 */ 293 #ifdef VBOX_WITH_HARDENING 294 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 295 0, "all", "all", 0600); 296 #else 297 rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 298 0, "none", "none", 0666); 330 #ifdef USE_SESSION_HASH 331 pState->pDip = pDip; 299 332 #endif 300 if (rc == DDI_SUCCESS) 301 { 302 #ifdef USE_SESSION_HASH 303 pState->pDip = pDip; 304 #endif 305 ddi_report_dev(pDip); 306 return DDI_SUCCESS; 307 } 308 309 /* Is this really necessary? */ 310 ddi_remove_minor_node(pDip, NULL); 311 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: ddi_create_priv_minor_node failed.\n")); 312 313 RTSpinlockDestroy(g_Spinlock); 314 g_Spinlock = NIL_RTSPINLOCK; 315 } 316 else 317 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: RTSpinlockCreate failed\n")); 318 supdrvDeleteDevExt(&g_DevExt); 319 } 320 else 321 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: supdrvInitDevExt failed\n")); 322 RTR0Term(); 333 ddi_report_dev(pDip); 334 return DDI_SUCCESS; 323 335 } 324 else 325 LogRel((DEVICE_NAME ":VBoxDrvSolarisAttach: failed to init R0Drv\n")); 326 memset(&g_DevExt, 0, sizeof(g_DevExt)); 327 break; 336 337 return DDI_FAILURE; 328 338 } 329 339 … … 371 381 ddi_soft_state_free(g_pVBoxDrvSolarisState, instance); 372 382 #endif 373 374 supdrvDeleteDevExt(&g_DevExt);375 376 rc = RTSpinlockDestroy(g_Spinlock);377 AssertRC(rc);378 g_Spinlock = NIL_RTSPINLOCK;379 380 RTR0Term();381 382 memset(&g_DevExt, 0, sizeof(g_DevExt));383 383 return DDI_SUCCESS; 384 384 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器