Changeset 4f46695e in mainline


Ignore:
Timestamp:
2009-05-09T08:39:28Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cf95bc0
Parents:
f4876df
Message:

Lookup a node's parent lexically rather than using the broken L_PARENT flag of
VFS_LOOKUP.

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libfs/libfs.c

    rf4876df r4f46695e  
    217217                                }
    218218                                goto out;
    219                         } else if (lflag & L_PARENT) {
    220                                 /* return parent */
    221                                 ipc_answer_5(rid, EOK, fs_handle, dev_handle,
    222                                     ops->index_get(cur), ops->size_get(cur),
    223                                     ops->lnkcnt_get(cur));
    224219                        }
    225220                        ipc_answer_0(rid, ENOENT);
     
    294289
    295290        /* handle hit */
    296         if (lflag & L_PARENT) {
    297                 ops->node_put(cur);
    298                 cur = par;
    299                 par = NULL;
    300                 if (!cur) {
    301                         ipc_answer_0(rid, ENOENT);
    302                         goto out;
    303                 }
    304         }
    305291        if (lflag & L_UNLINK) {
    306292                unsigned old_lnkcnt = ops->lnkcnt_get(cur);
  • uspace/srv/vfs/vfs.h

    rf4876df r4f46695e  
    167167 */
    168168#define L_UNLINK        32     
    169 /**
    170  * L_PARENT performs a lookup but returns the triplet of the parent node.
    171  * This flag may not be combined with any other lookup flag.
    172  */
    173 #define L_PARENT        64     
    174169
    175170typedef enum vfs_node_type {
  • uspace/srv/vfs/vfs_ops.c

    rf4876df r4f46695e  
    990990                return;
    991991        }
     992        /* Determine the path to the parent of the node with the new name. */
     993        char *parentc = str_dup(newc);
     994        if (!parentc) {
     995                rwlock_write_unlock(&namespace_rwlock);
     996                ipc_answer_0(rid, rc);
     997                free(old);
     998                free(new);
     999                return;
     1000        }
     1001        char *lastsl = str_rchr(parentc + 1, L'/');
     1002        if (lastsl)
     1003                *lastsl = '\0';
     1004        else
     1005                parentc[1] = '\0';
    9921006        /* Lookup parent of the new file name. */
    993         rc = vfs_lookup_internal(newc, L_PARENT, &new_par_lr, NULL);
     1007        rc = vfs_lookup_internal(parentc, L_NONE, &new_par_lr, NULL);
     1008        free(parentc);  /* not needed anymore */
    9941009        if (rc != EOK) {
    9951010                rwlock_write_unlock(&namespace_rwlock);
Note: See TracChangeset for help on using the changeset viewer.