Subversion Repositories HelenOS

Rev

Rev 2732 | Rev 2735 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2732 Rev 2733
Line 185... Line 185...
185
    return (void *) node;
185
    return (void *) node;
186
}
186
}
187
 
187
 
188
static int destroy_component(void *nodeptr)
188
static int destroy_component(void *nodeptr)
189
{
189
{
-
 
190
    tmpfs_dentry_t *dentry = (tmpfs_dentry_t *)nodeptr;
-
 
191
 
-
 
192
    if (dentry->child)
-
 
193
        return ENOTEMPTY;
-
 
194
 
-
 
195
    if (!dentry->parent)
-
 
196
        return EBUSY;
-
 
197
 
-
 
198
    if (dentry->parent->child == dentry) {
-
 
199
        dentry->parent->child = dentry->sibling;
-
 
200
    } else {
-
 
201
        /* TODO: consider doubly linked list for organizing siblings. */
-
 
202
        tmpfs_dentry_t *tmp = dentry->parent->child;
-
 
203
        while (tmp->sibling != dentry)
-
 
204
            tmp = tmp->sibling;
-
 
205
        tmp->sibling = dentry->sibling;
-
 
206
    }
-
 
207
 
190
    return EPERM;
208
    return EOK;
191
}
209
}
192
 
210
 
193
void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request)
211
void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request)
194
{
212
{
195
    unsigned next = IPC_GET_ARG1(*request);
213
    unsigned next = IPC_GET_ARG1(*request);
Line 311... Line 329...
311
    }
329
    }
312
 
330
 
313
    /* handle hit */
331
    /* handle hit */
314
    if (lflag & L_DESTROY) {
332
    if (lflag & L_DESTROY) {
315
        int res = destroy_component(dcur);
333
        int res = destroy_component(dcur);
-
 
334
        unsigned lnkcnt = (res == EOK) ? 0 : TMPFS_GET_LNKCNT(dcur);
316
        ipc_answer_0(rid, res);
335
        ipc_answer_5(rid, (ipcarg_t)res, tmpfs_reg.fs_handle,
-
 
336
            dev_handle, dcur->index, dcur->size, lnkcnt);
317
        return;
337
        return;
318
    }
338
    }
319
    if ((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) {
339
    if ((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) {
320
        ipc_answer_0(rid, EEXIST);
340
        ipc_answer_0(rid, EEXIST);
321
        return;
341
        return;