Changeset eb27ce5a in mainline for uspace/srv/vfs/vfs_ops.c
- Timestamp:
- 2008-01-09T19:50:40Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4fb6bf36
- Parents:
- cad9c72
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
rcad9c72 reb27ce5a 71 71 * @param path Path to be resolved; it needn't be an ASCIIZ string. 72 72 * @param len Number of path characters pointed by path. 73 * @param result Empty node structure where the result will be stored. 74 * @param size Storage where the size of the node will be stored. Can 75 * be NULL. 73 * @param result Empty structure where the lookup result will be stored. 76 74 * @param altroot If non-empty, will be used instead of rootfs as the root 77 75 * of the whole VFS tree. … … 79 77 * @return EOK on success or an error code from errno.h. 80 78 */ 81 int vfs_lookup_internal(char *path, size_t len, vfs_ triplet_t *result,82 size_t *size,vfs_pair_t *altroot)79 int vfs_lookup_internal(char *path, size_t len, vfs_lookup_res_t *result, 80 vfs_pair_t *altroot) 83 81 { 84 82 vfs_pair_t *root; … … 180 178 181 179 if (rc == EOK) { 182 result->fs_handle = (int) IPC_GET_ARG1(answer); 183 result->dev_handle = (int) IPC_GET_ARG2(answer); 184 result->index = (int) IPC_GET_ARG3(answer); 185 if (size) 186 *size = (size_t) IPC_GET_ARG4(answer); 180 result->triplet.fs_handle = (int) IPC_GET_ARG1(answer); 181 result->triplet.dev_handle = (int) IPC_GET_ARG2(answer); 182 result->triplet.index = (int) IPC_GET_ARG3(answer); 183 result->size = (size_t) IPC_GET_ARG4(answer); 187 184 } 188 185 … … 197 194 }; 198 195 199 static int lookup_root(int fs_handle, int dev_handle, vfs_triplet_t *root, 200 size_t *size) 196 static int lookup_root(int fs_handle, int dev_handle, vfs_lookup_res_t *result) 201 197 { 202 198 vfs_pair_t altroot = { … … 205 201 }; 206 202 207 return vfs_lookup_internal("/", strlen("/"), r oot, size, &altroot);203 return vfs_lookup_internal("/", strlen("/"), result, &altroot); 208 204 } 209 205 … … 305 301 */ 306 302 int rc; 307 vfs_triplet_t mounted_root; 308 size_t mrsz; 309 rc = lookup_root(fs_handle, dev_handle, &mounted_root, &mrsz); 303 vfs_lookup_res_t mr_res; 304 rc = lookup_root(fs_handle, dev_handle, &mr_res); 310 305 if (rc != EOK) { 311 306 free(buf); … … 313 308 return; 314 309 } 315 vfs_node_t *mr_node = vfs_node_get(&m ounted_root, mrsz);310 vfs_node_t *mr_node = vfs_node_get(&mr_res); 316 311 if (!mr_node) { 317 312 free(buf); … … 323 318 * Finally, we need to resolve the path to the mountpoint. 324 319 */ 325 vfs_triplet_t mp; 326 size_t mpsz; 320 vfs_lookup_res_t mp_res; 327 321 futex_down(&rootfs_futex); 328 322 if (rootfs.fs_handle) { … … 331 325 */ 332 326 rwlock_write_lock(&namespace_rwlock); 333 rc = vfs_lookup_internal(buf, size, &mp , &mpsz, NULL);327 rc = vfs_lookup_internal(buf, size, &mp_res, NULL); 334 328 if (rc != EOK) { 335 329 /* … … 343 337 return; 344 338 } 345 mp_node = vfs_node_get(&mp , mpsz);339 mp_node = vfs_node_get(&mp_res); 346 340 if (!mp_node) { 347 341 rwlock_write_unlock(&namespace_rwlock); … … 366 360 * For this simple, but important case, we are done. 367 361 */ 368 rootfs = m ounted_root;362 rootfs = mr_res.triplet; 369 363 futex_up(&rootfs_futex); 370 364 free(buf); … … 393 387 */ 394 388 395 int phone = vfs_grab_phone(mp .fs_handle);389 int phone = vfs_grab_phone(mp_res.triplet.fs_handle); 396 390 /* Later we can use ARG3 to pass mode/flags. */ 397 aid_t req1 = async_send_3(phone, VFS_MOUNT, (ipcarg_t) mp.dev_handle, 398 (ipcarg_t) mp.index, 0, NULL); 391 aid_t req1 = async_send_3(phone, VFS_MOUNT, 392 (ipcarg_t) mp_res.triplet.dev_handle, 393 (ipcarg_t) mp_res.triplet.index, 0, NULL); 399 394 /* The second call uses the same method. */ 400 395 aid_t req2 = async_send_3(phone, VFS_MOUNT, 401 (ipcarg_t) m ounted_root.fs_handle,402 (ipcarg_t) m ounted_root.dev_handle, (ipcarg_t) mounted_root.index,403 NULL);396 (ipcarg_t) mr_res.triplet.fs_handle, 397 (ipcarg_t) mr_res.triplet.dev_handle, 398 (ipcarg_t) mr_res.triplet.index, NULL); 404 399 vfs_release_phone(phone); 405 400 … … 479 474 * The path is now populated and we can call vfs_lookup_internal(). 480 475 */ 481 vfs_triplet_t triplet; 482 size_t size; 483 rc = vfs_lookup_internal(path, len, &triplet, &size, NULL); 476 vfs_lookup_res_t lr; 477 rc = vfs_lookup_internal(path, len, &lr, NULL); 484 478 if (rc) { 485 479 rwlock_read_unlock(&namespace_rwlock); … … 494 488 free(path); 495 489 496 vfs_node_t *node = vfs_node_get(& triplet, size);490 vfs_node_t *node = vfs_node_get(&lr); 497 491 rwlock_read_unlock(&namespace_rwlock); 498 492
Note:
See TracChangeset
for help on using the changeset viewer.