Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_lookup.c

    r5a6cc679 ra35b458  
    108108         */
    109109        list_append(&entry->plb_link, &plb_entries);
    110        
     110
    111111        fibril_mutex_unlock(&plb_mutex);
    112112
     
    116116        size_t cnt1 = min(len, (PLB_SIZE - first) + 1);
    117117        size_t cnt2 = len - cnt1;
    118        
     118
    119119        memcpy(&plb[first], path, cnt1);
    120120        memcpy(plb, &path[cnt1], cnt2);
     
    145145        assert(child->fs_handle);
    146146        assert(path != NULL);
    147        
     147
    148148        vfs_lookup_res_t res;
    149149        char component[NAME_MAX + 1];
    150150        errno_t rc;
    151        
     151
    152152        size_t len;
    153153        char *npath = canonify(path, &len);
     
    157157        }
    158158        path = npath;
    159        
     159
    160160        vfs_triplet_t *triplet;
    161        
     161
    162162        char *slash = str_rchr(path, L'/');
    163163        if (slash && slash != path) {
     
    166166                        goto out;
    167167                }
    168                
     168
    169169                memcpy(component, slash + 1, str_size(slash));
    170170                *slash = 0;
    171                
     171
    172172                rc = vfs_lookup_internal(base, path, L_DIRECTORY, &res);
    173173                if (rc != EOK)
    174174                        goto out;
    175175                triplet = &res.triplet;
    176                
     176
    177177                *slash = '/';
    178178        } else {
     
    181181                        goto out;
    182182                }
    183                
     183
    184184                memcpy(component, path + 1, str_size(path));
    185185                triplet = (vfs_triplet_t *) base;
    186186        }
    187        
     187
    188188        if (triplet->fs_handle != child->fs_handle ||
    189189            triplet->service_id != child->service_id) {
     
    191191                goto out;
    192192        }
    193        
     193
    194194        async_exch_t *exch = vfs_exchange_grab(triplet->fs_handle);
    195195        aid_t req = async_send_3(exch, VFS_OUT_LINK, triplet->service_id,
    196196            triplet->index, child->index, NULL);
    197        
     197
    198198        rc = async_data_write_start(exch, component, str_size(component) + 1);
    199199        errno_t orig_rc;
     
    202202        if (orig_rc != EOK)
    203203                rc = orig_rc;
    204        
     204
    205205out:
    206206        return rc;
     
    212212        assert(base);
    213213        assert(result);
    214        
     214
    215215        errno_t rc;
    216216        ipc_call_t answer;
     
    221221        async_wait_for(req, &rc);
    222222        vfs_exchange_release(exch);
    223        
     223
    224224        if (rc != EOK)
    225225                return rc;
    226        
     226
    227227        unsigned last = *pfirst + *plen;
    228228        *pfirst = IPC_GET_ARG3(answer) & 0xffff;
    229229        *plen = last - *pfirst;
    230        
     230
    231231        result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer);
    232232        result->triplet.service_id = base->service_id;
     
    248248        if (rc != EOK)
    249249                return rc;
    250        
     250
    251251        size_t next = first;
    252252        size_t nlen = len;
    253        
     253
    254254        vfs_lookup_res_t res;
    255        
     255
    256256        /* Resolve path as long as there are mount points to cross. */
    257257        while (nlen > 0) {
     
    261261                                goto out;
    262262                        }
    263                        
     263
    264264                        base = base->mount;
    265265                }
    266                
     266
    267267                rc = out_lookup((vfs_triplet_t *) base, &next, &nlen, lflag,
    268268                    &res);
    269269                if (rc != EOK)
    270270                        goto out;
    271                
     271
    272272                if (nlen > 0) {
    273273                        base = vfs_node_peek(&res);
     
    288288                }
    289289        }
    290        
     290
    291291        assert(nlen == 0);
    292292        rc = EOK;
    293        
     293
    294294        if (result != NULL) {
    295295                /* The found file may be a mount point. Try to cross it. */
     
    303303                                        base = nbase;
    304304                                }
    305                                
     305
    306306                                result->triplet = *((vfs_triplet_t *) base);
    307307                                result->type = base->type;
     
    316316                *result = res;
    317317        }
    318        
     318
    319319out:
    320320        plb_clear_entry(&entry, first, len);
     
    339339        assert(base != NULL);
    340340        assert(path != NULL);
    341        
     341
    342342        size_t len;
    343343        errno_t rc;
     
    348348        }
    349349        path = npath;
    350        
     350
    351351        assert(path[0] == '/');
    352352
     
    367367                char *slash = str_rchr(path, L'/');
    368368                vfs_node_t *parent = base;
    369                
     369
    370370                if (slash != path) {
    371371                        int tflag = lflag;
     
    392392                rc = _vfs_lookup_internal(base, path, lflag, result, len);
    393393        }
    394        
     394
    395395        return rc;
    396396}
Note: See TracChangeset for help on using the changeset viewer.