Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    rb72efe8 rffa2c8ef  
    8585static int tmpfs_has_children(bool *has_children, fs_node_t *fn)
    8686{
    87         *has_children = !list_empty(&TMPFS_NODE(fn)->cs_list);
     87        *has_children = !list_empty(&TMPFS_NODE(fn)->cs_head);
    8888        return EOK;
    8989}
     
    180180            nh_link);
    181181
    182         while (!list_empty(&nodep->cs_list)) {
    183                 tmpfs_dentry_t *dentryp = list_get_instance(
    184                     list_first(&nodep->cs_list), tmpfs_dentry_t, link);
     182        while (!list_empty(&nodep->cs_head)) {
     183                tmpfs_dentry_t *dentryp = list_get_instance(nodep->cs_head.next,
     184                    tmpfs_dentry_t, link);
    185185
    186186                assert(nodep->type == TMPFS_DIRECTORY);
     
    214214        nodep->data = NULL;
    215215        link_initialize(&nodep->nh_link);
    216         list_initialize(&nodep->cs_list);
     216        list_initialize(&nodep->cs_head);
    217217}
    218218
     
    262262{
    263263        tmpfs_node_t *parentp = TMPFS_NODE(pfn);
    264 
    265         list_foreach(parentp->cs_list, lnk) {
     264        link_t *lnk;
     265
     266        for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
     267            lnk = lnk->next) {
    266268                tmpfs_dentry_t *dentryp;
    267269                dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
     
    351353       
    352354        assert(!nodep->lnkcnt);
    353         assert(list_empty(&nodep->cs_list));
     355        assert(list_empty(&nodep->cs_head));
    354356
    355357        unsigned long key[] = {
     
    371373        tmpfs_node_t *childp = TMPFS_NODE(cfn);
    372374        tmpfs_dentry_t *dentryp;
     375        link_t *lnk;
    373376
    374377        assert(parentp->type == TMPFS_DIRECTORY);
    375378
    376379        /* Check for duplicit entries. */
    377         list_foreach(parentp->cs_list, lnk) {
     380        for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
     381            lnk = lnk->next) {
    378382                dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
    379383                if (!str_cmp(dentryp->name, nm))
     
    397401        dentryp->node = childp;
    398402        childp->lnkcnt++;
    399         list_append(&dentryp->link, &parentp->cs_list);
     403        list_append(&dentryp->link, &parentp->cs_head);
    400404
    401405        return EOK;
     
    407411        tmpfs_node_t *childp = NULL;
    408412        tmpfs_dentry_t *dentryp;
     413        link_t *lnk;
    409414
    410415        if (!parentp)
    411416                return EBUSY;
    412417       
    413         list_foreach(parentp->cs_list, lnk) {
     418        for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
     419            lnk = lnk->next) {
    414420                dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
    415421                if (!str_cmp(dentryp->name, nm)) {
     
    417423                        assert(FS_NODE(childp) == cfn);
    418424                        break;
    419                 }
     425                }       
    420426        }
    421427
     
    423429                return ENOENT;
    424430               
    425         if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_list))
     431        if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_head))
    426432                return ENOTEMPTY;
    427433
     
    544550                tmpfs_dentry_t *dentryp;
    545551                link_t *lnk;
     552                aoff64_t i;
    546553               
    547554                assert(nodep->type == TMPFS_DIRECTORY);
     
    552559                 * hash table.
    553560                 */
    554                 lnk = list_nth(&nodep->cs_list, pos);
    555                
    556                 if (lnk == NULL) {
     561                for (i = 0, lnk = nodep->cs_head.next;
     562                    (i < pos) && (lnk != &nodep->cs_head);
     563                    i++, lnk = lnk->next)
     564                        ;
     565
     566                if (lnk == &nodep->cs_head) {
    557567                        async_answer_0(callid, ENOENT);
    558568                        async_answer_1(rid, ENOENT, 0);
Note: See TracChangeset for help on using the changeset viewer.