儲存庫 vbox 的更動 62694
- 時間撮記:
- 2016-7-29 下午02:09:08 (8 年 以前)
- 位置:
- trunk/src/VBox/HostDrivers/Support/linux
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r62490 r62694 53 53 54 54 #include <linux/sched.h> 55 #ifdef CONFIG_DEVFS_FS 56 # include <linux/devfs_fs_kernel.h> 57 #endif 58 #ifdef CONFIG_VBOXDRV_AS_MISC 59 # include <linux/miscdevice.h> 60 #endif 55 #include <linux/miscdevice.h> 61 56 #ifdef VBOX_WITH_SUSPEND_NOTIFICATION 62 57 # include <linux/platform_device.h> … … 79 74 # endif 80 75 # endif 81 82 /* devfs defines */83 #if defined(CONFIG_DEVFS_FS) && !defined(CONFIG_VBOXDRV_AS_MISC)84 # ifdef VBOX_WITH_HARDENING85 # define VBOX_DEV_FMASK (S_IWUSR | S_IRUSR)86 # else87 # define VBOX_DEV_FMASK (S_IRUGO | S_IWUGO)88 # endif89 #endif /* CONFIG_DEV_FS && !CONFIG_VBOXDEV_AS_MISC */90 76 91 77 #ifdef CONFIG_X86_HIGH_ENTRY … … 142 128 */ 143 129 static SUPDRVDEVEXT g_DevExt; 144 145 #ifndef CONFIG_VBOXDRV_AS_MISC146 /** Module major number for vboxdrv. */147 #define DEVICE_MAJOR_SYS 234148 /** Saved major device number for vboxdrv. */149 static int g_iModuleMajorSys;150 /** Module major number for vboxdrvu. */151 #define DEVICE_MAJOR_USR 235152 /** Saved major device number for vboxdrvu. */153 static int g_iModuleMajorUsr;154 #endif /* !CONFIG_VBOXDRV_AS_MISC */155 130 156 131 /** Module parameter. … … 220 195 }; 221 196 222 #ifdef CONFIG_VBOXDRV_AS_MISC223 197 /** The miscdevice structure for vboxdrv. */ 224 198 static struct miscdevice gMiscDeviceSys = … … 241 215 # endif 242 216 }; 243 #endif244 217 245 218 … … 335 308 */ 336 309 printk(KERN_DEBUG "vboxdrv: Found %u processor cores\n", (unsigned)RTMpGetOnlineCount()); 337 #ifdef CONFIG_VBOXDRV_AS_MISC338 310 rc = misc_register(&gMiscDeviceSys); 339 311 if (rc) … … 349 321 return rc; 350 322 } 351 #else /* !CONFIG_VBOXDRV_AS_MISC */352 /*353 * Register character devices and save the returned major numbers.354 */355 /* /dev/vboxdrv */356 g_iModuleMajorSys = DEVICE_MAJOR_SYS;357 rc = register_chrdev((dev_t)g_iModuleMajorSys, DEVICE_NAME_SYS, &gFileOpsVBoxDrvSys);358 if (rc < 0)359 {360 Log(("register_chrdev() failed with rc=%#x for vboxdrv!\n", rc));361 return rc;362 }363 if (DEVICE_MAJOR_SYS != 0)364 g_iModuleMajorSys = DEVICE_MAJOR_SYS;365 else366 g_iModuleMajorSys = rc;367 368 /* /dev/vboxdrvu */369 /** @todo Use a minor number of this bugger (not sure if this code is used370 * though, so not bothering right now.) */371 g_iModuleMajorUsr = DEVICE_MAJOR_USR;372 rc = register_chrdev((dev_t)g_iModuleMajorUsr, DEVICE_NAME_USR, &gFileOpsVBoxDrvUsr);373 if (rc < 0)374 {375 Log(("register_chrdev() failed with rc=%#x for vboxdrv!\n", rc));376 return rc;377 }378 if (DEVICE_MAJOR_USR != 0)379 g_iModuleMajorUsr = DEVICE_MAJOR_USR;380 else381 g_iModuleMajorUsr = rc;382 rc = 0;383 384 # ifdef CONFIG_DEVFS_FS385 /*386 * Register a device entry387 */388 if ( devfs_mk_cdev(MKDEV(DEVICE_MAJOR_SYS, 0), S_IFCHR | VBOX_DEV_FMASK, DEVICE_NAME_SYS) != 0389 || devfs_mk_cdev(MKDEV(DEVICE_MAJOR_USR, 0), S_IFCHR | VBOX_DEV_FMASK, DEVICE_NAME_USR) != 0)390 {391 Log(("devfs_register failed!\n"));392 rc = -EINVAL;393 }394 # endif395 #endif /* !CONFIG_VBOXDRV_AS_MISC */396 323 if (!rc) 397 324 { … … 451 378 * Failed, cleanup and return the error code. 452 379 */ 453 #if defined(CONFIG_DEVFS_FS) && !defined(CONFIG_VBOXDRV_AS_MISC) 454 devfs_remove(DEVICE_NAME_SYS); 455 devfs_remove(DEVICE_NAME_USR); 456 #endif 457 } 458 #ifdef CONFIG_VBOXDRV_AS_MISC 380 } 459 381 misc_deregister(&gMiscDeviceSys); 460 382 misc_deregister(&gMiscDeviceUsr); 461 383 Log(("VBoxDrv::ModuleInit returning %#x (minor:%d & %d)\n", rc, gMiscDeviceSys.minor, gMiscDeviceUsr.minor)); 462 #else463 unregister_chrdev(g_iModuleMajorUsr, DEVICE_NAME_USR);464 unregister_chrdev(g_iModuleMajorSys, DEVICE_NAME_SYS);465 Log(("VBoxDrv::ModuleInit returning %#x (major:%d & %d)\n", rc, g_iModuleMajorSys, g_iModuleMajorUsr));466 #endif467 384 return rc; 468 385 } … … 485 402 * opened, at least we'll blindly assume that here. 486 403 */ 487 #ifdef CONFIG_VBOXDRV_AS_MISC488 404 misc_deregister(&gMiscDeviceUsr); 489 405 misc_deregister(&gMiscDeviceSys); 490 #else /* !CONFIG_VBOXDRV_AS_MISC */491 # ifdef CONFIG_DEVFS_FS492 /*493 * Unregister a device entry494 */495 devfs_remove(DEVICE_NAME_USR);496 devfs_remove(DEVICE_NAME_SYS);497 # endif /* devfs */498 unregister_chrdev(g_iModuleMajorUsr, DEVICE_NAME_USR);499 unregister_chrdev(g_iModuleMajorSys, DEVICE_NAME_SYS);500 #endif /* !CONFIG_VBOXDRV_AS_MISC */501 406 502 407 /* -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.mod.c
r62490 r62694 49 49 { 0, "init_module" }, 50 50 { 0, "struct_module" }, 51 { 0, "devfs_remove" },52 51 { 0, "strpbrk" }, 53 52 { 0, "__kmalloc" }, … … 64 63 { 0, "rwsem_wake" }, 65 64 { 0, "copy_to_user" }, 66 { 0, "devfs_mk_cdev" },67 65 { 0, "preempt_schedule" }, 68 66 { 0, "contig_page_data" }, … … 73 71 { 0, "do_munmap" }, 74 72 { 0, "get_user_pages" }, 75 { 0, "register_chrdev" },76 73 { 0, "vsnprintf" }, 77 74 { 0, "kfree" }, 78 75 { 0, "memcpy" }, 79 { 0, "unregister_chrdev" },80 76 { 0, "put_page" }, 81 77 { 0, "__up_wakeup" },
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器