Changeset 37568 in vbox
- Timestamp:
- Jun 21, 2011 9:14:08 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp
r37566 r37568 40 40 #include "../../include/internal/iprt.h" 41 41 42 #if 0//def IN_RING0 /* till RTFILE is changed in types.h */ 43 # include <iprt/types.h> 44 typedef struct RTFILENEWINT *RTFILENEW; 45 typedef RTFILENEW *PRTFILENEW; 46 # undef NIL_RTFILE 47 # define RTFILE RTFILENEW 48 # define PRTFILE PRTFILENEW 49 # define NIL_RTFILE ((RTFILENEW)-1) 50 #endif 42 51 #include <iprt/asm.h> 43 52 #include <iprt/assert.h> … … 162 171 #ifdef DEBUG 163 172 static bool g_fBreakpointOnError = true; 173 #endif 174 175 176 #if 0//def IN_RING0 177 178 RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint32_t fOpen) 179 { 180 vfs_context_t hVfsCtx = vfs_context_current(); 181 int fCMode = (fOpen & RTFILE_O_CREATE_MODE_MASK) 182 ? (fOpen & RTFILE_O_CREATE_MODE_MASK) >> RTFILE_O_CREATE_MODE_SHIFT 183 : RT_FILE_PERMISSION; 184 int fVnFlags = 0; /* VNODE_LOOKUP_XXX */ 185 186 int fOpenMode = 0; 187 if (fOpen & RTFILE_O_NON_BLOCK) 188 fOpenMode |= O_NONBLOCK; 189 if (fOpen & RTFILE_O_WRITE_THROUGH) 190 fOpenMode |= O_SYNC; 191 192 /* create/truncate file */ 193 switch (fOpen & RTFILE_O_ACTION_MASK) 194 { 195 case RTFILE_O_OPEN: break; 196 case RTFILE_O_OPEN_CREATE: fOpenMode |= O_CREAT; break; 197 case RTFILE_O_CREATE: fOpenMode |= O_CREAT | O_EXCL; break; 198 case RTFILE_O_CREATE_REPLACE: fOpenMode |= O_CREAT | O_TRUNC; break; /** @todo replacing needs fixing, this is *not* a 1:1 mapping! */ 199 } 200 if (fOpen & RTFILE_O_TRUNCATE) 201 fOpenMode |= O_TRUNC; 202 203 switch (fOpen & RTFILE_O_ACCESS_MASK) 204 { 205 case RTFILE_O_READ: 206 fOpenMode |= FREAD 207 break; 208 case RTFILE_O_WRITE: 209 fOpenMode |= fOpen & RTFILE_O_APPEND ? O_APPEND | FWRITE : FWRITE; 210 break; 211 case RTFILE_O_READWRITE: 212 fOpenMode |= fOpen & RTFILE_O_APPEND ? O_APPEND | FWRITE | FREAD : FWRITE | FREAD; 213 break; 214 default: 215 AssertMsgFailed(("RTFileOpen received an invalid RW value, fOpen=%#x\n", fOpen)); 216 return VERR_INVALID_PARAMETER; 217 } *phFile = (RTFILENEW)hVnode; 218 219 220 vnode_t hVnode = NULL; 221 errno_t rc = vnode_open(pszFilename, fOpenMode, fCMode, fVnFlags, &hVnode, hVfsCtx) 222 if (rc != 0) 223 return RTErrConvertFromErrno(rc); 224 225 vnode_put(hVnode); 226 *phFile = (RTFILENEW)hVnode; 227 return VINF_SUCCESS; 228 } 229 230 231 RTDECL(int) RTFileClose(RTFILE hFile) 232 { 233 if (hFile == NIL_RTFILE) 234 return VINF_SUCCESS; 235 vnode_t hVnode = (vnode_t)hFile; 236 errno_t rc = vnode_close(hVnode, vfs_context_current()); 237 return RTErrConvertFromErrno(rc); 238 } 239 240 241 RTDECL(int) RTFileReadAt(RTFILE hFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead) 242 { 243 return VERR_NOT_IMPLEMENTED; 244 } 245 164 246 #endif 165 247
Note:
See TracChangeset
for help on using the changeset viewer.