Changeset 736c164 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c
- Timestamp:
- 2008-03-30T22:30:32Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 94b0b63
- Parents:
- 81c0171e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r81c0171e r736c164 70 70 71 71 /* Forward declarations of static functions. */ 72 static bool tmpfs_match(void *,void *, const char *);72 static void *tmpfs_match(void *, const char *); 73 73 static void *tmpfs_node_get(fs_handle_t, dev_handle_t, fs_index_t); 74 74 static void *tmpfs_create_node(int); … … 93 93 } 94 94 95 static void *tmpfs_child_get(void *nodep) 96 { 97 return ((tmpfs_dentry_t *) nodep)->child; 98 } 99 100 static void *tmpfs_sibling_get(void *nodep) 101 { 102 return ((tmpfs_dentry_t *) nodep)->sibling; 95 static bool tmpfs_has_children(void *nodep) 96 { 97 return ((tmpfs_dentry_t *) nodep)->child != NULL; 103 98 } 104 99 … … 134 129 .size_get = tmpfs_size_get, 135 130 .lnkcnt_get = tmpfs_lnkcnt_get, 136 .child_get = tmpfs_child_get, 137 .sibling_get = tmpfs_sibling_get, 131 .has_children = tmpfs_has_children, 138 132 .root_get = tmpfs_root_get, 139 133 .plb_get_char = tmpfs_plb_get_char, … … 244 238 /** Compare one component of path to a directory entry. 245 239 * 246 * @param p rnt Node from which we descended.247 * @param ch ld Node to compare the path component with.240 * @param parentp Pointer to node from which we descended. 241 * @param childp Pointer to node to compare the path component with. 248 242 * @param component Array of characters holding component name. 249 243 * 250 244 * @return True on match, false otherwise. 251 245 */ 252 bool tmpfs_match(void *prnt, void *chld, const char *component) 253 { 254 tmpfs_dentry_t *parentp = (tmpfs_dentry_t *) prnt; 255 tmpfs_dentry_t *childp = (tmpfs_dentry_t *) chld; 256 246 static bool 247 tmpfs_match_one(tmpfs_dentry_t *parentp, tmpfs_dentry_t *childp, 248 const char *component) 249 { 257 250 unsigned long key = (unsigned long) parentp; 258 251 link_t *hlp = hash_table_find(&childp->names, &key); 259 252 assert(hlp); 260 253 tmpfs_name_t *namep = hash_table_get_instance(hlp, tmpfs_name_t, link); 261 262 254 return !strcmp(namep->name, component); 255 } 256 257 void *tmpfs_match(void *prnt, const char *component) 258 { 259 tmpfs_dentry_t *parentp = (tmpfs_dentry_t *) prnt; 260 tmpfs_dentry_t *childp = parentp->child; 261 262 while (childp && !tmpfs_match_one(parentp, childp, component)) 263 childp = childp->sibling; 264 265 return (void *) childp; 263 266 } 264 267
Note:
See TracChangeset
for help on using the changeset viewer.