Changeset ae78b53 in mainline
- Timestamp:
- 2008-01-19T13:40:38Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4bb31f7
- Parents:
- 5973fd0
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/vfs.c
r5973fd0 rae78b53 96 96 } 97 97 98 99 int open(const char *path, int oflag, ...) 98 static int _open(const char *path, int lflag, int oflag, ...) 100 99 { 101 100 int res; … … 114 113 } 115 114 } 116 req = async_send_ 2(vfs_phone, VFS_OPEN, oflag, 0, &answer);115 req = async_send_3(vfs_phone, VFS_OPEN, lflag, oflag, 0, &answer); 117 116 rc = ipc_data_write_start(vfs_phone, path, strlen(path)); 118 117 if (rc != EOK) { … … 126 125 futex_up(&vfs_phone_futex); 127 126 return (int) IPC_GET_ARG1(answer); 127 } 128 129 int open(const char *path, int oflag, ...) 130 { 131 return _open(path, L_FILE, oflag); 128 132 } 129 133 … … 243 247 if (!dirp) 244 248 return NULL; 245 dirp->fd = open(dirname, 0); /* TODO: must be a directory */249 dirp->fd = _open(dirname, L_DIRECTORY, 0); 246 250 if (dirp->fd < 0) { 247 251 free(dirp); -
uspace/srv/fs/tmpfs/tmpfs_ops.c
r5973fd0 rae78b53 237 237 unsigned last = IPC_GET_ARG2(*request); 238 238 int dev_handle = IPC_GET_ARG3(*request); 239 int lflag = IPC_GET_ARG4(*request); 239 240 240 241 if (last < next) -
uspace/srv/vfs/vfs.h
r5973fd0 rae78b53 139 139 } vfs_triplet_t; 140 140 141 #define L_FILE 1 142 #define L_DIRECTORY 2 143 141 144 typedef struct { 142 145 vfs_triplet_t triplet; … … 204 207 extern int fs_name_to_handle(char *, bool); 205 208 206 extern int vfs_lookup_internal(char *, size_t, vfs_lookup_res_t *,209 extern int vfs_lookup_internal(char *, size_t, int, vfs_lookup_res_t *, 207 210 vfs_pair_t *); 208 211 -
uspace/srv/vfs/vfs_lookup.c
r5973fd0 rae78b53 56 56 * @param path Path to be resolved; it needn't be an ASCIIZ string. 57 57 * @param len Number of path characters pointed by path. 58 * @param lflag Flags to be used during lookup. 58 59 * @param result Empty structure where the lookup result will be stored. 59 60 * @param altroot If non-empty, will be used instead of rootfs as the root … … 62 63 * @return EOK on success or an error code from errno.h. 63 64 */ 64 int vfs_lookup_internal(char *path, size_t len, vfs_lookup_res_t *result,65 vfs_ pair_t *altroot)65 int vfs_lookup_internal(char *path, size_t len, int lflag, 66 vfs_lookup_res_t *result, vfs_pair_t *altroot) 66 67 { 67 68 vfs_pair_t *root; … … 145 146 ipc_call_t answer; 146 147 int phone = vfs_grab_phone(root->fs_handle); 147 aid_t req = async_send_ 3(phone, VFS_LOOKUP, (ipcarg_t) first,148 aid_t req = async_send_4(phone, VFS_LOOKUP, (ipcarg_t) first, 148 149 (ipcarg_t) (first + len - 1) % PLB_SIZE, 149 (ipcarg_t) root->dev_handle, &answer);150 (ipcarg_t) root->dev_handle, (ipcarg_t) lflag, &answer); 150 151 vfs_release_phone(phone); 151 152 -
uspace/srv/vfs/vfs_ops.c
r5973fd0 rae78b53 72 72 }; 73 73 74 return vfs_lookup_internal("/", strlen("/"), result, &altroot); 74 return vfs_lookup_internal("/", strlen("/"), L_DIRECTORY, result, 75 &altroot); 75 76 } 76 77 … … 196 197 */ 197 198 rwlock_write_lock(&namespace_rwlock); 198 rc = vfs_lookup_internal(buf, size, &mp_res, NULL); 199 rc = vfs_lookup_internal(buf, size, L_DIRECTORY, &mp_res, 200 NULL); 199 201 if (rc != EOK) { 200 202 /* … … 298 300 299 301 /* 300 * The POSIX interface is open(path, flags, mode).301 * We can receive flags and mode along with the VFS_OPEN call; the path302 * The POSIX interface is open(path, oflag, mode). 303 * We can receive oflags and mode along with the VFS_OPEN call; the path 302 304 * will need to arrive in another call. 303 */ 304 int flags = IPC_GET_ARG1(*request); 305 int mode = IPC_GET_ARG2(*request); 305 * 306 * We also receive one private, non-POSIX set of flags called lflag 307 * used to pass information to vfs_lookup_internal(). 308 */ 309 int lflag = IPC_GET_ARG1(*request); 310 int oflag = IPC_GET_ARG2(*request); 311 int mode = IPC_GET_ARG3(*request); 306 312 size_t len; 307 313 … … 346 352 */ 347 353 vfs_lookup_res_t lr; 348 rc = vfs_lookup_internal(path, len, &lr, NULL);354 rc = vfs_lookup_internal(path, len, lflag, &lr, NULL); 349 355 if (rc) { 350 356 rwlock_read_unlock(&namespace_rwlock);
Note:
See TracChangeset
for help on using the changeset viewer.