Question about the design of H5Pget_file_image

Hi there,

I’m studying the API for HDF5 file image operations and I am a bit puzzled by H5Pget_file_image which retrieves a copy of the file image designated for a VFD to use as the initial contents of a file.

H5Pget_file_image wants to allocate the memory for the file image itself, either with malloc or with some function provided by the application using H5Pset_file_image_callbacks. I find this design needlessly complex (perhaps due to my ignorance). Why couldn’t H5Pget_file_image let the application do the allocation just like, say, H5Fget_file_image?

Thanks in advance,
Andrea

···

--
Andrea Bedini
@andreabedini, http://www.andreabedini.com

See the impact of my research at https://impactstory.org/AndreaBedini
use https://keybase.io/andreabedini to send me encrypted messages
Key fingerprint = 17D5 FB49 FA18 A068 CF53 C5C2 9503 64C1 B2D5 9591

Hi Andrea,

We will need review the initial proposals for the feature to answer your question. Stay tuned.

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Feb 23, 2016, at 1:37 AM, Andrea Bedini <andrea@andreabedini.com<mailto:andrea@andreabedini.com>> wrote:

Hi there,

I’m studying the API for HDF5 file image operations and I am a bit puzzled by H5Pget_file_image which retrieves a copy of the file image designated for a VFD to use as the initial contents of a file.

H5Pget_file_image wants to allocate the memory for the file image itself, either with malloc or with some function provided by the application using H5Pset_file_image_callbacks. I find this design needlessly complex (perhaps due to my ignorance). Why couldn’t H5Pget_file_image let the application do the allocation just like, say, H5Fget_file_image?

Thanks in advance,
Andrea

--
Andrea Bedini
@andreabedini, http://www.andreabedini.com<http://www.andreabedini.com/>

See the impact of my research at https://impactstory.org/AndreaBedini
use https://keybase.io/andreabedini to send me encrypted messages
Key fingerprint = 17D5 FB49 FA18 A068 CF53 C5C2 9503 64C1 B2D5 9591

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Hi Andrea,

···

On Feb 23, 2016, at 1:37 AM, Andrea Bedini <andrea@andreabedini.com<mailto:andrea@andreabedini.com>> wrote:

Hi there,

I’m studying the API for HDF5 file image operations and I am a bit puzzled by H5Pget_file_image which retrieves a copy of the file image designated for a VFD to use as the initial contents of a file.

H5Pget_file_image wants to allocate the memory for the file image itself, either with malloc or with some function provided by the application using H5Pset_file_image_callbacks. I find this design needlessly complex (perhaps due to my ignorance). Why couldn’t H5Pget_file_image let the application do the allocation just like, say,H5Fget_file_image?

H5Fget_file_image has to be called twice. First, to retrieve the size of the buffer needed, then to retrieve the file itself.

H5Pget_file_image is called only once.

You are correct, the design is complex. I guess the thinking was to be helpful :wink:

Elena

Thanks in advance,
Andrea

--
Andrea Bedini
@andreabedini, http://www.andreabedini.com<http://www.andreabedini.com/>

See the impact of my research at https://impactstory.org/AndreaBedini
use https://keybase.io/andreabedini to send me encrypted messages
Key fingerprint = 17D5 FB49 FA18 A068 CF53 C5C2 9503 64C1 B2D5 9591

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5