Subversion Repositories HelenOS

Rev

Rev 4586 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4586 Rev 4608
Line 437... Line 437...
437
    fs_node_t *fn = ops->node_get(dev_handle, index);
437
    fs_node_t *fn = ops->node_get(dev_handle, index);
438
 
438
 
439
    ipc_callid_t callid;
439
    ipc_callid_t callid;
440
    size_t size;
440
    size_t size;
441
    if (!ipc_data_read_receive(&callid, &size) ||
441
    if (!ipc_data_read_receive(&callid, &size) ||
442
        size < sizeof(struct stat)) {
442
        size != sizeof(struct stat)) {
443
        ipc_answer_0(callid, EINVAL);
443
        ipc_answer_0(callid, EINVAL);
444
        ipc_answer_0(rid, EINVAL);
444
        ipc_answer_0(rid, EINVAL);
445
        return;
445
        return;
446
    }
446
    }
447
 
447
 
448
    struct stat *stat = malloc(sizeof(struct stat));
-
 
449
    if (!stat) {
448
    struct stat stat;
450
        ipc_answer_0(callid, ENOMEM);
-
 
451
        ipc_answer_0(rid, ENOMEM);
-
 
452
        return;
-
 
453
    }
-
 
454
    memset(stat, 0, sizeof(struct stat));
449
    memset(&stat, 0, sizeof(struct stat));
455
   
450
   
456
    stat->fs_handle = fs_handle;
451
    stat.fs_handle = fs_handle;
457
    stat->dev_handle = dev_handle;
452
    stat.dev_handle = dev_handle;
458
    stat->index = index;
453
    stat.index = index;
459
    stat->lnkcnt = ops->lnkcnt_get(fn);
454
    stat.lnkcnt = ops->lnkcnt_get(fn);
460
    stat->is_file = ops->is_file(fn);
455
    stat.is_file = ops->is_file(fn);
461
    stat->size = ops->size_get(fn);
456
    stat.size = ops->size_get(fn);
462
 
457
 
463
    ipc_data_read_finalize(callid, stat, sizeof(struct stat));
458
    ipc_data_read_finalize(callid, &stat, sizeof(struct stat));
464
    ipc_answer_0(rid, EOK);
459
    ipc_answer_0(rid, EOK);
465
 
-
 
466
    free(stat);
-
 
467
}
460
}
468
 
461
 
469
/** Open VFS triplet.
462
/** Open VFS triplet.
470
 *
463
 *
471
 * @param ops       libfs operations structure with function pointers to
464
 * @param ops       libfs operations structure with function pointers to