Changeset 05b9912 in mainline for uspace/srv/vfs/vfs_lookup.c
- Timestamp:
- 2009-06-03T18:54:49Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 17fd1d4
- Parents:
- 215abc1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_lookup.c
r215abc1 r05b9912 29 29 /** @addtogroup fs 30 30 * @{ 31 */ 31 */ 32 32 33 33 /** 34 * @file 34 * @file vfs_lookup.c 35 35 * @brief 36 36 */ … … 47 47 #include <vfs/canonify.h> 48 48 49 #define min(a, b) 49 #define min(a, b) ((a) < (b) ? (a) : (b)) 50 50 51 51 futex_t plb_futex = FUTEX_INITIALIZER; 52 link_t plb_head; 52 link_t plb_head; /**< PLB entry ring buffer. */ 53 53 uint8_t *plb = NULL; 54 54 55 55 /** Perform a path lookup. 56 56 * 57 * @param path Path to be resolved; it must be a NULL-terminated 58 * string. 59 * @param lflag Flags to be used during lookup. 60 * @param result Empty structure where the lookup result will be stored. 61 * Can be NULL. 62 * @param altroot If non-empty, will be used instead of rootfs as the root 63 * of the whole VFS tree. 64 * 65 * @return EOK on success or an error code from errno.h. 57 * @param path Path to be resolved; it must be a NULL-terminated 58 * string. 59 * @param lflag Flags to be used during lookup. 60 * @param result Empty structure where the lookup result will be stored. 61 * Can be NULL. 62 * @param altroot If non-empty, will be used instead of rootfs as the root 63 * of the whole VFS tree. 64 * 65 * @return EOK on success or an error code from errno.h. 66 * 66 67 */ 67 68 int vfs_lookup_internal(char *path, int lflag, vfs_lookup_res_t *result, … … 179 180 futex_up(&plb_futex); 180 181 181 if ((rc == EOK) && result) {182 if ((rc == EOK) && (result)) { 182 183 result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer); 183 184 result->triplet.dev_handle = (dev_handle_t) IPC_GET_ARG2(answer); … … 196 197 } 197 198 199 /** Perform a node open operation. 200 * 201 * @return EOK on success or an error code from errno.h. 202 * 203 */ 204 int vfs_open_node_internal(vfs_lookup_res_t *result) 205 { 206 int phone = vfs_grab_phone(result->triplet.fs_handle); 207 208 ipc_call_t answer; 209 aid_t req = async_send_2(phone, VFS_OPEN_NODE, 210 (ipcarg_t) result->triplet.dev_handle, 211 (ipcarg_t) result->triplet.index, &answer); 212 213 vfs_release_phone(phone); 214 215 async_serialize_start(); 216 ipcarg_t rc; 217 async_wait_for(req, &rc); 218 async_serialize_end(); 219 220 if (rc == EOK) { 221 result->size = (size_t) IPC_GET_ARG1(answer); 222 result->lnkcnt = (unsigned) IPC_GET_ARG2(answer); 223 if (IPC_GET_ARG3(answer) & L_FILE) 224 result->type = VFS_NODE_FILE; 225 else if (IPC_GET_ARG3(answer) & L_DIRECTORY) 226 result->type = VFS_NODE_DIRECTORY; 227 else 228 result->type = VFS_NODE_UNKNOWN; 229 } 230 231 return rc; 232 } 233 198 234 /** 199 235 * @}
Note:
See TracChangeset
for help on using the changeset viewer.