Subversion Repositories HelenOS

Rev

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

Rev 2747 Rev 2756
Line 84... Line 84...
84
    return ((tmpfs_dentry_t *) nodep)->size;
84
    return ((tmpfs_dentry_t *) nodep)->size;
85
}
85
}
86
 
86
 
87
static unsigned tmpfs_lnkcnt_get(void *nodep)
87
static unsigned tmpfs_lnkcnt_get(void *nodep)
88
{
88
{
89
    return 1;
89
    return ((tmpfs_dentry_t *) nodep)->lnkcnt;
90
}
90
}
91
 
91
 
92
static void *tmpfs_child_get(void *nodep)
92
static void *tmpfs_child_get(void *nodep)
93
{
93
{
94
    return ((tmpfs_dentry_t *) nodep)->child;
94
    return ((tmpfs_dentry_t *) nodep)->child;
Line 173... Line 173...
173
    dentry->parent = NULL;
173
    dentry->parent = NULL;
174
    dentry->sibling = NULL;
174
    dentry->sibling = NULL;
175
    dentry->child = NULL;
175
    dentry->child = NULL;
176
    dentry->name = NULL;
176
    dentry->name = NULL;
177
    dentry->type = TMPFS_NONE;
177
    dentry->type = TMPFS_NONE;
-
 
178
    dentry->lnkcnt = 0;
178
    dentry->size = 0;
179
    dentry->size = 0;
179
    dentry->data = NULL;
180
    dentry->data = NULL;
180
    link_initialize(&dentry->dh_link);
181
    link_initialize(&dentry->dh_link);
181
}
182
}
182
 
183
 
Line 231... Line 232...
231
 
232
 
232
    size_t len = strlen(nm);
233
    size_t len = strlen(nm);
233
    char *name = malloc(len + 1);
234
    char *name = malloc(len + 1);
234
    if (!name)
235
    if (!name)
235
        return false;
236
        return false;
-
 
237
   
-
 
238
    childp->lnkcnt++;
-
 
239
   
236
    strcpy(name, nm);
240
    strcpy(name, nm);
237
    childp->name = name;
241
    childp->name = name;
238
 
242
 
239
    /* Insert the new node into the namespace. */
243
    /* Insert the new node into the namespace. */
240
    if (parentp->child) {
244
    if (parentp->child) {
Line 273... Line 277...
273
    dentry->parent = NULL;
277
    dentry->parent = NULL;
274
 
278
 
275
    free(dentry->name);
279
    free(dentry->name);
276
    dentry->name = NULL;
280
    dentry->name = NULL;
277
 
281
 
-
 
282
    dentry->lnkcnt--;
-
 
283
 
278
    return EOK;
284
    return EOK;
279
}
285
}
280
 
286
 
281
void tmpfs_destroy_node(void *nodep)
287
void tmpfs_destroy_node(void *nodep)
282
{
288
{
283
    tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
289
    tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
284
   
290
   
-
 
291
    assert(!dentry->lnkcnt);
285
    assert(!dentry->child);
292
    assert(!dentry->child);
286
    assert(!dentry->sibling);
293
    assert(!dentry->sibling);
287
 
294
 
288
    unsigned long index = dentry->index;
295
    unsigned long index = dentry->index;
289
    hash_table_remove(&dentries, &index, 1);
296
    hash_table_remove(&dentries, &index, 1);