How to get the fapl of a file in a VOL file_close callback.

Hi Everyone,
I'm trying to create a VOL where all the calls are shipped to a server
process which will process them remotely.
What I want is that only rank 0, of the MPI_COMM associated with my
fapl, forwards the requests to the server.

The problem is that in myvol_file_close callback I cannot retrieve the
VOL info starting from the "void *file" input parameter. Info needed
for determine the rank.
What I'm doing is:
1 - Get the file id from the void *file.
2 - Get the fapl using the function H5Fget_access_plist(file_id).
3 - Finally, get the VOL info using H5Pget_vol_info(fapl).

What is giving me problems is step 2, which seems to trigger the
myvol_file_get callbak. Function that I'm trying to implement and
which is giving me troubles. In fact, looking at the callback of the
native VOL I found a lot of private--not part of the public API--
types and functions which I cannot use because I'm coding my VOL
externally at the library. How could I proceed?

I start thinking that I should implement my VOL e and compile it with
the HDF5 library itself. Which is the suggested way?

Here the code involved:
typedef struct H5VL_myvol_t {
    MPI_Comm comm; /*communicator */
    MPI_Info info; /*file information */
} H5VL_myvol_t;

/* Fuction made public to final user code */
herr_t H5Pset_fapl_myvol(hid_t fapl_id, MPI_Comm comm, MPI_Info info) {
    herr_t ret_value;

    /* Initialize driver specific properties */
    H5VL_myvol_t fa;

    fa.comm = comm;
    fa.info = info;

    if ( (ret_value = H5Pset_vol(fapl_id, id, &fa)) < 0) {
      _ERROR_("Error: Impossible to set myvol at the fapl\n");
    }

  return ret_value;
} /* end H5Pset_fapl_myvol() */

static herr_t myvol_file_close(void *file, hid_t dxpl_id, void **req) {
  hid_t fapl;
  herr_t ret_value = 0;
  H5VL_myvol_t *fa = NULL;

  /* Retrieve the file_id */
  hid_t file_id = (hid_t) file;

  /* Retrieve the fapl */
  if ( (fapl = H5Fget_access_plist(file_id) ) < 0 ) {
    printf(MSG_ERR_GET_FAPL);
    return -1;
  }

  /* Retrieve the VOL info */
  if(NULL == ( fa = (H5VL_myvolvol_t *) H5Pget_vol_info(fapl)) ) {
    printf(MSG_ERR_GET_VOL_INFO);
    return NULL;
  }

  int mpi_rank, mpi_size;
  MPI_Comm_size(fa->comm, &mpi_size);
  MPI_Comm_rank(fa->comm, &mpi_rank);

  if ( mpi_rank == 0 ) {
    ...
  }
  ...
  return ret_value;
} /* end myvol_file_close() */

Thanks,
Nicola.

···

--
Nicola Cadenelli
Phone (IT) +39 334 6550271
Office (DE) +49 2461 6196 475
Skype: nicolacdnll