client/src/unifycr.c
static int unifycr_init_structures()
{
    int i;
    for (i = 0; i < unifycr_max_files; i++) {
        /* indicate that file id is not in use by setting flag to 0 */
        unifycr_filelist[i].in_use = 0;

        /* set pointer to array of chunkmeta data structures */
        unifycr_filemeta_t* filemeta = &unifycr_filemetas[i];

        unifycr_chunkmeta_t* chunkmetas;
        if (!unifycr_use_spillover)
        	chunkmetas = &(unifycr_chunkmetas[unifycr_max_chunks * i]);
        else
        	chunkmetas = &(unifycr_chunkmetas[(unifycr_max_chunks + \
        			unifycr_spillover_max_chunks) * i]);
        filemeta->chunk_meta = chunkmetas;
    }

    unifycr_stack_init(free_fid_stack, unifycr_max_files);

    unifycr_stack_init(free_chunk_stack, unifycr_max_chunks);

    if (unifycr_use_spillover) {
        unifycr_stack_init(free_spillchunk_stack, unifycr_spillover_max_chunks);
    }

    if (fs_type == UNIFYCR_LOG) {
    	*(unifycr_indices.ptr_num_entries) = 0;
    	*(unifycr_fattrs.ptr_num_entries) = 0;
    }
    debug("Meta-stacks initialized!\n");

    return UNIFYCR_SUCCESS;
}
/* initialize data structures for first use */
initialize data structures for first use
initialize data structures for first use
static int unifycr_init_structures()
{
    int i;
    for (i = 0; i < unifycr_max_files; i++) {
        unifycr_filelist[i].in_use = 0;
        unifycr_filemeta_t* filemeta = &unifycr_filemetas[i];
        unifycr_chunkmeta_t* chunkmetas;
        if (!unifycr_use_spillover)
        	chunkmetas = &(unifycr_chunkmetas[unifycr_max_chunks * i]);
        else
        	chunkmetas = &(unifycr_chunkmetas[(unifycr_max_chunks + \
        			unifycr_spillover_max_chunks) * i]);
        filemeta->chunk_meta = chunkmetas;
    }
    unifycr_stack_init(free_fid_stack, unifycr_max_files);
    unifycr_stack_init(free_chunk_stack, unifycr_max_chunks);
    if (unifycr_use_spillover) {
        unifycr_stack_init(free_spillchunk_stack, unifycr_spillover_max_chunks);
    }
    if (fs_type == UNIFYCR_LOG) {
    	*(unifycr_indices.ptr_num_entries) = 0;
    	*(unifycr_fattrs.ptr_num_entries) = 0;
    }
    debug("Meta-stacks initialized!\n");
    return UNIFYCR_SUCCESS;
}
static int unifycr_init_structures ( ) { int i ; for ( i = 0 ; i < unifycr_max_files ; i ++ ) { unifycr_filelist [ i ] . in_use = 0 ; unifycr_filemeta_t * filemeta = & unifycr_filemetas [ i ] ; unifycr_chunkmeta_t * chunkmetas ; if ( ! unifycr_use_spillover ) chunkmetas = & ( unifycr_chunkmetas [ unifycr_max_chunks * i ] ) ; else chunkmetas = & ( unifycr_chunkmetas [ ( unifycr_max_chunks + unifycr_spillover_max_chunks ) * i ] ) ; filemeta -> chunk_meta = chunkmetas ; } unifycr_stack_init ( free_fid_stack , unifycr_max_files ) ; unifycr_stack_init ( free_chunk_stack , unifycr_max_chunks ) ; if ( unifycr_use_spillover ) { unifycr_stack_init ( free_spillchunk_stack , unifycr_spillover_max_chunks ) ; } if ( fs_type == UNIFYCR_LOG ) { * ( unifycr_indices . ptr_num_entries ) = 0 ; * ( unifycr_fattrs . ptr_num_entries ) = 0 ; } debug ( " \n " ) ; return UNIFYCR_SUCCESS ; }
initialize data structures for first use
initialize data structures for first use
/* indicate that file id is not in use by setting flag to 0 */ /* set pointer to array of chunkmeta data structures */