Subversion Repositories HelenOS

Rev

Rev 2857 | Rev 2863 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2857 Rev 2858
Line 73... Line 73...
73
static void *tmpfs_node_get(dev_handle_t, fs_index_t, fs_index_t);
73
static void *tmpfs_node_get(dev_handle_t, fs_index_t, fs_index_t);
74
static void tmpfs_node_put(void *);
74
static void tmpfs_node_put(void *);
75
static void *tmpfs_create_node(int);
75
static void *tmpfs_create_node(int);
76
static bool tmpfs_link_node(void *, void *, const char *);
76
static bool tmpfs_link_node(void *, void *, const char *);
77
static int tmpfs_unlink_node(void *, void *);
77
static int tmpfs_unlink_node(void *, void *);
78
static bool tmpfs_destroy_node(void *);
78
static int tmpfs_destroy_node(void *);
79
 
79
 
80
/* Implementation of helper functions. */
80
/* Implementation of helper functions. */
81
static fs_index_t tmpfs_index_get(void *nodep)
81
static fs_index_t tmpfs_index_get(void *nodep)
82
{
82
{
83
    return ((tmpfs_dentry_t *) nodep)->index;
83
    return ((tmpfs_dentry_t *) nodep)->index;
Line 372... Line 372...
372
    childp->lnkcnt--;
372
    childp->lnkcnt--;
373
 
373
 
374
    return EOK;
374
    return EOK;
375
}
375
}
376
 
376
 
377
bool tmpfs_destroy_node(void *nodep)
377
int tmpfs_destroy_node(void *nodep)
378
{
378
{
379
    tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
379
    tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
380
   
380
   
381
    assert(!dentry->lnkcnt);
381
    assert(!dentry->lnkcnt);
382
    assert(!dentry->child);
382
    assert(!dentry->child);
Line 388... Line 388...
388
    hash_table_destroy(&dentry->names);
388
    hash_table_destroy(&dentry->names);
389
 
389
 
390
    if (dentry->type == TMPFS_FILE)
390
    if (dentry->type == TMPFS_FILE)
391
        free(dentry->data);
391
        free(dentry->data);
392
    free(dentry);
392
    free(dentry);
393
    return true;
393
    return EOK;
394
}
394
}
395
 
395
 
396
void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request)
396
void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request)
397
{
397
{
398
    /* Initialize TMPFS. */
398
    /* Initialize TMPFS. */
Line 577... Line 577...
577
 
577
 
578
void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
578
void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
579
{
579
{
580
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
580
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
581
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
581
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-
 
582
    int rc;
582
 
583
 
583
    link_t *hlp;
584
    link_t *hlp;
584
    unsigned long key = index;
585
    unsigned long key = index;
585
    hlp = hash_table_find(&dentries, &key);
586
    hlp = hash_table_find(&dentries, &key);
586
    if (!hlp) {
587
    if (!hlp) {
587
        ipc_answer_0(rid, ENOENT);
588
        ipc_answer_0(rid, ENOENT);
588
        return;
589
        return;
589
    }
590
    }
590
    tmpfs_dentry_t *dentry = hash_table_get_instance(hlp, tmpfs_dentry_t,
591
    tmpfs_dentry_t *dentry = hash_table_get_instance(hlp, tmpfs_dentry_t,
591
        dh_link);
592
        dh_link);
592
    tmpfs_destroy_node(dentry);
593
    rc = tmpfs_destroy_node(dentry);
593
    ipc_answer_0(rid, EOK);
594
    ipc_answer_0(rid, rc);
594
}
595
}
595
 
596
 
596
/**
597
/**
597
 * @}
598
 * @}
598
 */
599
 */