Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement or remove unifycr_get_chunk_list() #57

Closed
nedbass opened this issue Dec 22, 2017 · 1 comment
Closed

Implement or remove unifycr_get_chunk_list() #57

nedbass opened this issue Dec 22, 2017 · 1 comment

Comments

@nedbass
Copy link
Member

nedbass commented Dec 22, 2017

Commit 75543ec removed the commented out code from unifycr_get_chunk_list() shown below. This left a function stub behind that should be fully implemented or removed if it's not needed.

 /* get a list of chunks for a given file (useful for RDMA, etc.) */
 chunk_list_t *unifycr_get_chunk_list(char *path)
 {
#if 0
    if (unifycr_intercept_path(path)) {
        int i = 0;
        chunk_list_t *chunk_list = NULL;
        chunk_list_t *chunk_list_elem;

        /* get the file id for this file descriptor */
        /* Rag: We decided to use the path instead.. Can add flexibility to support both */
        //int fid = unifycr_get_fid_from_fd(fd);
        int fid = unifycr_get_fid_from_path(path);
        if (fid < 0) {
            errno = EACCES;
            return NULL;
        }

        /* get meta data for this file */
        unifycr_filemeta_t *meta = unifycr_get_meta_from_fid(fid);
        if (meta) {

            while (i < meta->chunks) {
                chunk_list_elem = (chunk_list_t *)malloc(sizeof(chunk_list_t));

                /* get the chunk id for the i-th chunk and
                 * add it to the chunk_list */
                unifycr_chunkmeta_t *chunk_meta = &(meta->chunk_meta[i]);
                chunk_list_elem->chunk_id = chunk_meta->id;
                chunk_list_elem->location = chunk_meta->location;

                if (chunk_meta->location == CHUNK_LOCATION_MEMFS) {
                    /* update the list_elem with the memory address of this chunk */
                    chunk_list_elem->chunk_offset = unifycr_compute_chunk_buf(meta, chunk_meta->id,
                                                    0);
                    chunk_list_elem->spillover_offset = 0;
                } else if (chunk_meta->location == CHUNK_LOCATION_SPILLOVER) {
                    /* update the list_elem with the offset of this chunk in the spillover file*/
                    chunk_list_elem->spillover_offset = unifycr_compute_spill_offset(meta,
                                                        chunk_meta->id, 0);
                    chunk_list_elem->chunk_offset = NULL;
                } else {
                    /*TODO: Handle the container case.*/
                }

                /* currently using macros from utlist.h to
                 * handle link-list operations */
                LL_APPEND(chunk_list, chunk_list_elem);
                i++;
            }
            return chunk_list;
        } else {
            return NULL;
        }
    } else {
        /* file not managed by UNIFYCR */
        errno = EACCES;
        return NULL;
    }
#endif
    return NULL;
 }
@adammoody
Copy link
Collaborator

This will be dropped with 3fc6eb2

@CamStan CamStan closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants