Changeset 72bde81 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c
- Timestamp:
- 2008-01-27T14:59:32Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2db4ac8
- Parents:
- 1fe186f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r1fe186f r72bde81 212 212 const char *component, int lflag) 213 213 { 214 return 0; 214 assert(dentry->type == TMPFS_DIRECTORY); 215 assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY)); 216 217 tmpfs_dentry_t *node = malloc(sizeof(tmpfs_dentry_t)); 218 if (!node) 219 return 0; 220 size_t len = strlen(component); 221 char *name = malloc(len + 1); 222 if (!name) { 223 free(node); 224 return 0; 225 } 226 strcpy(name, component); 227 228 tmpfs_dentry_initialize(node); 229 node->index = tmpfs_next_index++; 230 node->name = name; 231 node->parent = dentry; 232 if (lflag & L_DIRECTORY) 233 node->type = TMPFS_DIRECTORY; 234 else 235 node->type = TMPFS_FILE; 236 237 /* Insert the new node into the namespace. */ 238 if (dentry->child) { 239 tmpfs_dentry_t *tmp = dentry->child; 240 while (tmp->sibling) 241 tmp = tmp->sibling; 242 tmp->sibling = node; 243 } else { 244 dentry->child = node; 245 } 246 247 /* Insert the new node into the dentry hash table. */ 248 hash_table_insert(&dentries, &node->index, &node->dh_link); 249 return node->index; 215 250 } 216 251 … … 257 292 component[len++] = PLB_GET_CHAR(next); 258 293 next++; /* process next character */ 259 if (next <= last) 294 if (next <= last) 260 295 continue; 261 296 } … … 280 315 unsigned long index = create_node(dcur, 281 316 component, lflag); 282 if (index ) {317 if (index > 0) { 283 318 ipc_answer_4(rid, EOK, 284 319 tmpfs_reg.fs_handle, dev_handle,
Note:
See TracChangeset
for help on using the changeset viewer.