Changeset 206 in vbox
- Timestamp:
- Jan 21, 2007 10:31:42 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 17690
- Location:
- trunk/src/VBox/HostDrivers/Support/darwin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.c
r1 r206 1 1 /** @file 2 *3 2 * VBox host drivers - Ring-0 support drivers - Darwin host: 4 3 * Darwin driver C code … … 25 24 * Header Files * 26 25 *******************************************************************************/ 27 /* deal with conflicts first, we ignore any Darwin variants of ALIGN, MAX, MIN, and PVM. */ 26 /* Deal with conflicts first. 27 * (This is mess inherited from BSD. The *BSDs has clean this up long ago.) */ 28 28 #include <sys/param.h> 29 #undef ALIGN30 #undef MAX31 #undef MIN32 29 #undef PVM 33 30 34 31 #include "SUPDRV.h" 35 32 #include <iprt/types.h> 33 #include <iprt/initterm.h> 36 34 #include <iprt/assert.h> 37 35 #include <iprt/spinlock.h> … … 126 124 127 125 /* 128 * Initialize the device extension.129 */ 130 rc = supdrvInitDevExt(&g_DevExt);126 * Initialize IPRT. 127 */ 128 rc = RTR0Init(0); 131 129 if (RT_SUCCESS(rc)) 132 130 { 133 131 /* 134 * Initialize the session hash table.132 * Initialize the device extension. 135 133 */ 136 memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); /* paranoia */ 137 rc = RTSpinlockCreate(&g_Spinlock); 134 rc = supdrvInitDevExt(&g_DevExt); 138 135 if (RT_SUCCESS(rc)) 139 136 { 140 137 /* 141 * Registering ourselves as a character device.138 * Initialize the session hash table. 142 139 */ 143 g_iMajorDeviceNo = cdevsw_add(-1, &g_DevCW); 144 if (g_iMajorDeviceNo >= 0) 140 memset(g_apSessionHashTab, 0, sizeof(g_apSessionHashTab)); /* paranoia */ 141 rc = RTSpinlockCreate(&g_Spinlock); 142 if (RT_SUCCESS(rc)) 145 143 { 146 g_hDevFsDevice = devfs_make_node(makedev(g_iMajorDeviceNo, 0), DEVFS_CHAR, 147 UID_ROOT, GID_WHEEL, 0660, DEVICE_NAME); /** @todo the UID and GID should be configurable! */ 148 if (g_hDevFsDevice) 144 /* 145 * Registering ourselves as a character device. 146 */ 147 g_iMajorDeviceNo = cdevsw_add(-1, &g_DevCW); 148 if (g_iMajorDeviceNo >= 0) 149 149 { 150 OSDBGPRINT(("VBoxDrv: Successfully started. (major=%d)\n", g_iMajorDeviceNo)); 151 return KMOD_RETURN_SUCCESS; 150 g_hDevFsDevice = devfs_make_node(makedev(g_iMajorDeviceNo, 0), DEVFS_CHAR, 151 UID_ROOT, GID_WHEEL, 0660, DEVICE_NAME); /** @todo the UID and GID should be configurable! */ 152 if (g_hDevFsDevice) 153 { 154 OSDBGPRINT(("VBoxDrv: Successfully started. (major=%d)\n", g_iMajorDeviceNo)); 155 return KMOD_RETURN_SUCCESS; 156 } 157 158 OSDBGPRINT(("VBoxDrv: devfs_make_node(makedev(%d,0),,,,%s) failed\n", 159 g_iMajorDeviceNo, DEVICE_NAME)); 160 cdevsw_remove(g_iMajorDeviceNo, &g_DevCW); 161 g_iMajorDeviceNo = -1; 152 162 } 153 OSDBGPRINT(("VBoxDrv: devfs_make_node(makedev(%d,0),,,,%s) failed\n",154 g_iMajorDeviceNo, DEVICE_NAME));155 cdevsw_remove(g_iMajorDeviceNo, &g_DevCW);156 g_ iMajorDeviceNo = -1;163 else 164 OSDBGPRINT(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo)); 165 RTSpinlockDestroy(g_Spinlock); 166 g_Spinlock = NIL_RTSPINLOCK; 157 167 } 158 168 else 159 OSDBGPRINT(("VBoxDrv: cdevsw_add failed (%d)\n", g_iMajorDeviceNo)); 160 RTSpinlockDestroy(g_Spinlock); 161 g_Spinlock = NIL_RTSPINLOCK; 169 OSDBGPRINT(("VBoxDrv: RTSpinlockCreate failed (rc=%d)\n", rc)); 170 supdrvDeleteDevExt(&g_DevExt); 162 171 } 163 172 else 164 OSDBGPRINT(("VBoxDrv: RTSpinlockCreate failed(rc=%d)\n", rc));165 supdrvDeleteDevExt(&g_DevExt);173 OSDBGPRINT(("VBoxDrv: failed to initialize device extension (rc=%d)\n", rc)); 174 RTR0Term(); 166 175 } 167 176 else 168 OSDBGPRINT(("VBoxDrv: failed to initialize device extension(rc=%d)\n", rc));177 OSDBGPRINT(("VBoxDrv: failed to initialize IPRT (rc=%d)\n", rc)); 169 178 170 179 memset(&g_DevExt, 0, sizeof(g_DevExt)); … … 200 209 AssertRC(rc); 201 210 g_Spinlock = NIL_RTSPINLOCK; 211 212 RTR0Term(); 202 213 203 214 memset(&g_DevExt, 0, sizeof(g_DevExt)); … … 518 529 519 530 520 /** Runtime assert implementation for LinuxRing-0. */531 /** Runtime assert implementation for Darwin Ring-0. */ 521 532 RTDECL(void) AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) 522 533 { -
trunk/src/VBox/HostDrivers/Support/darwin/load.sh
r195 r206 12 12 fi 13 13 14 trap "sudo chown -R `whoami` $DIR; exit 1" INT 15 set -x 14 16 sudo chown -R root:wheel "$DIR" 15 17 sudo chmod -R o-rwx "$DIR" 16 sudo kextload -t -v 6 "$DIR" 18 sync ; sleep 1; sync 19 sudo kextload -t "$DIR" 17 20 sudo chown -R `whoami` "$DIR" 18 21 22 23
Note:
See TracChangeset
for help on using the changeset viewer.