/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the files COPYING and Copyright.html. COPYING can be found at the root * * of the source code distribution tree; Copyright.html can be found at the * * root level of an installed copy of the electronic HDF5 document set and * * is linked from the top-level documents page. It can also be found at * * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /****************/ /* Module Setup */ /****************/ #define H5D_PACKAGE /*suppress error about including H5Dpkg */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5D__init_pub_interface /***********/ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5VLprivate.h" /* VOL plugins */ /****************/ /* Local Macros */ /****************/ /******************/ /* Local Typedefs */ /******************/ /********************/ /* Local Prototypes */ /********************/ /*********************/ /* Package Variables */ /*********************/ /* Declare extern the free list to manage blocks of VL data */ H5FL_BLK_EXTERN(vlen_vl_buf); /* Declare extern the free list to manage other blocks of VL data */ H5FL_BLK_EXTERN(vlen_fl_buf); /*****************************/ /* Library Private Variables */ /*****************************/ /*******************/ /* Local Variables */ /*******************/ /*-------------------------------------------------------------------------- NAME H5D__init_pub_interface -- Initialize interface-specific information USAGE herr_t H5D__init_pub_interface() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. (Just calls H5D_init() currently). --------------------------------------------------------------------------*/ static herr_t H5D__init_pub_interface(void) { FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5D_init()) #if 0 herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Initialize the atom group for the dataset IDs */ if(H5I_register_type(H5I_DATASET, (size_t)H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, NULL, (H5I_free2_t)H5D_close_dataset)= 0) *size = vlen_bufsize.size; done: if(vlen_bufsize.fspace_id > 0 && H5I_dec_ref(vlen_bufsize.fspace_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") if(vlen_bufsize.mspace_id > 0 && H5I_dec_ref(vlen_bufsize.mspace_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); if(vlen_bufsize.xfer_pid > 0 && H5I_dec_ref(vlen_bufsize.xfer_pid) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref count on property list") FUNC_LEAVE_API(ret_value) } /* end H5Dvlen_get_buf_size() */ /*------------------------------------------------------------------------- * Function: H5Dset_extent * * Purpose: Modifies the dimensions of a dataset. * Can change to a smaller dimension. * * Return: Non-negative on success, negative on failure * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * April 9, 2002 * *------------------------------------------------------------------------- */ herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]) { H5VL_t *vol_plugin; void *dset; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); if(!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the dataset object */ if(NULL == (dset = (void *)H5I_object(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* set the extent through the VOL */ if((ret_value = H5VL_dataset_set_extent(dset, vol_plugin, size, H5AC_dxpl_id, H5_EVENT_QUEUE_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") done: FUNC_LEAVE_API(ret_value) } /* end H5Dset_extent() */ /*------------------------------------------------------------------------- * Function: H5D_close_dataset * * Purpose: Called when the ref count reaches zero on the dataset_id * * Return: Success: Non-negative * * Failure: Negative * * Programmer: Mohamad Chaarawi * June 2012 * *------------------------------------------------------------------------- */ herr_t H5D_close_dataset(void *dset, H5VL_t *vol_plugin) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Close the dataset through the VOL*/ if((ret_value = H5VL_dataset_close(dset, vol_plugin, H5AC_dxpl_id, H5_EVENT_QUEUE_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_close_dataset() */