Changeset 736c164 in mainline for uspace/lib/libfs


Ignore:
Timestamp:
2008-03-30T22:30:32Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
94b0b63
Parents:
81c0171e
Message:

Make libfs_lookup() more generic.

Location:
uspace/lib/libfs
Files:
2 edited

Legend:

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

    r81c0171e r736c164  
    149149        void *par = NULL;
    150150        void *cur = ops->root_get();
    151         void *tmp = ops->child_get(cur);
     151        void *tmp;
    152152
    153153        if (ops->plb_get_char(next) == '/')
     
    156156        char component[NAME_MAX + 1];
    157157        int len = 0;
    158         while (tmp && next <= last) {
     158        while (ops->has_children(cur) && next <= last) {
    159159
    160160                /* collect the component */
     
    177177
    178178                /* match the component */
    179                 while (tmp && !ops->match(cur, tmp, component))
    180                         tmp = ops->sibling_get(tmp);
     179                tmp = ops->match(cur, component);
    181180
    182181                /* handle miss: match amongst siblings */
     
    229228                par = cur;
    230229                cur = tmp;
    231                 tmp = ops->child_get(tmp);
    232230        }
    233231
    234232        /* handle miss: excessive components */
    235         if (!tmp && next <= last) {
     233        if (!ops->has_children(cur) && next <= last) {
    236234                if (lflag & (L_CREATE | L_LINK)) {
    237235                        if (!ops->is_directory(cur)) {
  • uspace/lib/libfs/libfs.h

    r81c0171e r736c164  
    4343
    4444typedef struct {
    45         bool (* match)(void *, void *, const char *);
     45        void * (* match)(void *, const char *);
    4646        void * (* node_get)(fs_handle_t, dev_handle_t, fs_index_t);
    4747        void * (* create)(int);
     
    5252        size_t (* size_get)(void *);
    5353        unsigned (* lnkcnt_get)(void *);
    54         void *(* child_get)(void *);
    55         void *(* sibling_get)(void *);
     54        bool (* has_children)(void *);
    5655        void *(* root_get)(void);
    5756        char (* plb_get_char)(unsigned pos);   
Note: See TracChangeset for help on using the changeset viewer.