Beispiel #1
0
int main(int argc, char **argv) {
    storage_t st;
    sid_t sid = 0;
    sstat_t sst;
    fid_t fid;
    //bin_t *bins;

    rozofs_initialize(LAYOUT_2_3_4);
    storage_initialize(&st, sid, "/tmp");

    if (storage_stat(&st, &sst) != 0) {
        perror("failed to stat storage");
        exit(-1);
    }
    printf("size: %" PRIu64 ", free: %" PRIu64 "\n", sst.size, sst.free);

    uuid_generate(fid);
    // Write some bins (15 prj)
    //bins = xmalloc(rozofs_psizes[0] * 15);
/*
    if (storage_write(&st, fid, 0, 10, 15, bins) != 0) {
        perror("failed to write bins");
        exit(-1);
    }
*/

    if (storage_truncate(&st, fid, 0, 10) != 0) {
        perror("failed to truncate pfile");
        exit(-1);
    }

    if (storage_rm_file(&st, fid) != 0) {
        perror("failed to remove pfile");
        exit(-1);
    }

    storage_release(&st);
    exit(0);
}
Beispiel #2
0
mp_stat_ret_t *mp_stat_1_svc(mp_stat_arg_t * args, struct svc_req * req) {
    static mp_stat_ret_t ret;
    storage_t *st = 0;
    sstat_t sstat;
    DEBUG_FUNCTION;

    START_PROFILING(stat);

    ret.status = MP_FAILURE;
    if ((st = storaged_lookup(args->cid, args->sid)) == 0) {
        ret.mp_stat_ret_t_u.error = errno;
        goto out;
    }
    if (storage_stat(st, &sstat) != 0) {
        ret.mp_stat_ret_t_u.error = errno;
        goto out;
    }
    ret.mp_stat_ret_t_u.sstat.size = sstat.size;
    ret.mp_stat_ret_t_u.sstat.free = sstat.free;
    ret.status = MP_SUCCESS;
out:
    STOP_PROFILING(stat);
    return &ret;
}