diff options
48 files changed, 1457 insertions, 1712 deletions
@@ -871,13 +871,12 @@ ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c -./src/H5Ofphdf5.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Onull.c +./src/H5Opkg.h ./src/H5Opline.c -./src/H5Oplist.c ./src/H5Oprivate.h ./src/H5Opublic.h ./src/H5Osdspace.c diff --git a/config/freebsd b/config/freebsd index 0b91659..f35aa5b 100644 --- a/config/freebsd +++ b/config/freebsd @@ -14,6 +14,10 @@ fi # Architecture-specific flags ARCH= +# Add "_POSIX_C_SOURCE" define to cpp flags, to quiet warnings +# from /usr/include/sys/cdefs.h +CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=1" + # Omit frame pointer for optimized code? NOFP=${NOFP:=-fomit-frame-pointer} diff --git a/config/gnu-flags b/config/gnu-flags index ebdb0c5..b5e9a48 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -131,7 +131,7 @@ case "$cc_vendor-$cc_version" in CFLAGS="$CFLAGS $ARCH -ansi -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline" # Production - PROD_CFLAGS="-O2 $NOFP -finline-functions" + PROD_CFLAGS="-O3 $NOFP" PROD_CPPFLAGS= # Debug @@ -1,16 +1,16 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ - -/* $Id$ */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* private headers */ #include "H5private.h" /*library */ @@ -1,33 +1,33 @@ -/**************************************************************************** -* NCSA HDF * -* Software Development Group * -* National Center for Supercomputing Applications * -* University of Illinois at Urbana-Champaign * -* 605 E. Springfield, Champaign IL 61820 * -* * -* For conditions of distribution and use, see the accompanying * -* hdf/COPYING file. * -* * -****************************************************************************/ - -/* $Id$ */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define H5A_PACKAGE /*suppress error about including H5Apkg */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ /* Private header files */ #include "H5private.h" /* Generic Functions */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Apkg.h" /* Attributes */ #include "H5Bprivate.h" /* B-tree subclass names */ #include "H5Dprivate.h" /* Datasets */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Tprivate.h" /* Datatypes */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ #include "H5Oprivate.h" /* Object Headers */ -#include "H5Spkg.h" /* Data-space functions */ -#include "H5Apkg.h" /* Attributes */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5Tprivate.h" /* Datatypes */ #define PABLO_MASK H5A_mask @@ -251,8 +251,10 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry"); /* Compute the internal sizes */ - attr->dt_size=(H5O_DTYPE[0].raw_size)(attr->ent.file,type); - attr->ds_size=(H5O_SDSPACE[0].raw_size)(attr->ent.file,&(space->extent.u.simple)); + attr->dt_size=H5O_raw_size(H5O_DTYPE_ID,attr->ent.file,type); + assert(attr->dt_size>0); + attr->ds_size=H5O_raw_size(H5O_SDSPACE_ID,attr->ent.file,&(space->extent.u.simple)); + assert(attr->ds_size>0); H5_ASSIGN_OVERFLOW(attr->data_size,H5S_get_simple_extent_npoints(attr->ds)*H5T_get_size(attr->dt),hssize_t,size_t); /* Hold the symbol table entry (and file) open */ @@ -262,22 +264,22 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, /* Read in the existing attributes to check for duplicates */ seq=0; - while(H5O_read(&(attr->ent), H5O_ATTR, seq, &found_attr, dxpl_id)!=NULL) { + while(H5O_read(&(attr->ent), H5O_ATTR_ID, seq, &found_attr, dxpl_id)!=NULL) { /* * Compare found attribute name to new attribute name reject creation * if names are the same. */ if(HDstrcmp(found_attr.name,attr->name)==0) { - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, FAIL, "attribute already exists"); } - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); seq++; } H5E_clear (); /* Create the attribute message and save the attribute index */ - if (H5O_modify(&(attr->ent), H5O_ATTR, H5O_NEW_MESG, 0, 1, attr, dxpl_id) < 0) + if (H5O_modify(&(attr->ent), H5O_ATTR_ID, H5O_NEW_MESG, 0, 1, attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages"); /* Register the new attribute and get an ID for it */ @@ -331,17 +333,17 @@ H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id) /* Look up the attribute for the object */ i=0; - while(H5O_read(ent, H5O_ATTR, i, &found_attr, dxpl_id)!=NULL) { + while(H5O_read(ent, H5O_ATTR_ID, i, &found_attr, dxpl_id)!=NULL) { /* * Compare found attribute name to new attribute name reject creation * if names are the same. */ if(HDstrcmp(found_attr.name,name)==0) { - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); ret_value = i; break; } - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); i++; } H5E_clear (); @@ -497,7 +499,7 @@ H5A_open(H5G_entry_t *ent, unsigned idx, hid_t dxpl_id) /* Read in attribute with H5O_read() */ H5_CHECK_OVERFLOW(idx,unsigned,int); - if (NULL==(attr=H5O_read(ent, H5O_ATTR, (int)idx, attr, dxpl_id))) + if (NULL==(attr=H5O_read(ent, H5O_ATTR_ID, (int)idx, attr, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from dataset header"); attr->initialized=1; @@ -652,7 +654,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) /* Modify the attribute data */ attr->data=tconv_buf; /* Set the data pointer temporarily */ - if (H5O_modify(&(attr->ent), H5O_ATTR, idx, 0, 1, attr, dxpl_id) < 0) + if (H5O_modify(&(attr->ent), H5O_ATTR_ID, idx, 0, 1, attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages"); @@ -1113,7 +1115,7 @@ H5Aget_num_attrs(hid_t loc_id) } /* Look up the attribute for the object */ - ret_value=H5O_count(ent, H5O_ATTR, H5AC_ind_dxpl_id); + ret_value=H5O_count(ent, H5O_ATTR_ID, H5AC_ind_dxpl_id); done: FUNC_LEAVE_API(ret_value); @@ -1197,7 +1199,7 @@ H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t d /* Read in the existing attributes to check for duplicates */ seq=0; - while(H5O_read(ent, H5O_ATTR, seq, found_attr, dxpl_id)!=NULL) { + while(H5O_read(ent, H5O_ATTR_ID, seq, found_attr, dxpl_id)!=NULL) { /* * Compare found attribute name. */ @@ -1205,7 +1207,7 @@ H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t d idx = seq; break; } - H5O_reset (H5O_ATTR, found_attr); + H5O_reset (H5O_ATTR_ID, found_attr); seq++; } @@ -1224,7 +1226,7 @@ H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t d found_attr->initialized=TRUE; /* Modify the attribute message */ - if (H5O_modify(ent, H5O_ATTR, idx, 0, 1, found_attr, dxpl_id) < 0) + if (H5O_modify(ent, H5O_ATTR_ID, idx, 0, 1, found_attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages"); /* Close the attribute */ @@ -1303,17 +1305,17 @@ H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, void *op_data) * reasonable. */ idx = attr_num ? (int)*attr_num : 0; - if(idx<H5O_count(ent, H5O_ATTR, H5AC_dxpl_id)) { - while(H5O_read(ent, H5O_ATTR, idx++, &found_attr, H5AC_dxpl_id)!=NULL) { + if(idx<H5O_count(ent, H5O_ATTR_ID, H5AC_dxpl_id)) { + while(H5O_read(ent, H5O_ATTR_ID, idx++, &found_attr, H5AC_dxpl_id)!=NULL) { /* * Compare found attribute name to new attribute name reject * creation if names are the same. */ if((ret_value=(op)(loc_id,found_attr.name,op_data))!=0) { - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); break; } - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); } H5E_clear (); } @@ -1372,17 +1374,17 @@ H5Adelete(hid_t loc_id, const char *name) /* Look up the attribute for the object */ idx=0; - while(H5O_read(ent, H5O_ATTR, idx, &found_attr, H5AC_dxpl_id)!=NULL) { + while(H5O_read(ent, H5O_ATTR_ID, idx, &found_attr, H5AC_dxpl_id)!=NULL) { /* * Compare found attribute name to new attribute name reject * creation if names are the same. */ if(HDstrcmp(found_attr.name,name)==0) { - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); found = idx; break; } - H5O_reset (H5O_ATTR, &found_attr); + H5O_reset (H5O_ATTR_ID, &found_attr); idx++; } H5E_clear (); @@ -1390,7 +1392,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "attribute not found"); /* Delete the attribute from the location */ - if ((ret_value=H5O_remove(ent, H5O_ATTR, found, H5AC_dxpl_id)) < 0) + if ((ret_value=H5O_remove(ent, H5O_ATTR_ID, found, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute header message"); done: @@ -1,16 +1,16 @@ -/**************************************************************************** -* NCSA HDF * -* Software Development Group * -* National Center for Supercomputing Applications * -* University of Illinois at Urbana-Champaign * -* 605 E. Springfield, Champaign IL 61820 * -* * -* For conditions of distribution and use, see the accompanying * -* hdf/COPYING file. * -* * -****************************************************************************/ - -/* $Id$ */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ @@ -488,7 +488,7 @@ H5D_crt_copy(hid_t new_plist_id, hid_t old_plist_id, void UNUSED *copy_data) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Make copies of fill value, external file list, and data pipeline */ - if(src_fill.buf && (NULL==H5O_copy(H5O_FILL, &src_fill, &dst_fill))) { + if(src_fill.buf && (NULL==H5O_copy(H5O_FILL_ID, &src_fill, &dst_fill))) { HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value"); } else if (!src_fill.buf) { @@ -496,9 +496,9 @@ H5D_crt_copy(hid_t new_plist_id, hid_t old_plist_id, void UNUSED *copy_data) dst_fill.size = src_fill.size; } HDmemset(&dst_efl,0,sizeof(H5O_efl_t)); - if(NULL==H5O_copy(H5O_EFL, &src_efl, &dst_efl)) + if(NULL==H5O_copy(H5O_EFL_ID, &src_efl, &dst_efl)) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list"); - if(NULL==H5O_copy(H5O_PLINE, &src_pline, &dst_pline)) + if(NULL==H5O_copy(H5O_PLINE_ID, &src_pline, &dst_pline)) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline"); /* Set the fill value, external file list, and data pipeline property @@ -559,9 +559,9 @@ H5D_crt_close(hid_t dcpl_id, void UNUSED *close_data) /* Clean up any values set for the fill-value, external file-list and * data pipeline */ - H5O_reset(H5O_FILL, &fill); - H5O_reset(H5O_EFL, &efl); - H5O_reset(H5O_PLINE, &pline); + H5O_reset(H5O_FILL_ID, &fill); + H5O_reset(H5O_EFL_ID, &efl); + H5O_reset(H5O_PLINE_ID, &pline); done: FUNC_LEAVE_NOAPI(ret_value); @@ -1531,7 +1531,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p H5O_fill_new_t fill = { NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_ALLOC, TRUE }; H5D_fill_value_t fill_status; - H5O_t *oh=NULL; /* Pointer to dataset's object header */ + struct H5O_t *oh=NULL; /* Pointer to dataset's object header */ /* return code */ herr_t ret_value = SUCCEED; @@ -1589,7 +1589,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); if (fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) { - if (H5O_copy(H5O_FILL, fill_prop, &fill) == NULL) + if (H5O_copy(H5O_FILL_ID, fill_prop, &fill) == NULL) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to copy fill value"); if (fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(&fill, type, dxpl_id) < 0) @@ -1611,20 +1611,20 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to create dataset"); /* Write new fill value message */ - if (H5O_append(file, dxpl_id, oh, H5O_FILL_NEW, H5O_FLAG_CONSTANT, &fill) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_FLAG_CONSTANT, &fill) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message"); /* If there is valid information for the old fill value struct, update it */ if (fill.buf) { /* Clear any previous values */ - H5O_reset(H5O_FILL, fill_prop); + H5O_reset(H5O_FILL_ID, fill_prop); /* Copy new fill value information to old fill value struct */ - if(H5O_copy(H5O_FILL, &fill, fill_prop) == NULL) + if(H5O_copy(H5O_FILL_ID, &fill, fill_prop) == NULL) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL,"unable to copy fill value"); /* Write old fill value */ - if (fill_prop->buf && H5O_append(file, dxpl_id, oh, H5O_FILL, H5O_FLAG_CONSTANT, fill_prop) < 0) + if (fill_prop->buf && H5O_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_FLAG_CONSTANT, fill_prop) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message"); /* Update dataset creation property */ @@ -1633,7 +1633,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p } /* end if */ /* Update the type and space header messages */ - if (H5O_append(file, dxpl_id, oh, H5O_DTYPE, H5O_FLAG_CONSTANT | H5O_FLAG_SHARED, type) < 0 || + if (H5O_append(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_FLAG_CONSTANT | H5O_FLAG_SHARED, type) < 0 || H5S_append(file, dxpl_id, oh, space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update type or space header messages"); @@ -1645,7 +1645,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve pipeline filter"); if (pline.nfilters > 0 && - H5O_append(file, dxpl_id, oh, H5O_PLINE, H5O_FLAG_CONSTANT, &pline) < 0) + H5O_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_FLAG_CONSTANT, &pline) < 0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message"); } /* end if */ @@ -1681,14 +1681,14 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p efl->slot[i].name_offset = offset; } - if (H5O_append(file, dxpl_id, oh, H5O_EFL, H5O_FLAG_CONSTANT, efl) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_EFL_ID, H5O_FLAG_CONSTANT, efl) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message"); } /* Update layout message */ /* (Don't make layout message constant yet, since space may not be allocated) */ /* Note: this is relying on H5D_alloc_storage not calling H5O_modify during dataset creation */ - if (H5D_COMPACT != layout->type && H5O_append(file, dxpl_id, oh, H5O_LAYOUT, 0, layout) < 0) + if (H5D_COMPACT != layout->type && H5O_append(file, dxpl_id, oh, H5O_LAYOUT_ID, 0, layout) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout"); #ifdef H5O_ENABLE_BOGUS @@ -2047,14 +2047,14 @@ H5D_isa(H5G_entry_t *ent, hid_t dxpl_id) assert(ent); /* Data type */ - if ((exists=H5O_exists(ent, H5O_DTYPE, 0, dxpl_id))<0) { + if ((exists=H5O_exists(ent, H5O_DTYPE_ID, 0, dxpl_id))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header"); } else if (!exists) { HGOTO_DONE(FALSE); } /* Layout */ - if ((exists=H5O_exists(ent, H5O_LAYOUT, 0, dxpl_id))<0) { + if ((exists=H5O_exists(ent, H5O_LAYOUT_ID, 0, dxpl_id))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header"); } else if (!exists) { HGOTO_DONE(FALSE); @@ -2185,7 +2185,7 @@ H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open"); /* Get the type and space */ - if (NULL==(dataset->type=H5O_read(&(dataset->ent), H5O_DTYPE, 0, NULL, dxpl_id))) + if (NULL==(dataset->type=H5O_read(&(dataset->ent), H5O_DTYPE_ID, 0, NULL, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to load type info from dataset header"); if (NULL==(dataset->space=H5S_read(&(dataset->ent),dxpl_id))) @@ -2196,7 +2196,7 @@ H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get dataset creation property list"); /* Get the optional filters message */ - if(NULL == H5O_read(&(dataset->ent), H5O_PLINE, 0, &pline, dxpl_id)) { + if(NULL == H5O_read(&(dataset->ent), H5O_PLINE_ID, 0, &pline, dxpl_id)) { H5E_clear(); HDmemset(&pline, 0, sizeof(pline)); } @@ -2213,7 +2213,7 @@ H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) * values are copied to the dataset create plist so the user can query * them. */ - if (NULL==H5O_read(&(dataset->ent), H5O_LAYOUT, 0, &(dataset->layout), dxpl_id)) + if (NULL==H5O_read(&(dataset->ent), H5O_LAYOUT_ID, 0, &(dataset->layout), dxpl_id)) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to read data layout message"); switch (dataset->layout.type) { case H5D_CONTIGUOUS: @@ -2254,10 +2254,10 @@ H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) /* Retrieve & release the previous fill-value settings */ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't get fill value"); - H5O_reset(H5O_FILL, fill_prop); + H5O_reset(H5O_FILL_ID, fill_prop); /* Get the new fill value message */ - if(NULL == H5O_read(&(dataset->ent), H5O_FILL_NEW, 0, &fill, dxpl_id)) { + if(NULL == H5O_read(&(dataset->ent), H5O_FILL_NEW_ID, 0, &fill, dxpl_id)) { H5E_clear(); HDmemset(&fill, 0, sizeof(fill)); @@ -2280,12 +2280,12 @@ H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) } /* end switch */ } /* end if */ if(fill.fill_defined) { - if(NULL==H5O_copy(H5O_FILL, &fill, fill_prop)) + if(NULL==H5O_copy(H5O_FILL_ID, &fill, fill_prop)) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy fill value"); } else { /* For compatibility with v1.4. Retrieve the old fill value message. * If size is 0, make it -1 for undefined. */ - if(NULL == H5O_read(&(dataset->ent), H5O_FILL, 0, fill_prop, dxpl_id)) { + if(NULL == H5O_read(&(dataset->ent), H5O_FILL_ID, 0, fill_prop, dxpl_id)) { H5E_clear(); HDmemset(fill_prop, 0, sizeof(H5O_fill_t)); } @@ -2309,7 +2309,7 @@ H5D_open_oid(H5G_entry_t *ent, hid_t dxpl_id) * also undefined when space allocate time is H5D_ALLOC_TIME_LATE. */ if( !H5F_addr_defined(dataset->layout.addr)) { HDmemset(&dataset->efl,0,sizeof(H5O_efl_t)); - if(NULL != H5O_read(&(dataset->ent), H5O_EFL, 0, &dataset->efl, dxpl_id)) + if(NULL != H5O_read(&(dataset->ent), H5O_EFL_ID, 0, &dataset->efl, dxpl_id)) if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->efl) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set external file list"); } @@ -2385,7 +2385,7 @@ H5D_close(H5D_t *dataset) /* Update header message of layout for compact dataset. */ if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty) { - if(H5O_modify(&(dataset->ent), H5O_LAYOUT, 0, 0, 1, &(dataset->layout), H5AC_dxpl_id)<0) + if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->layout), H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout message"); dataset->layout.dirty = FALSE; } /* end if */ @@ -3496,7 +3496,7 @@ H5D_alloc_storage (H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_allo * (this is only for forward compatibility). */ if(time_alloc!=H5D_ALLOC_CREATE) - if (H5O_modify (&(dset->ent), H5O_LAYOUT, 0, H5O_FLAG_CONSTANT, update_time, &(dset->layout), dxpl_id) < 0) + if (H5O_modify (&(dset->ent), H5O_LAYOUT_ID, 0, H5O_FLAG_CONSTANT, update_time, &(dset->layout), dxpl_id) < 0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout message"); } /* end if */ } /* end if */ @@ -4467,7 +4467,7 @@ H5D_flush(H5F_t *f, hid_t dxpl_id) if(NULL==(dataset=H5I_object_verify(id_list[j], H5I_DATASET))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset object"); if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty) - if(H5O_modify(&(dataset->ent), H5O_LAYOUT, 0, 0, 1, &(dataset->layout), dxpl_id)<0) + if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->layout), dxpl_id)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message"); dataset->layout.dirty = FALSE; } diff --git a/src/H5Distore.c b/src/H5Distore.c index 4974e7c..f2e7eb8 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1,8 +1,18 @@ -/* - * Copyright (C) 1997-2001 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, October 8, 1997 * * Purpose: Indexed (chunked) I/O functions. The logical @@ -983,8 +993,8 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res /* Reset, but do not free or removed from list */ if (reset) { point_of_no_return = FALSE; - ent->layout = H5O_free(H5O_LAYOUT, ent->layout); - ent->pline = H5O_free(H5O_PLINE, ent->pline); + ent->layout = H5O_free(H5O_LAYOUT_ID, ent->layout); + ent->pline = H5O_free(H5O_PLINE_ID, ent->pline); if (buf==ent->chunk) buf = NULL; if(ent->chunk!=NULL) ent->chunk = H5MM_xfree(ent->chunk); @@ -1002,8 +1012,8 @@ done: * list. */ if (ret_value<0 && point_of_no_return) { - ent->layout = H5O_free(H5O_LAYOUT, ent->layout); - ent->pline = H5O_free(H5O_PLINE, ent->pline); + ent->layout = H5O_free(H5O_LAYOUT_ID, ent->layout); + ent->pline = H5O_free(H5O_PLINE_ID, ent->pline); if(ent->chunk) ent->chunk = H5MM_xfree(ent->chunk); } @@ -1049,8 +1059,8 @@ H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) } else { /* Reset, but do not free or remove from list */ - ent->layout = H5O_free(H5O_LAYOUT, ent->layout); - ent->pline = H5O_free(H5O_PLINE, ent->pline); + ent->layout = H5O_free(H5O_LAYOUT_ID, ent->layout); + ent->pline = H5O_free(H5O_PLINE_ID, ent->pline); if(ent->chunk != NULL) ent->chunk = H5MM_xfree(ent->chunk); } @@ -1483,8 +1493,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->dirty = FALSE; ent->chunk_size = chunk_size; ent->alloc_size = chunk_size; - ent->layout = H5O_copy(H5O_LAYOUT, layout, NULL); - ent->pline = H5O_copy(H5O_PLINE, pline, NULL); + ent->layout = H5O_copy(H5O_LAYOUT_ID, layout, NULL); + ent->pline = H5O_copy(H5O_PLINE_ID, pline, NULL); for (u=0; u<layout->ndims; u++) ent->offset[u] = offset[u]; ent->rd_count = chunk_size; @@ -1625,8 +1635,8 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HDmemset (&x, 0, sizeof x); x.dirty = TRUE; - x.layout = H5O_copy (H5O_LAYOUT, layout, NULL); - x.pline = H5O_copy (H5O_PLINE, pline, NULL); + x.layout = H5O_copy (H5O_LAYOUT_ID, layout, NULL); + x.pline = H5O_copy (H5O_PLINE_ID, pline, NULL); for (u=0, tempchunk_size=1; u<layout->ndims; u++) { x.offset[u] = offset[u]; tempchunk_size *= layout->dim[u]; diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 4974e7c..f2e7eb8 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1,8 +1,18 @@ -/* - * Copyright (C) 1997-2001 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, October 8, 1997 * * Purpose: Indexed (chunked) I/O functions. The logical @@ -983,8 +993,8 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res /* Reset, but do not free or removed from list */ if (reset) { point_of_no_return = FALSE; - ent->layout = H5O_free(H5O_LAYOUT, ent->layout); - ent->pline = H5O_free(H5O_PLINE, ent->pline); + ent->layout = H5O_free(H5O_LAYOUT_ID, ent->layout); + ent->pline = H5O_free(H5O_PLINE_ID, ent->pline); if (buf==ent->chunk) buf = NULL; if(ent->chunk!=NULL) ent->chunk = H5MM_xfree(ent->chunk); @@ -1002,8 +1012,8 @@ done: * list. */ if (ret_value<0 && point_of_no_return) { - ent->layout = H5O_free(H5O_LAYOUT, ent->layout); - ent->pline = H5O_free(H5O_PLINE, ent->pline); + ent->layout = H5O_free(H5O_LAYOUT_ID, ent->layout); + ent->pline = H5O_free(H5O_PLINE_ID, ent->pline); if(ent->chunk) ent->chunk = H5MM_xfree(ent->chunk); } @@ -1049,8 +1059,8 @@ H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) } else { /* Reset, but do not free or remove from list */ - ent->layout = H5O_free(H5O_LAYOUT, ent->layout); - ent->pline = H5O_free(H5O_PLINE, ent->pline); + ent->layout = H5O_free(H5O_LAYOUT_ID, ent->layout); + ent->pline = H5O_free(H5O_PLINE_ID, ent->pline); if(ent->chunk != NULL) ent->chunk = H5MM_xfree(ent->chunk); } @@ -1483,8 +1493,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->dirty = FALSE; ent->chunk_size = chunk_size; ent->alloc_size = chunk_size; - ent->layout = H5O_copy(H5O_LAYOUT, layout, NULL); - ent->pline = H5O_copy(H5O_PLINE, pline, NULL); + ent->layout = H5O_copy(H5O_LAYOUT_ID, layout, NULL); + ent->pline = H5O_copy(H5O_PLINE_ID, pline, NULL); for (u=0; u<layout->ndims; u++) ent->offset[u] = offset[u]; ent->rd_count = chunk_size; @@ -1625,8 +1635,8 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HDmemset (&x, 0, sizeof x); x.dirty = TRUE; - x.layout = H5O_copy (H5O_LAYOUT, layout, NULL); - x.pline = H5O_copy (H5O_PLINE, pline, NULL); + x.layout = H5O_copy (H5O_LAYOUT_ID, layout, NULL); + x.pline = H5O_copy (H5O_PLINE_ID, pline, NULL); for (u=0, tempchunk_size=1; u<layout->ndims; u++) { x.offset[u] = offset[u]; tempchunk_size *= layout->dim[u]; @@ -1,8 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*------------------------------------------------------------------------- - * Copyright (C) 1997-2002 National Center for Supercomputing Applications - * All rights reserved. - * - *------------------------------------------------------------------------- * * Created: H5G.c * Jul 18 1997 @@ -1449,7 +1459,7 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, HDmemset(&tmp_grp_ent,0,sizeof(H5G_entry_t)); /* Get the link value */ - if (NULL==H5O_read (grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id)) + if (NULL==H5O_read (grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address"); if (NULL==(clv=H5HL_peek (grp_ent->file, dxpl_id, stab_mesg.heap_addr, obj_ent->cache.slink.lval_offset))) @@ -1550,11 +1560,11 @@ H5G_mkroot (H5F_t *f, hid_t dxpl_id, H5G_entry_t *ent) */ if (H5O_open (ent)<0) HGOTO_ERROR (H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open root group"); - if (NULL==H5O_read (ent, H5O_STAB, 0, &stab, dxpl_id)) { + if (NULL==H5O_read (ent, H5O_STAB_ID, 0, &stab, dxpl_id)) { H5O_close(ent); HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "root object is not a group"); } - H5O_reset (H5O_STAB, &stab); + H5O_reset (H5O_STAB_ID, &stab); } /* Create the path names for the root group's entry */ @@ -1678,7 +1688,7 @@ H5G_isa(H5G_entry_t *ent, hid_t dxpl_id) assert(ent); - if ((ret_value=H5O_exists(ent, H5O_STAB, 0, dxpl_id))<0) + if ((ret_value=H5O_exists(ent, H5O_STAB_ID, 0, dxpl_id))<0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); done: @@ -1781,7 +1791,7 @@ H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id) /* Grab the object header */ if (H5O_open(&(grp->ent)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group"); - if (NULL==H5O_read (&(grp->ent), H5O_STAB, 0, &mesg, dxpl_id)) { + if (NULL==H5O_read (&(grp->ent), H5O_STAB_ID, 0, &mesg, dxpl_id)) { H5O_close(&(grp->ent)); HGOTO_ERROR (H5E_SYM, H5E_CANTOPENOBJ, NULL, "not a group"); } @@ -2221,12 +2231,12 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, * Add the link-value to the local heap for the symbol table which * will contain the link. */ - if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id)) + if (NULL==H5O_read (&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to determine local heap address"); if ((size_t)(-1)==(offset=H5HL_insert (grp_ent.file, dxpl_id, stab_mesg.heap_addr, HDstrlen(cur_name)+1, cur_name))) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap"); - H5O_reset (H5O_STAB, &stab_mesg); + H5O_reset (H5O_STAB_ID, &stab_mesg); /* * Create a symbol table entry for the link. The object header is @@ -2362,7 +2372,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, if (statbuf) { if (H5G_CACHED_SLINK==obj_ent.type) { /* Named object is a symbolic link */ - if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id) || + if (NULL==H5O_read (&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id) || NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr, obj_ent.cache.slink.lval_offset))) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value"); @@ -2383,9 +2393,9 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, #endif statbuf->nlink = H5O_link (&obj_ent, 0, dxpl_id); statbuf->type = H5G_LINK; - if (NULL==H5O_read(&obj_ent, H5O_MTIME, 0, &(statbuf->mtime), dxpl_id)) { + if (NULL==H5O_read(&obj_ent, H5O_MTIME_ID, 0, &(statbuf->mtime), dxpl_id)) { H5E_clear(); - if (NULL==H5O_read(&obj_ent, H5O_MTIME_NEW, 0, &(statbuf->mtime), dxpl_id)) { + if (NULL==H5O_read(&obj_ent, H5O_MTIME_NEW_ID, 0, &(statbuf->mtime), dxpl_id)) { H5E_clear(); statbuf->mtime = 0; } @@ -2582,7 +2592,7 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/, * Get the address of the local heap for the link value and a pointer * into that local heap. */ - if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg, dxpl_id)) + if (NULL==H5O_read (&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id)) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to determine local heap address"); if (NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr, obj_ent.cache.slink.lval_offset))) @@ -2633,15 +2643,15 @@ H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Remove the previous comment message if any */ - if (H5O_remove(&obj_ent, H5O_NAME, 0, dxpl_id)<0) + if (H5O_remove(&obj_ent, H5O_NAME_ID, 0, dxpl_id)<0) H5E_clear(); /* Add the new message */ if (buf && *buf) { comment.s = H5MM_xstrdup(buf); - if (H5O_modify(&obj_ent, H5O_NAME, H5O_NEW_MESG, 0, 1, &comment, dxpl_id)<0) + if (H5O_modify(&obj_ent, H5O_NAME_ID, H5O_NEW_MESG, 0, 1, &comment, dxpl_id)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message"); - H5O_reset(H5O_NAME, &comment); + H5O_reset(H5O_NAME_ID, &comment); } done: @@ -2689,7 +2699,7 @@ H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf, h /* Get the message */ comment.s = NULL; - if (NULL==H5O_read(&obj_ent, H5O_NAME, 0, &comment, dxpl_id)) { + if (NULL==H5O_read(&obj_ent, H5O_NAME_ID, 0, &comment, dxpl_id)) { if (buf && bufsize>0) buf[0] = '\0'; ret_value = 0; @@ -2697,7 +2707,7 @@ H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf, h if(buf && bufsize) HDstrncpy(buf, comment.s, bufsize); ret_value = (int)HDstrlen(comment.s); - H5O_reset(H5O_NAME, &comment); + H5O_reset(H5O_NAME_ID, &comment); } done: diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 25463d8..4fcf758 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -253,8 +253,8 @@ H5G_node_size(H5F_t *f) *------------------------------------------------------------------------- */ static H5G_node_t * -H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED _udata1, - void * UNUSED _udata2) +H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1, + void UNUSED * _udata2) { H5G_node_t *sym = NULL; size_t size = 0; diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 4e35771..cf2fa28 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -1,13 +1,23 @@ -/* - * Copyright (C) 1997-2001 National Center for Supercomputing Applications - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Friday, September 19, 1997 * */ -#define H5G_PACKAGE #define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5G_PACKAGE /*suppress error about including H5Gpkg */ #include "H5private.h" #include "H5Eprivate.h" @@ -99,7 +109,7 @@ H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/) * Insert the symbol table message into the object header and the symbol * table entry. */ - if (H5O_modify(self, H5O_STAB, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 1, &stab, dxpl_id)<0) { + if (H5O_modify(self, H5O_STAB_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 1, &stab, dxpl_id)<0) { H5O_close(self); HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); } @@ -151,7 +161,7 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name, assert(name && *name); /* set up the udata */ - if (NULL == H5O_read(grp_ent, H5O_STAB, 0, &stab, dxpl_id)) + if (NULL == H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message"); udata.operation = H5G_OPER_FIND; udata.name = name; @@ -223,7 +233,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hi HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name"); /* initialize data to pass through B-tree */ - if (NULL == H5O_read(grp_ent, H5O_STAB, 0, &stab, dxpl_id)) + if (NULL == H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); udata.operation = H5G_OPER_INSERT; udata.name = name; @@ -269,7 +279,7 @@ H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id) assert(name && *name); /* initialize data to pass through B-tree */ - if (NULL==H5O_read(grp_ent, H5O_STAB, 0, &stab, dxpl_id)) + if (NULL==H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); udata.operation = H5G_OPER_REMOVE; udata.name = name; @@ -217,8 +217,8 @@ done: *------------------------------------------------------------------------- */ static H5HG_heap_t * -H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, - void * UNUSED udata2) +H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1, + void UNUSED * udata2) { H5HG_heap_t *heap = NULL; H5HG_heap_t *ret_value = NULL; @@ -196,8 +196,8 @@ done: *------------------------------------------------------------------------- */ static H5HL_t * -H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED udata1, - void * UNUSED udata2) +H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1, + void UNUSED * udata2) { uint8_t hdr[52]; size_t sizeof_hdr; /* Cache H5HL header size for file */ @@ -1,8 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*------------------------------------------------------------------------- - * Copyright (C) 1997-2001 National Center for Supercomputing Applications - * All rights reserved. - * - *------------------------------------------------------------------------- * * Created: H5O.c * Aug 5 1997 @@ -14,7 +24,9 @@ * *------------------------------------------------------------------------- */ + #define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ #include "H5private.h" #include "H5ACprivate.h" @@ -24,7 +36,7 @@ #include "H5Iprivate.h" #include "H5MFprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #include "H5Pprivate.h" #ifdef H5_HAVE_GETTIMEOFDAY @@ -40,12 +52,29 @@ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata void *_udata2); static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh); static herr_t H5O_dest(H5F_t *f, H5O_t *oh); +static herr_t H5O_reset_real(const H5O_class_t *type, void *native); +static void * H5O_free_real(const H5O_class_t *type, void *mesg); +static void * H5O_copy_real(const H5O_class_t *type, const void *mesg, + void *dst); +static int H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type, + hid_t dxpl_id); +static htri_t H5O_exists_real(H5G_entry_t *ent, const H5O_class_t *type, + int sequence, hid_t dxpl_id); +static void * H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, + int sequence, void *mesg, hid_t dxpl_id); #ifdef NOT_YET static herr_t H5O_share(H5F_t *f, hid_t dxpl_id, const H5O_class_t *type, const void *mesg, H5HG_t *hobj/*out*/); #endif /* NOT_YET */ static unsigned H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5O_class_t **type_p, int sequence); +static int H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, + int overwrite, unsigned flags, unsigned update_time, const void *mesg, + hid_t dxpl_id); +static int H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, + const H5O_class_t *type, unsigned flags, const void *mesg); +static herr_t H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, + int sequence, hid_t dxpl_id); static unsigned H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size); static unsigned H5O_alloc_extend_chunk(H5O_t *oh, unsigned chunkno, size_t size); @@ -423,8 +452,8 @@ done: *------------------------------------------------------------------------- */ static H5O_t * -H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void * UNUSED _udata1, - void * UNUSED _udata2) +H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, + void UNUSED * _udata2) { H5O_t *oh = NULL; H5O_t *ret_value; @@ -801,9 +830,9 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) assert (oh->mesg[i].dirty==0); if (oh->mesg[i].flags & H5O_FLAG_SHARED) - H5O_free(H5O_SHARED, oh->mesg[i].native); + H5O_free_real(H5O_SHARED, oh->mesg[i].native); else - H5O_free(oh->mesg[i].type, oh->mesg[i].native); + H5O_free_real(oh->mesg[i].type, oh->mesg[i].native); } oh->mesg = H5FL_ARR_FREE(H5O_mesg_t,oh->mesg); @@ -828,15 +857,61 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) * Aug 12 1997 * * Modifications: + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 * *------------------------------------------------------------------------- */ herr_t -H5O_reset(const H5O_class_t *type, void *native) +H5O_reset(hid_t type_id, void *native) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_reset,FAIL); + + /* check args */ + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + + /* Call the "real" reset routine */ + if((ret_value=H5O_reset_real(type, native))<0) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to reset object header"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_reset() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_reset_real + * + * Purpose: Some message data structures have internal fields that + * need to be freed. This function does that if appropriate + * but doesn't free NATIVE. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 12 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_reset_real(const H5O_class_t *type, void *native) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_reset, FAIL); + FUNC_ENTER_NOINIT(H5O_reset_real); + + /* check args */ + assert(type); if (native) { if (type->reset) { @@ -849,7 +924,7 @@ H5O_reset(const H5O_class_t *type, void *native) done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_reset_real() */ /*------------------------------------------------------------------------- @@ -870,23 +945,64 @@ done: *------------------------------------------------------------------------- */ void * -H5O_free (const H5O_class_t *type, void *mesg) +H5O_free (hid_t type_id, void *mesg) { - void * ret_value=NULL; /* Return value */ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + void * ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_free, NULL); + + /* check args */ + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + + /* Call the "real" free routine */ + if((ret_value=H5O_free_real(type, mesg))==NULL) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to free object header"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_free_real + * + * Purpose: Similar to H5O_reset() except it also frees the message + * pointer. + * + * Return: Success: NULL + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Thursday, May 21, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5O_free_real(const H5O_class_t *type, void *mesg) +{ + void * ret_value=NULL; /* Return value */ + + FUNC_ENTER_NOINIT(H5O_free_real); + /* check args */ + assert(type); + if (mesg) { - H5O_reset (type, mesg); + H5O_reset_real(type, mesg); if (NULL!=(type->free)) (type->free)(mesg); else H5MM_xfree (mesg); } -done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_free_real() */ /*------------------------------------------------------------------------- @@ -903,16 +1019,60 @@ done: * Thursday, May 21, 1998 * * Modifications: + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 * *------------------------------------------------------------------------- */ void * -H5O_copy (const H5O_class_t *type, const void *mesg, void *dst) +H5O_copy (hid_t type_id, const void *mesg, void *dst) { - void *ret_value = NULL; + const H5O_class_t *type; /* Actual H5O class type for the ID */ + void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_copy, NULL); + /* check args */ + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + + /* Call the "real" copy routine */ + if((ret_value=H5O_copy_real(type, mesg, dst))==NULL) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_copy_real + * + * Purpose: Copies a message. If MESG is is the null pointer then a null + * pointer is returned with no error. + * + * Return: Success: Ptr to the new message + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Thursday, May 21, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5O_copy_real (const H5O_class_t *type, const void *mesg, void *dst) +{ + void *ret_value = NULL; + + FUNC_ENTER_NOINIT(H5O_copy_real); + + /* check args */ assert (type); assert (type->copy); @@ -923,7 +1083,7 @@ H5O_copy (const H5O_class_t *type, const void *mesg, void *dst) done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_copy_real() */ @@ -1006,18 +1166,64 @@ done: * Tuesday, April 21, 1998 * * Modifications: + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 * *------------------------------------------------------------------------- */ int -H5O_count (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id) +H5O_count (H5G_entry_t *ent, hid_t type_id, hid_t dxpl_id) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + int ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_count_real, FAIL); + + /* Check args */ + assert (ent); + assert (ent->file); + assert (H5F_addr_defined(ent->header)); + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert (type); + + /* Call the "real" count routine */ + if((ret_value=H5O_count_real(ent, type, dxpl_id))<0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to count object header messages"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_count() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_count_real + * + * Purpose: Counts the number of messages in an object header which are a + * certain type. + * + * Return: Success: Number of messages of specified type. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Tuesday, April 21, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id) { H5O_t *oh = NULL; int acc; unsigned u; int ret_value; - FUNC_ENTER_NOAPI(H5O_count, FAIL); + FUNC_ENTER_NOAPI(H5O_count_real, FAIL); /* Check args */ assert (ent); @@ -1039,7 +1245,7 @@ H5O_count (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id) done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_count_real() */ /*------------------------------------------------------------------------- @@ -1059,17 +1265,65 @@ done: * Monday, November 2, 1998 * * Modifications: + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 * *------------------------------------------------------------------------- */ htri_t -H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) +H5O_exists(H5G_entry_t *ent, hid_t type_id, int sequence, hid_t dxpl_id) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + htri_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_exists, FAIL); + + assert(ent); + assert(ent->file); + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + assert(sequence>=0); + + /* Call the "real" exists routine */ + if((ret_value=H5O_exists_real(ent, type, sequence, dxpl_id))<0) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to verify object header message"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_exists() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_exists_real + * + * Purpose: Determines if a particular message exists in an object + * header without trying to decode the message. + * + * Return: Success: FALSE if the message does not exist; TRUE if + * th message exists. + * + * Failure: FAIL if the existence of the message could + * not be determined due to some error such as + * not being able to read the object header. + * + * Programmer: Robb Matzke + * Monday, November 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static htri_t +H5O_exists_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) { H5O_t *oh=NULL; unsigned u; htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_exists, FAIL); + FUNC_ENTER_NOINIT(H5O_exists_real); assert(ent); assert(ent->file); @@ -1093,7 +1347,7 @@ H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_i done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_exists_real() */ /*------------------------------------------------------------------------- @@ -1118,19 +1372,74 @@ done: * Aug 6 1997 * * Modifications: + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 * *------------------------------------------------------------------------- */ void * -H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg, hid_t dxpl_id) +H5O_read(H5G_entry_t *ent, hid_t type_id, int sequence, void *mesg, hid_t dxpl_id) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_read, NULL); + + /* check args */ + assert(ent); + assert(ent->file); + assert(H5F_addr_defined(ent->header)); + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + assert(sequence >= 0); + + /* Call the "real" read routine */ + if((ret_value=H5O_read_real(ent, type, sequence, mesg, dxpl_id))==NULL) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to load object header"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_read_real + * + * Purpose: Reads a message from an object header and returns a pointer + * to it. The caller will usually supply the memory through + * MESG and the return value will be MESG. But if MESG is + * the null pointer, then this function will malloc() memory + * to hold the result and return its pointer instead. + * + * Return: Success: Ptr to message in native format. The message + * should be freed by calling H5O_reset(). If + * MESG is a null pointer then the caller should + * also call H5MM_xfree() on the return value + * after calling H5O_reset(). + * + * Failure: NULL + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 6 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg, hid_t dxpl_id) { H5O_t *oh = NULL; - void *ret_value = NULL; int idx; H5G_cache_t *cache = NULL; H5G_type_t cache_type; + void *ret_value = NULL; - FUNC_ENTER_NOAPI(H5O_read, NULL); + FUNC_ENTER_NOINIT(H5O_read_real); /* check args */ assert(ent); @@ -1179,7 +1488,7 @@ H5O_read(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg, hi ret_value = tmp_mesg; } } else { - ret_value = H5O_read (&(shared->u.ent), type, 0, mesg, dxpl_id); + ret_value = H5O_read_real(&(shared->u.ent), type, 0, mesg, dxpl_id); if (type->set_share && (type->set_share)(ent->file, ret_value, shared)<0) HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to set sharing information"); @@ -1200,7 +1509,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_read_real() */ /*------------------------------------------------------------------------- @@ -1321,21 +1630,95 @@ done: * constant it can never become non-constant. Constant messages cannot * be modified. * + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 + * *------------------------------------------------------------------------- */ int -H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, +H5O_modify(H5G_entry_t *ent, hid_t type_id, int overwrite, + unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + int ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_modify, FAIL); + + /* check args */ + assert(ent); + assert(ent->file); + assert(H5F_addr_defined(ent->header)); + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + assert(mesg); + assert (0==(flags & ~H5O_FLAG_BITS)); + + /* Call the "real" modify routine */ + if((ret_value= H5O_modify_real(ent, type, overwrite, flags, update_time, mesg, dxpl_id))<0) + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_modify() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_modify_real + * + * Purpose: Modifies an existing message or creates a new message. + * The cache fields in that symbol table entry ENT are *not* + * updated, you must do that separately because they often + * depend on multiple object header messages. Besides, we + * don't know which messages will be constant and which will + * not. + * + * The OVERWRITE argument is either a sequence number of a + * message to overwrite (usually zero) or the constant + * H5O_NEW_MESG (-1) to indicate that a new message is to + * be created. If the message to overwrite doesn't exist then + * it is created (but only if it can be inserted so its sequence + * number is OVERWRITE; that is, you can create a message with + * the sequence number 5 if there is no message with sequence + * number 4). + * + * The UPDATE_TIME argument is a boolean that allows the caller + * to skip updating the modification time. This is useful when + * several calls to H5O_modify will be made in a sequence. + * + * Return: Success: The sequence number of the message that + * was modified or created. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 6 1997 + * + * Modifications: + * + * Robb Matzke, 7 Jan 1998 + * Handles constant vs non-constant messages. Once a message is made + * constant it can never become non-constant. Constant messages cannot + * be modified. + * + *------------------------------------------------------------------------- + */ +static int +H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id) { H5O_t *oh=NULL; int sequence; unsigned idx; /* Index of message to modify */ H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - int ret_value = FAIL; size_t size=0; H5O_shared_t sh_mesg; + int ret_value; - FUNC_ENTER_NOAPI(H5O_modify, FAIL); + FUNC_ENTER_NOAPI(H5O_modify_real, FAIL); /* check args */ assert(ent); @@ -1433,7 +1816,7 @@ H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, HDmemcpy(idx_msg->native,&sh_mesg,sizeof(H5O_shared_t)); } else { if (idx_msg->native) - H5O_reset (idx_msg->type, idx_msg->native); + H5O_reset_real(idx_msg->type, idx_msg->native); idx_msg->native = (type->copy) (mesg, idx_msg->native); if (NULL == idx_msg->native) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header"); @@ -1455,7 +1838,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_modify_real() */ /*------------------------------------------------------------------------- @@ -1564,20 +1947,77 @@ done: * Dec 31 2002 * * Modifications: + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 * *------------------------------------------------------------------------- */ int -H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, +H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hid_t type_id, unsigned flags, + const void *mesg) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + int ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_append,FAIL); + + /* check args */ + assert(f); + assert(oh); + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + assert(0==(flags & ~H5O_FLAG_BITS)); + assert(mesg); + + /* Call the "real" append routine */ + if((ret_value=H5O_append_real( f, dxpl_id, oh, type, flags, mesg))<0) + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_append() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_append_real + * + * Purpose: Simplified version of H5O_modify, used when creating a new + * object header message (usually during object creation) + * + * Modifies an existing message or creates a new message. + * The cache fields in that symbol table entry ENT are *not* + * updated, you must do that separately because they often + * depend on multiple object header messages. Besides, we + * don't know which messages will be constant and which will + * not. + * + * Return: Success: The sequence number of the message that + * was created. + * + * Failure: Negative + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Dec 31 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, unsigned flags, const void *mesg) { unsigned idx; /* Index of message to modify */ H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - int ret_value = FAIL; size_t size=0; H5O_shared_t sh_mesg; + int ret_value = FAIL; - FUNC_ENTER_NOAPI(H5O_append, FAIL); + FUNC_ENTER_NOINIT(H5O_append_real); /* check args */ assert(f); @@ -1640,7 +2080,7 @@ H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, HDmemcpy(idx_msg->native,&sh_mesg,sizeof(H5O_shared_t)); } else { if (idx_msg->native) - H5O_reset (idx_msg->type, idx_msg->native); + H5O_reset_real(idx_msg->type, idx_msg->native); idx_msg->native = (type->copy) (mesg, idx_msg->native); if (NULL == idx_msg->native) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header"); @@ -1655,7 +2095,7 @@ H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5O_append() */ +} /* end H5O_append_real () */ /*------------------------------------------------------------------------- @@ -1901,18 +2341,73 @@ done: * Robb Matzke, 7 Jan 1998 * Does not remove constant messages. * + * Changed to use IDs for types, instead of type objects, then + * call "real" routine. + * Quincey Koziol + * Feb 14 2003 + * *------------------------------------------------------------------------- */ herr_t -H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) +H5O_remove(H5G_entry_t *ent, hid_t type_id, int sequence, hid_t dxpl_id) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_remove, FAIL); + + /* check args */ + assert(ent); + assert(ent->file); + assert(H5F_addr_defined(ent->header)); + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + + /* Call the "real" remove routine */ + if((ret_value=H5O_remove_real(ent, type, sequence, dxpl_id))<0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_remove_real + * + * Purpose: Removes the specified message from the object header. + * If sequence is H5O_ALL (-1) then all messages of the + * specified type are removed. Removing a message causes + * the sequence numbers to change for subsequent messages of + * the same type. + * + * No attempt is made to join adjacent free areas of the + * object header into a single larger free area. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 28 1997 + * + * Modifications: + * + * Robb Matzke, 7 Jan 1998 + * Does not remove constant messages. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) { H5O_t *oh = NULL; int seq, nfailed = 0; unsigned u; - herr_t ret_value=SUCCEED; /* Return value */ H5O_shared_t *sh_mesg = NULL; + herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_remove, FAIL); + FUNC_ENTER_NOINIT(H5O_remove_real); /* check args */ assert(ent); @@ -1959,7 +2454,7 @@ H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_i /* change message type to nil and zero it */ oh->mesg[u].type = H5O_NULL; HDmemset(oh->mesg[u].raw, 0, oh->mesg[u].raw_size); - oh->mesg[u].native = H5O_free (type, oh->mesg[u].native); + oh->mesg[u].native = H5O_free_real(type, oh->mesg[u].native); oh->mesg[u].dirty = TRUE; oh->cache_info.dirty = TRUE; H5O_touch_oh(ent->file, oh, FALSE); @@ -1975,7 +2470,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); -} +} /* end H5O_remove_real() */ /*------------------------------------------------------------------------- @@ -2482,6 +2977,91 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_raw_size + * + * Purpose: Call the 'raw_size' method for a + * particular class of object header. + * + * Return: Size of message on success, 0 on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Feb 13 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +size_t +H5O_raw_size(hid_t type_id, H5F_t *f, const void *mesg) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + size_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_raw_size,0); + + /* Check args */ + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert (type); + assert (type->raw_size); + assert (f); + assert (mesg); + + /* Compute the raw data size for the mesg */ + if ((ret_value = (type->raw_size)(f, mesg))==0) + HGOTO_ERROR (H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_raw_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_debug_id + * + * Purpose: Act as a proxy for calling the 'debug' method for a + * particular class of object header. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Feb 13 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_debug_id(hid_t type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth) +{ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_debug_id,FAIL); + + /* Check args */ + assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0]))); + type=message_type_g[type_id]; /* map the type ID to the actual type object */ + assert(type); + assert(type->debug); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + /* Call the debug method in the class */ + if ((ret_value = (type->debug)(f, dxpl_id, mesg, stream, indent, fwidth))<0) + HGOTO_ERROR (H5E_OHDR, H5E_INTERNAL, FAIL, "unable to debug message"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_debug_id() */ + + +/*------------------------------------------------------------------------- * Function: H5O_debug * * Purpose: Prints debugging info about an object header. @@ -2641,13 +3221,13 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f mesg = (oh->mesg[i].type->decode)(f, dxpl_id, p, oh->mesg[i].native); H5MM_xfree (p); } else { - mesg = H5O_read (&(shared->u.ent), oh->mesg[i].type, 0, NULL, dxpl_id); + mesg = H5O_read_real(&(shared->u.ent), oh->mesg[i].type, 0, NULL, dxpl_id); } if (oh->mesg[i].type->debug) { (oh->mesg[i].type->debug)(f, dxpl_id, mesg, stream, indent+3, MAX (0, fwidth-3)); } - H5O_free (oh->mesg[i].type, mesg); + H5O_free_real(oh->mesg[i].type, mesg); } } sequence = H5MM_xfree(sequence); diff --git a/src/H5Oattr.c b/src/H5Oattr.c index ddc7cdf..ced7559 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -1,27 +1,28 @@ -/**************************************************************************** -* NCSA HDF * -* Software Development Group * -* National Center for Supercomputing Applications * -* University of Illinois at Urbana-Champaign * -* 605 E. Springfield, Champaign IL 61820 * -* * -* For conditions of distribution and use, see the accompanying * -* hdf/COPYING file. * -* * -****************************************************************************/ - -/* $Id$ */ - -#define H5A_PACKAGE /*prevent warning from including H5Apkg.h */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#define H5A_PACKAGE /*prevent warning from including H5Apkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5S_PACKAGE /*suppress error about including H5Spkg */ #include "H5private.h" +#include "H5Apkg.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ #include "H5Gprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" -#include "H5Apkg.h" +#include "H5Opkg.h" /* Object header functions */ #include "H5Spkg.h" /* Data spaces */ #define PABLO_MASK H5O_attr_mask diff --git a/src/H5Obogus.c b/src/H5Obogus.c index 17c4da1..4a803b6 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -28,10 +28,13 @@ * *------------------------------------------------------------------------- */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #ifdef H5O_ENABLE_BOGUS #define PABLO_MASK H5O_bogus_mask diff --git a/src/H5Ocont.c b/src/H5Ocont.c index d7979c1..0f6fd98 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -1,8 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*------------------------------------------------------------------------- - * Copyright (C) 1997-2001 National Center for Supercomputing Applications - * All rights reserved. - * - *------------------------------------------------------------------------- * * Created: H5Ocont.c * Aug 6 1997 @@ -18,10 +28,12 @@ *------------------------------------------------------------------------- */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #define PABLO_MASK H5O_cont_mask diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 3736d12..5049d81 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1,25 +1,26 @@ -/**************************************************************************** -* NCSA HDF * -* Software Development Group * -* National Center for Supercomputing Applications * -* University of Illinois at Urbana-Champaign * -* 605 E. Springfield, Champaign IL 61820 * -* * -* For conditions of distribution and use, see the accompanying * -* hdf/COPYING file. * -* * -****************************************************************************/ - -/* $Id$ */ - -#define H5T_PACKAGE /*prevent warning from including H5Tpkg.h */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5T_PACKAGE /*prevent warning from including H5Tpkg */ #include "H5private.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ #include "H5Gprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #include "H5Tpkg.h" #define PABLO_MASK H5O_dtype_mask diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 4af7828..ae898ea 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -1,18 +1,31 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /* - * Copyright (C) 1997-2001 NCSA - * All rights reserved. - * * Programmer: Robb Matzke <matzke@llnl.gov> * Tuesday, November 25, 1997 */ + #define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ #include "H5private.h" #include "H5Eprivate.h" #include "H5Fpkg.h" #include "H5HLprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #define PABLO_MASK H5O_efl_mask diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 3172538..2901351 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -1,19 +1,32 @@ -/* - * Copyright (C) 1998-2001 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, September 30, 1998 * * Purpose: The fill message indicates a bit pattern to use for * uninitialized data points of a dataset. */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ #include "H5Iprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #include "H5Pprivate.h" #define PABLO_MASK H5O_fill_mask diff --git a/src/H5Ofphdf5.c b/src/H5Ofphdf5.c deleted file mode 100644 index 88802ab..0000000 --- a/src/H5Ofphdf5.c +++ /dev/null @@ -1,553 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* $Id$ */ - -#define H5P_PACKAGE /* prevent warning from including H5Ppkg.h */ -#define H5S_PACKAGE /* prevent warning from including H5Spkg.h */ - -#include "H5private.h" /* Generic functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5Rprivate.h" /* References */ -#include "H5Spkg.h" /* Dataspace functions */ - -#if defined (WIN32) && !defined (__MWERKS__) -#include <sys/types.h> -#include <sys/timeb.h> -#endif - -#ifdef H5_HAVE_FPHDF5 - -/* Pablo mask */ -#define PABLO_MASK H5O_fphdf5_mask - -/* local prototypes */ -static void *H5O_fphdf5_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); -static herr_t H5O_fphdf5_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_fphdf5_size(H5F_t *f, const void *_mesg); -static herr_t H5O_fphdf5_reset(void *_mesg); -static void *H5O_fphdf5_copy(const void *mesg, void *dest); -static herr_t H5O_fphdf5_free(void *_mesg); -static herr_t H5O_fphdf5_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, - FILE *stream, int indent, int fwidth); - -/* This message derives from H5O */ -const H5O_class_t H5O_FPHDF5[1] = {{ - H5O_FPHDF5_ID, /* message id number */ - "fphdf5", /* message name for debugging */ - sizeof(H5O_fphdf5_t), /* native message size */ - H5O_fphdf5_decode, /* decode message */ - H5O_fphdf5_encode, /* encode message */ - H5O_fphdf5_copy, /* copy the native value */ - H5O_fphdf5_size, /* size of symbol table entry */ - H5O_fphdf5_reset, /* default reset method */ - H5O_fphdf5_free, /* free method */ - NULL, /* get share method */ - NULL, /* set share method */ - H5O_fphdf5_debug, /* debug the message */ -}}; - -#define H5O_FPHDF5_VERSION 1 - -/* Is the interface initialized? */ -static int interface_initialize_g = 0; -#define INTERFACE_INIT NULL - -/* Define the free list for H5O_fphdf5_t's */ -H5FL_DEFINE_STATIC(H5O_fphdf5_t); - -/* Declare external the free list for hsize_t arrays */ -H5FL_ARR_EXTERN(hsize_t); - -/* - * Function: H5O_fphdf5_decode - * Purpose: Decode a metadata message from the SAP and return a pointer to - * a memory struct with the decoded information. - * - * This function decodes the "raw" form of a metadata message - * sent from the SAP into a struct in memory native format. The - * struct is allocated within this function using malloc() and is - * returned to the caller. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * uint8 *p OUT: the raw information buffer - * H5O_shared_t *sh IN: not used; must be NULL - * - * Return: Success: Pointer to the new message in native order - * Failure: NULL - * Programmer: Bill Wendling, 20. August 2002 - * Modifications: - */ -static void * -H5O_fphdf5_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) -{ - H5O_fphdf5_t *fmeta = NULL; /* New FPHDF5 metadata structure */ - void *ret_value; - - FUNC_ENTER_NOAPI(H5O_fphdf5_decode, NULL); - - /* check args */ - assert(f); - assert(p); - assert(!sh); - - /* decode */ - fmeta = H5FL_CALLOC(H5O_fphdf5_t); - - /* decode the OID first */ - NBYTEDECODE(p, fmeta->oid, sizeof(fmeta->oid)); - - /* decode the header address next */ - NBYTEDECODE(p, &fmeta->header, sizeof(fmeta->header)); - - /* decode the dataspace dimensions next */ - fmeta->sdim = H5O_SDSPACE[0].decode(f, p, NULL); - - if (!fmeta->sdim) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* jump past the dataspace dimensions part */ - p += H5O_SDSPACE[0].raw_size(f, fmeta->sdim); - - /* decode the datatype next */ - fmeta->dtype = H5O_DTYPE[0].decode(f, p, NULL); - - if (!fmeta->dtype) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* jump past the datatype part */ - p += H5O_DTYPE[0].raw_size(f, fmeta->dtype); - - /* decode the modification time next */ - fmeta->mtime = H5O_MTIME[0].decode(f, p, NULL); - - if (!fmeta->mtime) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* jump past the modification time part */ - p += H5O_MTIME[0].raw_size(f, fmeta->mtime); - - /* decode the dataset layout next */ - fmeta->layout = H5O_LAYOUT[0].decode(f, p, NULL); - - if (!fmeta->layout) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* jump past the dataset layout part */ - p += H5O_LAYOUT[0].raw_size(f, fmeta->layout); - - /* decode the group the modification took place in */ - fmeta->group = H5O_NAME[0].decode(f, p, NULL); - - if (!fmeta->group) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* jump past the group name part */ - p += H5O_NAME[0].raw_size(f, fmeta->group); - - /* decode the dataset the modification took place in */ - fmeta->dset = H5O_NAME[0].decode(f, p, NULL); - - if (!fmeta->dset) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* jump past the dataset name part */ - p += H5O_NAME[0].raw_size(f, fmeta->dset); - - /* decode the property list last */ - fmeta->plist = H5O_PLIST[0].decode(f, p, NULL); - - if (!fmeta->plist) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Set return value */ - ret_value = (void *)fmeta; /*success*/ - -done: - if (!ret_value && fmeta) { - /* free up fmeta */ - if (H5O_SDSPACE[0].free && fmeta->sdim) - H5O_SDSPACE[0].free(fmeta->sdim); - - if (H5O_DTYPE[0].free && fmeta->dtype) - H5O_DTYPE[0].free(fmeta->dtype); - - if (H5O_MTIME[0].free && fmeta->mtime) - H5O_MTIME[0].free(fmeta->mtime); - - if (H5O_LAYOUT[0].free && fmeta->layout) - H5O_LAYOUT[0].free(fmeta->layout); - - if (H5O_NAME[0].free && fmeta->group) - H5O_NAME[0].free(fmeta->dset); - - if (H5O_NAME[0].free && fmeta->dset) - H5O_NAME[0].free(fmeta->dset); - - if (H5O_PLIST[0].free && fmeta->plist) - H5O_PLIST[0].free(fmeta->plist); - - H5FL_FREE(H5O_fphdf5_t, fmeta); - } - - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_fphdf5_encode - * Purpose: Encode a metadata message for the SAP and return a pointer to - * a memory struct with the encoded information. - * - * This function encodes the "raw" form of a metadata message - * sent from the SAP into a struct in memory native format. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * uint8 *p OUT: the raw information buffer - * const void *mesg IN: pointer to the metadata to encode - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Bill Wendling, 21. August 2002 - * Modifications: - */ -static herr_t -H5O_fphdf5_encode(H5F_t *f, uint8_t *p, const void *mesg) -{ - const H5O_fphdf5_t *fmeta = (const H5O_fphdf5_t *)mesg; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5O_fphdf5_encode, FAIL); - - /* check args */ - assert(f); - assert(p); - assert(fmeta); - - /* encode the OID first */ - NBYTEENCODE(p, fmeta->oid, sizeof(fmeta->oid)); - - /* encode the header address info next */ - NBYTEENCODE(p, &fmeta->header, sizeof(fmeta->header)); - - /* encode the dataspace dimensions next */ - ret_value = H5O_SDSPACE[0].encode(f, p, fmeta->sdim); - - if (ret_value < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* jump past the dataspace dimensions part */ - p += H5O_SDSPACE[0].raw_size(f, fmeta->sdim); - - /* encode the datatype next */ - ret_value = H5O_DTYPE[0].encode(f, p, fmeta->dtype); - - if (ret_value < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* jump past the datatype part */ - p += H5O_DTYPE[0].raw_size(f, fmeta->dtype); - - /* encode the modification time next */ - ret_value = H5O_MTIME[0].encode(f, p, fmeta->mtime); - - if (ret_value < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* jump past the modification time part */ - p += H5O_MTIME[0].raw_size(f, fmeta->mtime); - - /* encode the dataset layout next */ - ret_value = H5O_LAYOUT[0].encode(f, p, fmeta->layout); - - if (ret_value < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* jump past the dataset layout part */ - p += H5O_LAYOUT[0].raw_size(f, fmeta->layout); - - /* encode the group name next */ - ret_value = H5O_NAME[0].encode(f, p, fmeta->group); - - if (ret_value < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* jump past the group name part */ - p += H5O_NAME[0].raw_size(f, fmeta->group); - - /* encode the dataset name next */ - ret_value = H5O_NAME[0].encode(f, p, fmeta->dset); - - if (ret_value < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - - /* jump past the dataset name part */ - p += H5O_NAME[0].raw_size(f, fmeta->dset); - - /* decode the property list last */ - ret_value = H5O_PLIST[0].encode(f, p, fmeta->plist); - - if (ret_value < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_fphdf5_copy - * Purpose: Copies a metadata object from MESG to DEST allocating DEST if - * necessary. - * - * const void *mesg IN: pointer to the metadata to copy - * const void *dest OUT: pointer to the destination metadata struct - * - * Return: Success: Pointer to DEST - * Failure: NULL - * Programmer: Bill Wendling, 21. August 2002 - * Modifications: - */ -static void * -H5O_fphdf5_copy(const void *mesg, void *dest) -{ - const H5O_fphdf5_t *src = (const H5O_fphdf5_t *)mesg; - H5O_fphdf5_t *dst = (H5O_fphdf5_t *)dest; - void *ret_value; - - FUNC_ENTER_NOAPI(H5O_fphdf5_copy, NULL); - - /* check args */ - assert(src); - - if (!dst && NULL == (dst = H5FL_MALLOC(H5O_fphdf5_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* copy the individual metadata*/ - HDmemcpy(dst->oid,src->oid,sizeof(src->oid)); - - H5O_SDSPACE[0].copy(src->sdim, dst->sdim); - dst->header = src->header; - H5O_DTYPE[0].copy(src->dtype, dst->dtype); - H5O_MTIME[0].copy(src->mtime, dst->mtime); - H5O_LAYOUT[0].copy(src->layout, dst->layout); - H5O_NAME[0].copy(src->group, dst->group); - H5O_NAME[0].copy(src->dset, dst->dset); - - if (H5O_PLIST[0].copy) - H5O_PLIST[0].copy(src->plist, dst->plist); - - /* Set return value */ - ret_value = dst; - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_fphdf5_size - * Purpose: Return the raw message size in bytes. - * - * This function returns the size of hte raw simple - * dimensionality, datatype, and object path message on succes. - * (Not counting the message type or size fields, only the data - * portion of the message). It doesn't take into account - * alignment. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * const void *mesg IN: pointer to the metadata structure - * - * Return: Success: Size of message - * Failure: 0 - * Programmer: Bill Wendling, 21. August 2002 - * Modifications: - */ -static size_t -H5O_fphdf5_size(H5F_t *f, const void *mesg) -{ - const H5O_fphdf5_t *fmeta = (const H5O_fphdf5_t *)mesg; - size_t ret_value; - - FUNC_ENTER_NOAPI(H5O_fphdf5_size, 0); - - /* add in the metadata sizes */ - ret_value = sizeof(fmeta->oid); - ret_value += H5O_SDSPACE[0].raw_size(f, fmeta->sdim); - ret_value += sizeof(fmeta->header); - ret_value += H5O_DTYPE[0].raw_size(f, fmeta->dtype); - ret_value += H5O_MTIME[0].raw_size(f, fmeta->mtime); - ret_value += H5O_LAYOUT[0].raw_size(f, fmeta->layout); - ret_value += H5O_NAME[0].raw_size(f, fmeta->group); - ret_value += H5O_NAME[0].raw_size(f, fmeta->dset); - ret_value += H5O_PLIST[0].raw_size(f, fmeta->plist); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_fphdf5_reset - * Purpose: Frees the inside of a metadata message and resets it to some - * initial value. - * - * const void *mesg IN: pointer to the metadata to reset - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Bill Wendling, 21. August 2002 - * Modifications: - */ -static herr_t -H5O_fphdf5_reset(void *mesg) -{ - H5O_fphdf5_t *fmeta = (H5O_fphdf5_t *)mesg; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5O_fphdf5_reset, FAIL); - - /* reset the metadata */ - HDmemset(fmeta->oid,0,sizeof(fmeta->oid)); - - if (H5O_SDSPACE[0].reset) - ret_value = H5O_SDSPACE[0].reset(fmeta->sdim); - - fmeta->header = 0; - - if (H5O_DTYPE[0].reset) - ret_value = H5O_DTYPE[0].reset(fmeta->dtype); - - if (H5O_MTIME[0].reset) - ret_value = H5O_MTIME[0].reset(fmeta->mtime); - - if (H5O_LAYOUT[0].reset) - ret_value = H5O_LAYOUT[0].reset(fmeta->layout); - - if (H5O_NAME[0].reset) - ret_value = H5O_NAME[0].reset(fmeta->group); - - if (H5O_NAME[0].reset) - ret_value = H5O_NAME[0].reset(fmeta->dset); - - if (H5O_PLIST[0].reset) - ret_value = H5O_PLIST[0].reset(fmeta->plist); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_fphdf5_free - * Purpose: Free's the message - * - * const void *mesg IN: pointer to the metadata to free - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Bill Wendling, 21. August 2002 - * Modifications: - */ -static herr_t -H5O_fphdf5_free(void *mesg) -{ - H5O_fphdf5_t *fmeta = (H5O_fphdf5_t *)mesg; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5O_fphdf5_free, FAIL); - assert(fmeta); - - if (H5O_SDSPACE[0].free && fmeta->sdim) - ret_value = H5O_SDSPACE[0].free(fmeta->sdim); - - if (H5O_DTYPE[0].free && fmeta->dtype) - ret_value = H5O_DTYPE[0].free(fmeta->dtype); - - if (H5O_MTIME[0].free && fmeta->mtime) - ret_value = H5O_MTIME[0].free(fmeta->mtime); - - if (H5O_LAYOUT[0].free && fmeta->layout) - ret_value = H5O_MTIME[0].free(fmeta->layout); - - if (H5O_NAME[0].free && fmeta->group) - ret_value = H5O_NAME[0].free(fmeta->group); - - if (H5O_NAME[0].free && fmeta->dset) - ret_value = H5O_NAME[0].free(fmeta->dset); - - if (H5O_PLIST[0].free && fmeta->plist) - ret_value = H5O_PLIST[0].free(fmeta->plist); - - H5FL_FREE(H5O_fphdf5_t, fmeta); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_fphdf5_debug - * Purpose: Prints debugging information for the metadata message. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * const void *mesg IN: Pointer to the source metadata struct - * FILE *stream IN: Pointer to the stream for output data - * int indent IN: Amount to indent information by - * int fwidth IN: Field width (?) - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Bill Wendling, 22. August 2002 - * Modifications: - */ -static herr_t -H5O_fphdf5_debug(H5F_t UNUSED *f, hid_t dxpl_id, const void *mesg, - FILE * stream, int indent, int fwidth) -{ - const H5O_fphdf5_t *fmeta = (const H5O_fphdf5_t *) mesg; - herr_t ret_value = SUCCEED; - unsigned int i; - - FUNC_ENTER_NOAPI(H5O_fphdf5_debug, FAIL); - - /* check args */ - assert(f); - assert(fmeta); - assert(stream); - assert(indent >= 0); - assert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Metadata:"); - HDfprintf(stream, "%*sOID: 0x", indent + 1, ""); - - for (i = 0; i < sizeof(fmeta->oid); ++i) - HDfprintf(stream, "%02x", fmeta->oid[i]); - - HDfprintf(stream, "\n"); - ret_value = H5O_SDSPACE[0].debug(f, fmeta->sdim, stream, indent + 1, fwidth); - HDfprintf(stream, "%*sHeader Address: %" H5_PRINTF_LL_WIDTH "u\n", - indent, "", (unsigned long_long)fmeta->header); - ret_value = H5O_DTYPE[0].debug(f, fmeta->dtype, stream, indent + 1, fwidth); - ret_value = H5O_MTIME[0].debug(f, fmeta->mtime, stream, indent + 1, fwidth); - ret_value = H5O_LAYOUT[0].debug(f, fmeta->layout, stream, indent + 1, fwidth); - ret_value = H5O_NAME[0].debug(f, fmeta->group, stream, indent + 1, fwidth); - ret_value = H5O_NAME[0].debug(f, fmeta->dset, stream, indent + 1, fwidth); - ret_value = H5O_PLIST[0].debug(f, fmeta->plist, stream, indent + 1, fwidth); - - HDfprintf(stream, "}\n"); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -#endif /* H5_HAVE_FPHDF5 */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 49cf7f6..43d1df7 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -1,18 +1,31 @@ -/* - * Copyright (C) 1997-2001 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, October 8, 1997 * * Purpose: Messages related to data layout. */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Dprivate.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ /* PRIVATE PROTOTYPES */ static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 438a555..ca89cc3 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -1,17 +1,30 @@ -/* - * Copyright (C) 1998-2001 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Friday, July 24, 1998 * * Purpose: The object modification time message. */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #if defined (WIN32) && !defined (__MWERKS__) #include <sys/types.h> @@ -413,7 +426,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_mtime_new_size(H5F_t * UNUSED f, const void * UNUSED mesg) +H5O_mtime_new_size(H5F_t UNUSED * f, const void UNUSED * mesg) { size_t ret_value=8; /* Return value */ @@ -449,7 +462,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_mtime_size(H5F_t * UNUSED f, const void * UNUSED mesg) +H5O_mtime_size(H5F_t UNUSED * f, const void UNUSED * mesg) { size_t ret_value=16; /* Return value */ diff --git a/src/H5Oname.c b/src/H5Oname.c index aafe50f..2d2e38c 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -1,8 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*------------------------------------------------------------------------- - * Copyright (C) 1997-2001 National Center for Supercomputing Applications - * All rights reserved. - * - *------------------------------------------------------------------------- * * Created: H5Oname.c * Aug 12 1997 @@ -14,10 +24,13 @@ * *------------------------------------------------------------------------- */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #define PABLO_MASK H5O_name_mask diff --git a/src/H5Onull.c b/src/H5Onull.c index c94f459..fcdd85f 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -1,8 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*------------------------------------------------------------------------- - * Copyright (C) 1997-2001 National Center for Supercomputing Applications - * All rights reserved. - * - *------------------------------------------------------------------------- * * Created: H5Onull.c * Aug 6 1997 @@ -14,8 +24,11 @@ * *------------------------------------------------------------------------- */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #define PABLO_MASK H5O_null_mask diff --git a/src/H5Opkg.h b/src/H5Opkg.h new file mode 100644 index 0000000..91c61c4 --- /dev/null +++ b/src/H5Opkg.h @@ -0,0 +1,210 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5O_PACKAGE +#error "Do not include this file outside the H5O package!" +#endif + +#ifndef _H5Opkg_H +#define _H5Opkg_H + +/* Include private header file */ +#include "H5Oprivate.h" /* Object header functions */ + +/* + * Align messages on 8-byte boundaries because we would like to copy the + * object header chunks directly into memory and operate on them there, even + * on 64-bit architectures. This allows us to reduce the number of disk I/O + * requests with a minimum amount of mem-to-mem copies. + */ +#define H5O_ALIGN(X) (8*(((X)+8-1)/8)) + +/* Object header macros */ +#define H5O_NMESGS 32 /*initial number of messages */ +#define H5O_NCHUNKS 8 /*initial number of chunks */ +#define H5O_ALL (-1) /*delete all messages of type */ + +/* Version of object header structure */ +#define H5O_VERSION 1 + +/* + * Size of object header header. + */ +#define H5O_SIZEOF_HDR(F) \ + H5O_ALIGN(1 + /*version number */ \ + 1 + /*alignment */ \ + 2 + /*number of messages */ \ + 4 + /*reference count */ \ + 4) /*header data size */ + +/* + * Size of message header + */ +#define H5O_SIZEOF_MSGHDR(F) \ + H5O_ALIGN(2 + /*message type */ \ + 2 + /*sizeof message data */ \ + 4) /*reserved */ + +typedef struct H5O_class_t { + int id; /*message type ID on disk */ + const char *name; /*for debugging */ + size_t native_size; /*size of native message */ + void *(*decode)(H5F_t*, hid_t, const uint8_t*, struct H5O_shared_t*); + herr_t (*encode)(H5F_t*, uint8_t*, const void*); + void *(*copy)(const void*, void*); /*copy native value */ + size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */ + herr_t (*reset)(void *); /*free nested data structs */ + herr_t (*free)(void *); /*free main data struct */ + herr_t (*get_share)(H5F_t*, const void*, struct H5O_shared_t*); + herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); + herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int); +} H5O_class_t; + +typedef struct H5O_mesg_t { + const H5O_class_t *type; /*type of message */ + hbool_t dirty; /*raw out of date wrt native */ + uint8_t flags; /*message flags */ + void *native; /*native format message */ + uint8_t *raw; /*ptr to raw data */ + size_t raw_size; /*size with alignment */ + unsigned chunkno; /*chunk number for this mesg */ +} H5O_mesg_t; + +typedef struct H5O_chunk_t { + hbool_t dirty; /*dirty flag */ + haddr_t addr; /*chunk file address */ + size_t size; /*chunk size */ + uint8_t *image; /*image of file */ +} H5O_chunk_t; + +typedef struct H5O_t { + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + int version; /*version number */ + int nlink; /*link count */ + unsigned nmesgs; /*number of messages */ + unsigned alloc_nmesgs; /*number of message slots */ + H5O_mesg_t *mesg; /*array of messages */ + unsigned nchunks; /*number of chunks */ + unsigned alloc_nchunks; /*chunks allocated */ + H5O_chunk_t *chunk; /*array of chunks */ +} H5O_t; + +/* + * Null Message. + */ +H5_DLLVAR const H5O_class_t H5O_NULL[1]; + +/* + * Simple Data Space Message. + */ +H5_DLLVAR const H5O_class_t H5O_SDSPACE[1]; + +/* + * Data Type Message. + */ +H5_DLLVAR const H5O_class_t H5O_DTYPE[1]; + +/* + * Old Fill Value Message. + */ +H5_DLLVAR const H5O_class_t H5O_FILL[1]; + +/* + * New Fill Value Message. The new fill value message is fill value plus + * space allocation time and fill value writing time and whether fill + * value is defined. + */ +H5_DLLVAR const H5O_class_t H5O_FILL_NEW[1]; + +/* + * External File List Message + */ +H5_DLLVAR const H5O_class_t H5O_EFL[1]; + +/* + * Data Layout Message. + */ +H5_DLLVAR const H5O_class_t H5O_LAYOUT[1]; + +#ifdef H5O_ENABLE_BOGUS +/* + * "Bogus" Message. + */ +H5_DLLVAR const H5O_class_t H5O_BOGUS[1]; +#endif /* H5O_ENABLE_BOGUS */ + +/* + * Filter pipeline message. + */ +H5_DLLVAR const H5O_class_t H5O_PLINE[1]; + +/* + * Attribute Message. + */ +H5_DLLVAR const H5O_class_t H5O_ATTR[1]; + +/* + * Object name message. + */ +H5_DLLVAR const H5O_class_t H5O_NAME[1]; + +/* + * Modification time message. The message is just a `time_t'. + * (See also the "new" modification time message) + */ +H5_DLLVAR const H5O_class_t H5O_MTIME[1]; + +/* + * Shared object message. This message ID never really appears in an object + * header. Instead, bit 2 of the `Flags' field will be set and the ID field + * will be the ID of the pointed-to message. + */ +H5_DLLVAR const H5O_class_t H5O_SHARED[1]; + +/* + * Object header continuation message. + */ +H5_DLLVAR const H5O_class_t H5O_CONT[1]; + +/* + * Symbol table message. + */ +H5_DLLVAR const H5O_class_t H5O_STAB[1]; + +/* + * New Modification time message. The message is just a `time_t'. + */ +H5_DLLVAR const H5O_class_t H5O_MTIME_NEW[1]; + +/* + * Generic property list message. + */ +H5_DLLVAR const H5O_class_t H5O_PLIST[1]; + +#ifdef H5_HAVE_FPHDF5 +/* + * Flexible parallel message + */ +H5_DLLVAR const H5O_class_t H5O_FPHDF5[1]; +#endif /* H5_HAVE_FPHDF5 */ + +/* Package-local function prototypes */ + +/* Symbol table operators */ +H5_DLL void *H5O_stab_fast(const H5G_cache_t *cache, const struct H5O_class_t *type, + void *_mesg); + +#endif /* _H5Opkg_H */ + diff --git a/src/H5Opline.c b/src/H5Opline.c index e934591..a8d1426 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -1,17 +1,31 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /* - * Copyright (C) 1998-2001 NCSA - * All rights reserved. - * * Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, April 15, 1998 * * Purpose: Data filter pipeline message. */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ /* Interface initialization */ #define PABLO_MASK H5O_pline_mask diff --git a/src/H5Oplist.c b/src/H5Oplist.c deleted file mode 100644 index 2f4246f..0000000 --- a/src/H5Oplist.c +++ /dev/null @@ -1,553 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* $Id$ */ - -#define H5P_PACKAGE /* prevent warning from including H5Ppkg.h */ - -#include "H5private.h" /* Generic functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ - -#if defined (WIN32) && !defined (__MWERKS__) -#include <sys/types.h> -#include <sys/timeb.h> -#endif - -/* Pablo mask */ -#define PABLO_MASK H5O_plist_mask - -/* local prototypes */ -static void *H5O_plist_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); -static herr_t H5O_plist_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_plist_size(H5F_t *f, const void *_mesg); -static herr_t H5O_plist_free(void *_mesg); -static herr_t H5O_plist_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, - FILE *stream, int indent, int fwidth); - -/* This message derives from H5O */ -const H5O_class_t H5O_PLIST[1] = {{ - H5O_PLIST_ID, /* message id number */ - "plist", /* message name for debugging */ - sizeof(H5P_genplist_t), /* native message size */ - H5O_plist_decode, /* decode message */ - H5O_plist_encode, /* encode message */ - NULL, /* copy the native value */ - H5O_plist_size, /* size of symbol table entry */ - NULL, /* default reset method */ - H5O_plist_free, /* free method */ - NULL, /* get share method */ - NULL, /* set share method */ - H5O_plist_debug, /* debug the message */ -}}; - -#define H5O_PLIST_VERSION 1 - -/* Is the interface initialized? */ -static int interface_initialize_g = 0; -#define INTERFACE_INIT NULL - -/* Declare external the free list for hsize_t arrays */ -H5FL_ARR_EXTERN(hsize_t); - -/* Declare the external free list for the H5P_genprop_t struct */ -H5FL_EXTERN(H5P_genprop_t); - -/* Declare the external free list for the H5P_genplist_t struct */ -H5FL_EXTERN(H5P_genplist_t); - -#define UINT_ENCODE(dst, src) \ - if (sizeof(src) == 2) { \ - UINT16ENCODE(dst, src); \ - } else if (sizeof(src) == 4) { \ - UINT32ENCODE(dst, src); \ - } else { \ - /* sizeof(src) == 8 */ \ - UINT64ENCODE(dst, src); \ - } - -#define UINT_DECODE(src, dst) \ - if (sizeof(dst) == 2) { \ - UINT16DECODE(src, dst); \ - } else if (sizeof(dst) == 4) { \ - UINT32DECODE(src, dst); \ - } else { \ - /* sizeof(dst) == 8 */ \ - UINT64DECODE(src, dst); \ - } - -#define INT_ENCODE(dst, src) \ - if (sizeof(src) == 2) { \ - INT16ENCODE(dst, src); \ - } else if (sizeof(src) == 4) { \ - INT32ENCODE(dst, src); \ - } else { \ - /* sizeof(src) == 8 */ \ - INT64ENCODE(dst, src); \ - } - -#define INT_DECODE(src, dst) \ - if (sizeof(dst) == 2) { \ - INT16DECODE(src, dst); \ - } else if (sizeof(dst) == 4) { \ - INT32DECODE(src, dst); \ - } else { \ - /* sizeof(dst) == 8 */ \ - INT64DECODE(src, dst); \ - } - -/* - * Function: H5O_plist_decode - * Purpose: Decode a property list and return a pointer to a memory - * struct with the decoded information. - * - * This function decodes the "raw" form of a serialized - * property list in memory native format. The struct is - * allocated within this function using malloc() and is - * returned to the caller. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * uint8 *p OUT: the raw information buffer - * H5O_shared_t *sh IN: not used; must be NULL - * - * Return: Success: Pointer to the new message in native order - * Failure: NULL - * Programmer: Bill Wendling, 24, September 2002 - * Modifications: - */ -static void * -H5O_plist_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *sh) -{ - H5P_genplist_t *new_plist = NULL; - H5P_genclass_t *pclass; /* property list class to modify */ - hid_t new_plist_id; /* property list ID of new list created */ - int version; /* message version number */ - unsigned int i, nprops; - void *ret_value; - - FUNC_ENTER_NOAPI(H5O_plist_decode, NULL); - - /* check args */ - assert(f); - assert(p); - assert(!sh); - - /* Version number */ - version = *p++; - - if (version != H5O_PLIST_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for property list message"); - - /* Reserved (for what?) */ - ++p; - - /* - * Decode the sizes of the parts of the property list. The sizes - * stored in the file are exact but the parts are aligned on 8-byte - * boundaries. - */ - - /* - * Retrieve the name of the property class with its parent(s). It's a - * regular NULL terminated string. - */ - if ((pclass = H5P_open_class_path((const char *)p)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPENOBJ, NULL, "can't open the class path"); - - if (*p) - p += HDstrlen((const char *)p) + 1; /* + 1 for the NULL */ - else - ++p; - - UINT_DECODE(p, nprops); - - /* Allocate new property list */ - if ((new_plist = H5FL_CALLOC(H5P_genplist_t)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Initialize new property list */ - new_plist->pclass = pclass; - new_plist->nprops = 0; /* Initially the plist has the same - number of properties as the class */ - new_plist->class_init = 0; /* Initially, wait until the class - callback finishes to set */ - - /* Initialize the TBBT to hold the properties */ - if((new_plist->props=H5TB_fast_dmake(H5TB_FAST_STR_COMPARE))==NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTMAKETREE,NULL,"can't create TBBT for properties"); - - /* Insert properties into property list */ - for (i = 0; i < nprops; ++i) { - H5P_genprop_t *tprop; - unsigned str_len; - - /* - * Allocate and initialize the property structure which is going - * to hold the information we're reading in. - */ - if (NULL == (tprop = H5FL_CALLOC(H5P_genprop_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - - /* Grab the length of the name */ - UINT_DECODE(p, str_len); - - /* Allocate space for the name and copy it */ - if (NULL == (tprop->name = H5MM_malloc(str_len + 1))) { - H5FL_FREE(H5P_genprop_t,tprop); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - } - HDmemcpy(tprop->name, p, str_len + 1); - p += str_len + 1; - - /* Grab the size of the "value" data */ - UINT_DECODE(p, tprop->size); - - /* Allocate and memcpy the value part of the property. */ - if ((tprop->value = H5MM_malloc(tprop->size)) == NULL) { - H5MM_xfree(tprop->name); - H5FL_FREE(H5P_genprop_t,tprop); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - } - - HDmemcpy(tprop->value, p, tprop->size); - p += tprop->size; - - /* Set the property's type */ - tprop->type=H5P_PROP_WITHIN_LIST; - - /* Insert the initialized property into the property list */ - if (H5P_add_prop(new_plist->props, tprop) < 0) { - H5MM_xfree(tprop->value); - H5MM_xfree(tprop->name); - H5FL_FREE(H5P_genprop_t,tprop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL, "Can't insert property into list"); - } - - /* Increment the number of properties in list */ - ++new_plist->nprops; - } - - /* Increment the number of property lists derived from class */ - if (H5P_access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment class ref count"); - - /* Get an atom for the property list */ - if ((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, NULL, "unable to atomize property list"); - - /* - * Save the property list ID in the property list struct, for use in - * the property class's 'close' callback - */ - new_plist->plist_id = new_plist_id; - - /* Set the class initialization flag */ - new_plist->class_init = 1; - - /* Set return value */ - ret_value = new_plist; /* success */ - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_plist_encode - * Purpose: Encode a property list and return a pointer to a memory - * struct with the encoded information. - * - * This function encodes the "raw" form of a property list - * into a struct in memory native format. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * uint8 *p OUT: the raw information buffer - * const void *mesg IN: pointer to the metadata to encode - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Bill Wendling, 24, September 2002 - * Modifications: - */ -static herr_t -H5O_plist_encode(H5F_t UNUSED *f, uint8_t *p, const void *mesg) -{ - const H5P_genplist_t *plist = (const H5P_genplist_t *)mesg; - char *class_path; /* Pointer to class path generated for property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5O_plist_encode, FAIL); - - /* check args */ - assert(f); - assert(p); - assert(plist); - - /* Version */ - *p++ = H5O_PLIST_VERSION; - - /* Reserved */ - *p++ = '\0'; - - /* - * Encode the sizes of the parts of the property list. The sizes - * stored in the file are exact but the parts are aligned on 8-byte - * boundaries. - */ - - /* - * The class name encoded will look like: - * - * BaseClass/ParentClass/.../DerivedClass - */ - class_path = H5P_get_class_path(plist->pclass); - - if (class_path) { - size_t s = HDstrlen(class_path) + 1; - - HDmemcpy(p, class_path, s); - p += s; - } else { - *p++ = '\0'; - } - - HDfree(class_path); - UINT_ENCODE(p, plist->nprops); - - /* Encode the properties for this property list */ - if(plist->nprops>0) { - H5TB_NODE *curr_node; /* Current node in TBBT */ - H5P_genprop_t *tprop; /* Pointer to property */ - - /* Walk through the properties in the old class */ - curr_node=H5TB_first(plist->props->root); - while(curr_node!=NULL) { - size_t s; /* Length of property name */ - - /* Get a pointer to the property from the node */ - tprop=curr_node->data; - assert(tprop->name); /* Properties are guaranteed to have names */ - - /* - * Copy the meat of the generic property: - * - * 1. The length of the property name - * 2. The name of the property - * 3. The size of the property value - * 4. The property value - */ - - /* Get the name's length & encode it */ - s = HDstrlen(tprop->name); - UINT_ENCODE(p, s); - - /* Encode the name itself */ - HDmemcpy(p, tprop->name, s + 1); - p += s + 1; - - /* Encode the property value's size & data */ - UINT_ENCODE(p, tprop->size); - HDmemcpy(p, tprop->value, tprop->size); - p += tprop->size; - - /* Get the next property node in the TBBT */ - curr_node=H5TB_next(curr_node); - } /* end while */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_plist_size - * Purpose: Return the raw message size in bytes. - * - * This function returns the size of the raw elements on - * success. (Not counting the message type or size fields, - * only the data portion of the message). It doesn't take - * into account alignment. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * const void *mesg IN: pointer to the metadata structure - * - * Return: Success: Size of message - * Failure: 0 - * Programmer: Bill Wendling, 24, September 2002 - * Modifications: - */ -static size_t -H5O_plist_size(H5F_t UNUSED *f, const void *mesg) -{ - const H5P_genplist_t *plist = (const H5P_genplist_t *)mesg; - char *class_path=NULL; /* Pointer to class path generated for property list */ - size_t ret_value; - - FUNC_ENTER_NOAPI(H5O_plist_size, 0); - - /* check args */ - assert(plist); - - ret_value = 1 + /*version info */ - 1; /*reserved */ - - class_path = H5P_get_class_path(plist->pclass); - - if (class_path) - ret_value += HDstrlen(class_path) + 1; /*class path */ - else - ++ret_value; - - HDfree(class_path); - - ret_value += sizeof(plist->nprops); /*num properties */ - - /* Calculate the size of the properties for this property list */ - if(plist->nprops>0) { - H5TB_NODE *curr_node; /* Current node in TBBT */ - H5P_genprop_t *tprop; /* Pointer to property */ - - /* Walk through the properties in the old class */ - curr_node=H5TB_first(plist->props->root); - while(curr_node!=NULL) { - /* Get a pointer to the property from the node */ - tprop=curr_node->data; - - ret_value += sizeof(size_t); /*length of the name */ - ret_value += HDstrlen(tprop->name) + 1; /*the name */ - ret_value += sizeof(tprop->size) + /*size of data size */ - tprop->size; /*the data */ - - /* Get the next property node in the TBBT */ - curr_node=H5TB_next(curr_node); - } /* end while */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_plist_free - * Purpose: Free's the property list. - * - * const void *mesg IN: pointer to the property list to free - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Bill Wendling, 24, September 2002 - * Modifications: - */ -static herr_t -H5O_plist_free(void *mesg) -{ - H5P_genplist_t *plist = mesg; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5O_plist_free, FAIL); - assert(mesg); - - ret_value = H5P_close(plist); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/* - * Function: H5O_plist_debug - * Purpose: Prints debugging information for the property list message. - * - * H5F_t *f IN: pointer to the HDF5 file struct - * const void *mesg IN: Pointer to the source property list struct - * FILE *stream IN: Pointer to the stream for output data - * int indent IN: Amount to indent information by - * int fwidth IN: Field width (?) - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Bill Wendling, 24, September 2002 - * Modifications: - */ -static herr_t -H5O_plist_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *stream, - int indent, int fwidth) -{ - const H5P_genplist_t *plist = (const H5P_genplist_t *)mesg; - herr_t ret_value=SUCCEED; - - FUNC_ENTER_NOAPI(H5O_plist_debug, FAIL); - - /* check args */ - assert(f); - assert(plist); - assert(stream); - assert(indent >= 0); - assert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Property List:"); - indent += 2; - HDfprintf(stream, "%*sNumber of properties: %d\n", indent, "", plist->nprops); - HDfprintf(stream, "%*sProperties {\n", indent, ""); - indent += 2; - - /* Calculate the size of the properties for this property list */ - if(plist->nprops>0) { - H5TB_NODE *curr_node; /* Current node in TBBT */ - H5P_genprop_t *tprop; /* Pointer to property */ - - /* Walk through the properties in the old class */ - curr_node=H5TB_first(plist->props->root); - while(curr_node!=NULL) { - register unsigned int j; - - /* Get a pointer to the property from the node */ - tprop=curr_node->data; - - HDfprintf(stream, "%*sProperty {\n", indent, ""); - indent += 2; - - /* - * Print the meat of the generic property: - * - * 1. The name of the property - * 2. The size of the property value - * 3. The property value - */ - HDfprintf(stream, "%*sName: %s\n", indent, "", tprop->name); - HDfprintf(stream, "%*sValue Size: %d\n", indent, "", tprop->size); - HDfprintf(stream, "%*sValue: ", indent, ""); - - for (j = 0; j < tprop->size; ++j) - HDfprintf(stream, "%02x ", ((char *)tprop->value)[j]); - - indent -= 2; - HDfprintf(stream, "\n%*s}\n", indent, ""); - - /* Get the next property node in the TBBT */ - curr_node=H5TB_next(curr_node); - } /* end while */ - } /* end if */ - - indent -= 2; - HDfprintf(stream, "%*s}\n", indent, ""); - - indent -= 2; - HDfprintf(stream, "%*s}\n", indent, ""); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index a8a68b8..25868b2 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -27,132 +27,52 @@ #ifndef _H5Oprivate_H #define _H5Oprivate_H -#include "H5Opublic.h" -#include "H5Dpublic.h" +/* Include the public header file for this API */ +#include "H5Opublic.h" /* Object header functions */ -/* Private headers needed by this file */ -#include "H5private.h" -#include "H5Fprivate.h" -#include "H5Gprivate.h" -#include "H5HGprivate.h" -#include "H5Rprivate.h" -#include "H5Spublic.h" -#include "H5Tprivate.h" -#include "H5Zprivate.h" +/* Public headers needed by this file */ +#include "H5Dpublic.h" /* Dataset functions */ +#include "H5Spublic.h" /* Dataspace functions */ -/* - * Align messages on 8-byte boundaries because we would like to copy the - * object header chunks directly into memory and operate on them there, even - * on 64-bit architectures. This allows us to reduce the number of disk I/O - * requests with a minimum amount of mem-to-mem copies. - */ -#define H5O_ALIGN(X) (8*(((X)+8-1)/8)) +/* Private headers needed by this file */ +#include "H5private.h" /* Generic functions */ +#include "H5HGprivate.h" /* Global heap functions */ +#include "H5Tprivate.h" /* Datatype functions */ +#include "H5Zprivate.h" /* I/O pipeline functions */ +/* Object header macros */ #define H5O_MIN_SIZE H5O_ALIGN(32) /*min obj header data size */ #define H5O_MAX_SIZE 65536 /*max obj header data size */ -#define H5O_NMESGS 32 /*initial number of messages */ -#define H5O_NCHUNKS 8 /*initial number of chunks */ #define H5O_NEW_MESG (-1) /*new message */ -#define H5O_ALL (-1) /*delete all messages of type */ /* Flags which are part of a message */ #define H5O_FLAG_CONSTANT 0x01u #define H5O_FLAG_SHARED 0x02u #define H5O_FLAG_BITS 0x03u -#define H5O_VERSION 1 - -/* - * Size of object header header. - */ -#define H5O_SIZEOF_HDR(F) \ - H5O_ALIGN(1 + /*version number */ \ - 1 + /*alignment */ \ - 2 + /*number of messages */ \ - 4 + /*reference count */ \ - 4) /*header data size */ - -/* - * Size of message header - */ -#define H5O_SIZEOF_MSGHDR(F) \ - H5O_ALIGN(2 + /*message type */ \ - 2 + /*sizeof message data */ \ - 4) /*reserved */ - -struct H5O_shared_t; -typedef struct H5O_class_t { - int id; /*message type ID on disk */ - const char *name; /*for debugging */ - size_t native_size; /*size of native message */ - void *(*decode)(H5F_t*, hid_t, const uint8_t*, struct H5O_shared_t*); - herr_t (*encode)(H5F_t*, uint8_t*, const void*); - void *(*copy)(const void*, void*); /*copy native value */ - size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */ - herr_t (*reset)(void *); /*free nested data structs */ - herr_t (*free)(void *); /*free main data struct */ - herr_t (*get_share)(H5F_t*, const void*, struct H5O_shared_t*); - herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); - herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int); -} H5O_class_t; - -typedef struct H5O_mesg_t { - const H5O_class_t *type; /*type of message */ - hbool_t dirty; /*raw out of date wrt native */ - uint8_t flags; /*message flags */ - void *native; /*native format message */ - uint8_t *raw; /*ptr to raw data */ - size_t raw_size; /*size with alignment */ - unsigned chunkno; /*chunk number for this mesg */ -} H5O_mesg_t; - -typedef struct H5O_chunk_t { - hbool_t dirty; /*dirty flag */ - haddr_t addr; /*chunk file address */ - size_t size; /*chunk size */ - uint8_t *image; /*image of file */ -} H5O_chunk_t; - -typedef struct H5O_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - int version; /*version number */ - int nlink; /*link count */ - unsigned nmesgs; /*number of messages */ - unsigned alloc_nmesgs; /*number of message slots */ - H5O_mesg_t *mesg; /*array of messages */ - unsigned nchunks; /*number of chunks */ - unsigned alloc_nchunks; /*chunks allocated */ - H5O_chunk_t *chunk; /*array of chunks */ -} H5O_t; - -/* - * Null Message. - */ -#define H5O_NULL_ID 0x0000 -H5_DLLVAR const H5O_class_t H5O_NULL[1]; - -/* - * Simple Data Space Message. - */ -#define H5O_SDSPACE_ID 0x0001 -H5_DLLVAR const H5O_class_t H5O_SDSPACE[1]; - -/* operates on an H5S_t struct */ -/* - * Data Type Message. - */ -#define H5O_DTYPE_ID 0x0003 -H5_DLLVAR const H5O_class_t H5O_DTYPE[1]; - -/* operates on an H5T_t struct */ - -/* - * Old Fill Value Message. +/* Header message IDs */ +#define H5O_NULL_ID 0x0000 /* Null Message. */ +#define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */ +#define H5O_DTYPE_ID 0x0003 /* Datatype Message. */ +#define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */ +#define H5O_FILL_NEW_ID 0x0005 /* Fill Value Message. (New) */ +#define H5O_EFL_ID 0x0007 /* External File List Message */ +#define H5O_LAYOUT_ID 0x0008 /* Data Storage Layout Message. */ +#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */ +#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */ +#define H5O_ATTR_ID 0x000c /* Attribute Message. */ +#define H5O_NAME_ID 0x000d /* Object name message. */ +#define H5O_MTIME_ID 0x000e /* Modification time message. (Old) */ +#define H5O_SHARED_ID 0x000f /* Shared object message. */ +#define H5O_CONT_ID 0x0010 /* Object header continuation message. */ +#define H5O_STAB_ID 0x0011 /* Symbol table message. */ +#define H5O_MTIME_NEW_ID 0x0012 /* Modification time message. (New) */ + + +/* + * Fill Value Message. (Old) + * (Data structure in memory) */ -#define H5O_FILL_ID 0x0004 -H5_DLLVAR const H5O_class_t H5O_FILL[1]; - typedef struct H5O_fill_t { H5T_t *type; /*type. Null implies same as dataset */ size_t size; /*number of bytes in the fill value */ @@ -164,8 +84,6 @@ typedef struct H5O_fill_t { * space allocation time and fill value writing time and whether fill * value is defined. */ -#define H5O_FILL_NEW_ID 0x0005 -H5_DLLVAR const H5O_class_t H5O_FILL_NEW[1]; typedef struct H5O_fill_new_t { H5T_t *type; /*type. Null implies same as dataset */ @@ -178,11 +96,10 @@ typedef struct H5O_fill_new_t { /* * External File List Message + * (Data structure in memory) */ -#define H5O_EFL_ID 0x0007 /*external file list id */ #define H5O_EFL_ALLOC 16 /*number of slots to alloc at once */ #define H5O_EFL_UNLIMITED H5F_UNLIMITED /*max possible file size */ -H5_DLLVAR const H5O_class_t H5O_EFL[1];/*external file list class */ typedef struct H5O_efl_entry_t { size_t name_offset; /*offset of name within heap */ @@ -200,10 +117,9 @@ typedef struct H5O_efl_t { /* * Data Layout Message. + * (Data structure in memory) */ -#define H5O_LAYOUT_ID 0x0008 #define H5O_LAYOUT_NDIMS (H5S_MAX_RANK+1) -H5_DLLVAR const H5O_class_t H5O_LAYOUT[1]; typedef struct H5O_layout_t { int type; /*type of layout, H5D_layout_t */ @@ -221,10 +137,8 @@ typedef struct H5O_layout_t { #ifdef H5O_ENABLE_BOGUS /* * "Bogus" Message. + * (Data structure in memory) */ -#define H5O_BOGUS_ID 0x0009 -H5_DLLVAR const H5O_class_t H5O_BOGUS[1]; - #define H5O_BOGUS_VALUE 0xdeadbeef typedef struct H5O_bogus_t { unsigned u; /* Hold the bogus info */ @@ -233,10 +147,8 @@ typedef struct H5O_bogus_t { /* * Filter pipeline message. + * (Data structure in memory) */ -#define H5O_PLINE_ID 0x000b -H5_DLLVAR const H5O_class_t H5O_PLINE[1]; - typedef struct H5O_pline_t { size_t nfilters; /*num filters defined */ size_t nalloc; /*num elements in `filter' array */ @@ -250,36 +162,19 @@ typedef struct H5O_pline_t { } H5O_pline_t; /* - * Attribute Message. - */ -#define H5O_ATTR_ID 0x000c -H5_DLLVAR const H5O_class_t H5O_ATTR[1]; - -/* operates on an H5A_t struct */ - -/* * Object name message. + * (Data structure in memory) */ -#define H5O_NAME_ID 0x000d -H5_DLLVAR const H5O_class_t H5O_NAME[1]; typedef struct H5O_name_t { char *s; /*ptr to malloc'd memory */ } H5O_name_t; /* - * Modification time message. The message is just a `time_t'. - */ -#define H5O_MTIME_ID 0x000e -H5_DLLVAR const H5O_class_t H5O_MTIME[1]; - -/* * Shared object message. This message ID never really appears in an object * header. Instead, bit 2 of the `Flags' field will be set and the ID field * will be the ID of the pointed-to message. */ -#define H5O_SHARED_ID 0x000f -H5_DLLVAR const H5O_class_t H5O_SHARED[1]; typedef struct H5O_shared_t { hbool_t in_gh; /*shared by global heap? */ @@ -291,9 +186,8 @@ typedef struct H5O_shared_t { /* * Object header continuation message. + * (Data structure in memory) */ -#define H5O_CONT_ID 0x0010 -H5_DLLVAR const H5O_class_t H5O_CONT[1]; typedef struct H5O_cont_t { haddr_t addr; /*address of continuation block */ @@ -305,85 +199,43 @@ typedef struct H5O_cont_t { /* * Symbol table message. + * (Data structure in memory) */ -#define H5O_STAB_ID 0x0011 -H5_DLLVAR const H5O_class_t H5O_STAB[1]; - -H5_DLL void *H5O_stab_fast(const H5G_cache_t *cache, const H5O_class_t *type, - void *_mesg); - typedef struct H5O_stab_t { haddr_t btree_addr; /*address of B-tree */ haddr_t heap_addr; /*address of name heap */ } H5O_stab_t; -/* - * Modification time message (new format on disk). The message is just a `time_t'. - */ -#define H5O_MTIME_NEW_ID 0x0012 -H5_DLLVAR const H5O_class_t H5O_MTIME_NEW[1]; - -/* - * Generic property list message. - */ -#define H5O_PLIST_ID 0x0013 -H5_DLLVAR const H5O_class_t H5O_PLIST[1]; - -/* operates on an H5P_genplist_t struct */ - -#ifdef H5_HAVE_FPHDF5 -/* - * Flexible parallel message - */ -#define H5O_FPHDF5_ID 0x0014 -H5_DLLVAR const H5O_class_t H5O_FPHDF5[1]; - -struct H5S_simple_t; -struct H5P_genplist_t; - -typedef struct H5O_fphdf5_t { - uint8_t oid[H5R_OBJ_REF_BUF_SIZE]; /* OID of object */ - haddr_t header; /* Header address info */ - struct H5S_simple_t *sdim; /* Simple dimensionality structure */ - H5T_t *dtype; /* Datatype structure */ - time_t *mtime; /* Modification time */ - H5O_layout_t *layout; /* Dataset layout */ - H5O_name_t *group; /* Group name */ - H5O_name_t *dset; /* Dataset name */ - struct H5P_genplist_t *plist; /* Property list of the object */ -} H5O_fphdf5_t; - -/* operates on an H5O_fphdf5_t struct */ -#endif /* H5_HAVE_FPHDF5 */ - /* General message operators */ H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/); H5_DLL herr_t H5O_open(H5G_entry_t *ent); H5_DLL herr_t H5O_close(H5G_entry_t *ent); H5_DLL int H5O_link(H5G_entry_t *ent, int adjust, hid_t dxpl_id); -H5_DLL int H5O_count(H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id); -H5_DLL htri_t H5O_exists(H5G_entry_t *ent, const H5O_class_t *type, - int sequence, hid_t dxpl_id); -H5_DLL void *H5O_read(H5G_entry_t *ent, const H5O_class_t *type, - int sequence, void *mesg, hid_t dxpl_id); -H5_DLL int H5O_modify(H5G_entry_t *ent, const H5O_class_t *type, +H5_DLL int H5O_count(H5G_entry_t *ent, hid_t type_id, hid_t dxpl_id); +H5_DLL htri_t H5O_exists(H5G_entry_t *ent, hid_t type_id, int sequence, + hid_t dxpl_id); +H5_DLL void *H5O_read(H5G_entry_t *ent, hid_t type_id, int sequence, + void *mesg, hid_t dxpl_id); +H5_DLL int H5O_modify(H5G_entry_t *ent, hid_t type_id, int overwrite, unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id); -H5_DLL H5O_t * H5O_protect(H5G_entry_t *ent, hid_t dxpl_id); -H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id); -H5_DLL int H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, +H5_DLL struct H5O_t * H5O_protect(H5G_entry_t *ent, hid_t dxpl_id); +H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, struct H5O_t *oh, hid_t dxpl_id); +H5_DLL int H5O_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, hid_t type_id, unsigned flags, const void *mesg); H5_DLL herr_t H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id); -H5_DLL herr_t H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force); +H5_DLL herr_t H5O_touch_oh(H5F_t *f, struct H5O_t *oh, hbool_t force); #ifdef H5O_ENABLE_BOGUS H5_DLL herr_t H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id); -H5_DLL herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh); +H5_DLL herr_t H5O_bogus_oh(H5F_t *f, struct H5O_t *oh); #endif /* H5O_ENABLE_BOGUS */ -H5_DLL herr_t H5O_remove(H5G_entry_t *ent, const H5O_class_t *type, - int sequence, hid_t dxpl_id); -H5_DLL herr_t H5O_reset(const H5O_class_t *type, void *native); -H5_DLL void *H5O_free(const H5O_class_t *type, void *mesg); -H5_DLL void *H5O_copy(const H5O_class_t *type, const void *mesg, void *dst); +H5_DLL herr_t H5O_remove(H5G_entry_t *ent, hid_t type_id, int sequence, + hid_t dxpl_id); +H5_DLL herr_t H5O_reset(hid_t type_id, void *native); +H5_DLL void *H5O_free(hid_t type_id, void *mesg); +H5_DLL void *H5O_copy(hid_t type_id, const void *mesg, void *dst); +H5_DLL size_t H5O_raw_size(hid_t type_id, H5F_t *f, const void *mesg); +H5_DLL herr_t H5O_debug_id(hid_t type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth); H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth); diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 2778826..59c44ee 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -1,17 +1,18 @@ -/**************************************************************************** -* NCSA HDF * -* Software Development Group * -* National Center for Supercomputing Applications * -* University of Illinois at Urbana-Champaign * -* 605 E. Springfield, Champaign IL 61820 * -* * -* For conditions of distribution and use, see the accompanying * -* hdf/COPYING file. * -* * -****************************************************************************/ - -/* $Id$ */ - +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ #define H5S_PACKAGE /*prevent warning from including H5Spkg.h */ #include "H5private.h" @@ -19,7 +20,7 @@ #include "H5FLprivate.h" /*Free Lists */ #include "H5Gprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #include "H5Spkg.h" #define PABLO_MASK H5O_sdspace_mask diff --git a/src/H5Oshared.c b/src/H5Oshared.c index e9e844e..21f5154 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -1,7 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /* - * Copyright (C) 1998-2001 NCSA - * All rights reserved. - * * Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, April 1, 1998 * @@ -14,10 +25,12 @@ * the global heap. */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ static void *H5O_shared_decode (H5F_t*, hid_t dxpl_id, const uint8_t*, H5O_shared_t *sh); static herr_t H5O_shared_encode (H5F_t*, uint8_t*, const void*); diff --git a/src/H5Ostab.c b/src/H5Ostab.c index d90b517..3258964 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -1,8 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /*------------------------------------------------------------------------- - * Copyright (C) 1997-2001 National Center for Supercomputing Applications - * All rights reserved. - * - *------------------------------------------------------------------------- * * Created: H5Ostab.c * Aug 6 1997 @@ -14,12 +24,15 @@ * *------------------------------------------------------------------------- */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ + #include "H5private.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ #include "H5Gprivate.h" #include "H5MMprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* Object header functions */ #define PABLO_MASK H5O_stab_mask diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 708506c..a938d12 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -888,7 +888,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Reset the fill structure */ - if(H5O_reset(H5O_FILL, &fill)<0) + if(H5O_reset(H5O_FILL_ID, &fill)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset fill value"); if(value) { @@ -1,16 +1,16 @@ -/**************************************************************************** -* NCSA HDF * -* Software Development Group * -* National Center for Supercomputing Applications * -* University of Illinois at Urbana-Champaign * -* 605 E. Springfield, Champaign IL 61820 * -* * -* For conditions of distribution and use, see the accompanying * -* hdf/COPYING file. * -* * -****************************************************************************/ - -/* $Id$ */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ @@ -1087,7 +1087,7 @@ H5S_modify(H5G_entry_t *ent, const H5S_t *ds, hbool_t update_time, hid_t dxpl_id switch (ds->extent.type) { case H5S_SCALAR: case H5S_SIMPLE: - if (H5O_modify(ent, H5O_SDSPACE, 0, 0, update_time, &(ds->extent.u.simple), dxpl_id)<0) + if (H5O_modify(ent, H5O_SDSPACE_ID, 0, 0, update_time, &(ds->extent.u.simple), dxpl_id)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple data space message"); break; @@ -1120,7 +1120,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5S_t *ds) +H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1133,7 +1133,7 @@ H5S_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5S_t *ds) switch (ds->extent.type) { case H5S_SCALAR: case H5S_SIMPLE: - if (H5O_append(f, dxpl_id, oh, H5O_SDSPACE, 0, &(ds->extent.u.simple))<0) + if (H5O_append(f, dxpl_id, oh, H5O_SDSPACE_ID, 0, &(ds->extent.u.simple))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple data space message"); break; @@ -1182,7 +1182,7 @@ H5S_read(H5G_entry_t *ent, hid_t dxpl_id) if (NULL==(ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - if (H5O_read(ent, H5O_SDSPACE, 0, &(ds->extent.u.simple), dxpl_id) == NULL) + if (H5O_read(ent, H5O_SDSPACE_ID, 0, &(ds->extent.u.simple), dxpl_id) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to load dataspace info from dataset header"); if(ds->extent.u.simple.rank != 0) { @@ -2038,7 +2038,7 @@ H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, case H5S_SIMPLE: fprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth, "Space class:"); - (H5O_SDSPACE->debug)(f, dxpl_id, &(mesg->extent.u.simple), stream, + H5O_debug_id(H5O_SDSPACE_ID, f, dxpl_id, &(mesg->extent.u.simple), stream, indent+3, MAX(0, fwidth-3)); break; diff --git a/src/H5Sall.c b/src/H5Sall.c index a8e5f40..7ca2d8d 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -108,7 +108,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_all_iter_release (H5S_sel_iter_t * UNUSED sel_iter) +H5S_all_iter_release (H5S_sel_iter_t UNUSED * sel_iter) { herr_t ret_value=SUCCEED; /* Return value */ @@ -140,7 +140,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_all_release (H5S_t * UNUSED space) +H5S_all_release (H5S_t UNUSED * space) { herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5Snone.c b/src/H5Snone.c index a7db217..5bbcb11 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -100,7 +100,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_none_iter_release (H5S_sel_iter_t * UNUSED sel_iter) +H5S_none_iter_release (H5S_sel_iter_t UNUSED * sel_iter) { herr_t ret_value=SUCCEED; /* Return value */ @@ -132,7 +132,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_none_release (H5S_t * UNUSED space) +H5S_none_release (H5S_t UNUSED * space) { herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 8ec2ae6..edce858 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -116,7 +116,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_point_iter_release (H5S_sel_iter_t * UNUSED sel_iter) +H5S_point_iter_release (H5S_sel_iter_t UNUSED * sel_iter) { herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 903276a..31a0d9f 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -1,14 +1,16 @@ -/**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * - ****************************************************************************/ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * This file contains private information about the H5S module @@ -152,7 +154,7 @@ H5_DLL herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t const hsize_t *max); H5_DLL herr_t H5S_modify(struct H5G_entry_t *ent, const H5S_t *space, hbool_t update_time, hid_t dxpl_id); -H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5S_t *ds); +H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds); H5_DLL H5S_t *H5S_read(struct H5G_entry_t *ent, hid_t dxpl_id); H5_DLL int H5S_cmp(const H5S_t *ds1, const H5S_t *ds2); H5_DLL htri_t H5S_is_simple(const H5S_t *sdim); @@ -3405,7 +3405,7 @@ H5T_isa(H5G_entry_t *ent, hid_t dxpl_id) FUNC_ENTER_NOAPI(H5T_isa, FAIL); assert(ent); - if ((ret_value=H5O_exists(ent, H5O_DTYPE, 0, dxpl_id))<0) + if ((ret_value=H5O_exists(ent, H5O_DTYPE_ID, 0, dxpl_id))<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to read object header"); done: @@ -3489,7 +3489,7 @@ H5T_open_oid (H5G_entry_t *ent, hid_t dxpl_id) if (H5O_open (ent)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named data type"); - if (NULL==(dt=H5O_read (ent, H5O_DTYPE, 0, NULL, dxpl_id))) + if (NULL==(dt=H5O_read (ent, H5O_DTYPE_ID, 0, NULL, dxpl_id))) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header"); /* Mark the type as named and open */ @@ -5054,7 +5054,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_print_stats(H5T_path_t * UNUSED path, int * UNUSED nprint/*in,out*/) +H5T_print_stats(H5T_path_t UNUSED * path, int UNUSED * nprint/*in,out*/) { #ifdef H5T_DEBUG hsize_t nbytes; diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 6619392..1360408 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -151,7 +151,7 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id) */ if (H5O_create (file, dxpl_id, 64, &(type->ent))<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create data type object header"); - if (H5O_modify (&(type->ent), H5O_DTYPE, 0, H5O_FLAG_CONSTANT, 1, type, dxpl_id)<0) + if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, 1, type, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message"); if (H5G_insert (loc, name, &(type->ent), dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name data type"); diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index bd4c68f..d0af8e2 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -94,7 +94,7 @@ static unsigned int H5Z_filter_fletcher32_compute(unsigned short *buf, size_t le *------------------------------------------------------------------------- */ size_t -H5Z_filter_fletcher32 (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], +H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned UNUSED cd_values[], size_t nbytes, size_t *buf_size, void **buf) { size_t ret_value = 0; diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index a33d3cd..3dc7557 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -46,8 +46,8 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf) { void *dest = NULL; /* Buffer to deposit [un]shuffled bytes into */ - unsigned char *_src; /* Alias for source buffer */ - unsigned char *_dest; /* Alias for destination buffer */ + unsigned char *_src=NULL; /* Alias for source buffer */ + unsigned char *_dest=NULL; /* Alias for destination buffer */ unsigned bytesoftype; /* Number of bytes per element */ size_t numofelements; /* Number of elements in buffer */ size_t i,j; /* Local index variables */ diff --git a/src/Makefile.in b/src/Makefile.in index 92a1ee9..ea0e957 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -35,7 +35,7 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcontig.c \ H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c H5G.c H5Gent.c \ H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c H5MM.c H5O.c H5Oattr.c \ H5Obogus.c H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Olayout.c \ - H5Omtime.c H5Oname.c H5Onull.c H5Opline.c H5Oplist.c H5Osdspace.c \ + H5Omtime.c H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c \ H5Oshared.c H5Ostab.c H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c \ H5R.c H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ H5Sselect.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \ diff --git a/test/dsets.c b/test/dsets.c index ee17690..baf7303 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -687,8 +687,8 @@ corrupt_data(unsigned int flags, size_t cd_nelmts, *------------------------------------------------------------------------- */ static H5Z_cb_return_t -filter_cb_cont(H5Z_filter_t filter, void* UNUSED buf, size_t UNUSED buf_size, - void* UNUSED op_data) +filter_cb_cont(H5Z_filter_t filter, void UNUSED *buf, size_t UNUSED buf_size, + void UNUSED *op_data) { if(H5Z_FILTER_FLETCHER32==filter) return H5Z_CB_CONT; @@ -712,8 +712,8 @@ filter_cb_cont(H5Z_filter_t filter, void* UNUSED buf, size_t UNUSED buf_size, *------------------------------------------------------------------------- */ static H5Z_cb_return_t -filter_cb_fail(H5Z_filter_t filter, void* UNUSED buf, size_t UNUSED buf_size, - void* UNUSED op_data) +filter_cb_fail(H5Z_filter_t filter, void UNUSED *buf, size_t UNUSED buf_size, + void UNUSED *op_data) { if(H5Z_FILTER_FLETCHER32==filter) return H5Z_CB_FAIL; diff --git a/test/istore.c b/test/istore.c index 3f1e16e..7078bc3 100644 --- a/test/istore.c +++ b/test/istore.c @@ -1,12 +1,23 @@ -/* - * Copyright (C) 1997 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Wednesday, October 15, 1997 * * Purpose: Tests various aspects of indexed raw data storage. */ + #define H5F_PACKAGE /*suppress error about including H5Fpkg */ #include "h5test.h" @@ -119,7 +130,7 @@ new_object(H5F_t *f, const char *name, unsigned ndims, H5G_entry_t *ent/*out*/) } /* Create the root of the B-tree that describes chunked storage */ H5F_istore_create (f, H5P_DATASET_XFER_DEFAULT, &layout/*in,out*/); - if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, 1, &layout, H5P_DATASET_XFER_DEFAULT) < 0) { + if (H5O_modify(ent, H5O_LAYOUT_ID, H5O_NEW_MESG, 0, 1, &layout, H5P_DATASET_XFER_DEFAULT) < 0) { H5_FAILED(); puts(" H5O_modify istore message failure."); goto error; @@ -247,7 +258,7 @@ test_extend(H5F_t *f, const char *prefix, printf(" Cannot create %u-d object `%s'\n", ndims, name); goto error; } - if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { + if (NULL == H5O_read(&handle, H5O_LAYOUT_ID, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" Unable to read istore message."); goto error; @@ -456,7 +467,7 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks, printf(" Cannot create %u-d object `%s'\n", ndims, name); goto error; } - if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { + if (NULL == H5O_read(&handle, H5O_LAYOUT_ID, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); printf(" Unable to read istore message\n"); goto error; diff --git a/test/ohdr.c b/test/ohdr.c index 143146d..a0b9415 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1,13 +1,27 @@ -/* - * Copyright © 1998 NCSA - * All rights reserved. - * - * Programmer: Robb Matzke <matzke@llnl.gov> +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Robb Matzke <matzke@llnl.gov> * Tuesday, November 24, 1998 */ #include "h5test.h" #include "H5Iprivate.h" -#include "H5Oprivate.h" +/* + * This file needs to access private datatypes from the H5O package. + */ +#define H5O_PACKAGE +#include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. @@ -80,7 +94,7 @@ main(void) TESTING("message creation"); stab.btree_addr = 11111111; stab.heap_addr = 22222222; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -90,7 +104,7 @@ main(void) H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -112,7 +126,7 @@ main(void) TESTING("message modification"); stab.btree_addr = 33333333; stab.heap_addr = 44444444; - if (H5O_modify(&oh_ent, H5O_STAB, 0, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_modify(&oh_ent, H5O_STAB_ID, 0, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -122,7 +136,7 @@ main(void) H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -145,7 +159,7 @@ main(void) TESTING("duplicate message creation"); stab.btree_addr = 55555555; stab.heap_addr = 66666666; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -155,7 +169,7 @@ main(void) H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -177,7 +191,7 @@ main(void) TESTING("duplicate message modification"); stab.btree_addr = 77777777; stab.heap_addr = 88888888; - if (H5O_modify(&oh_ent, H5O_STAB, 1, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_modify(&oh_ent, H5O_STAB_ID, 1, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -187,7 +201,7 @@ main(void) H5Eprint(stdout); goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -211,7 +225,7 @@ main(void) for (i=0; i<40; i++) { stab.btree_addr = (i+1)*1000+1; stab.heap_addr = (i+1)*1000+2; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -232,7 +246,7 @@ main(void) for (i=0; i<10; i++) { stab.btree_addr = (i + 1) * 1000 + 10; stab.heap_addr = (i + 1) * 1000 + 20; - if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; @@ -249,12 +263,12 @@ main(void) * Delete all symbol table messages. */ TESTING("message deletion"); - if (H5O_remove(&oh_ent, H5O_STAB, H5O_ALL, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_remove(&oh_ent, H5O_STAB_ID, H5O_ALL, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint(stdout); goto error; } - if (H5O_read(&oh_ent, H5O_STAB, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (H5O_read(&oh_ent, H5O_STAB_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" H5O_read() should have failed but didn't"); H5Eclear(); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 9ec4cbd..87ecb49 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1117,7 +1117,7 @@ dump_dataspace(hid_t space) *------------------------------------------------------------------------- */ static herr_t -dump_attr(hid_t attr, const char *attr_name, void * UNUSED op_data) +dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data) { hid_t attr_id, type, space; herr_t ret = SUCCEED; @@ -1998,7 +1998,7 @@ set_output_file(const char *fname) *------------------------------------------------------------------------- */ static void -handle_attributes(hid_t fid, char *attr, void * UNUSED data) +handle_attributes(hid_t fid, char *attr, void UNUSED * data) { dump_selected_attr(fid, attr); } @@ -2258,7 +2258,7 @@ handle_datasets(hid_t fid, char *dset, void *data) *------------------------------------------------------------------------- */ static void -handle_groups(hid_t fid, char *group, void * UNUSED data) +handle_groups(hid_t fid, char *group, void UNUSED * data) { H5G_stat_t statbuf; hid_t gid; @@ -2303,7 +2303,7 @@ handle_groups(hid_t fid, char *group, void * UNUSED data) *------------------------------------------------------------------------- */ static void -handle_links(hid_t fid, char *links, void * UNUSED data) +handle_links(hid_t fid, char *links, void UNUSED * data) { H5G_stat_t statbuf; @@ -2359,7 +2359,7 @@ handle_links(hid_t fid, char *links, void * UNUSED data) *------------------------------------------------------------------------- */ static void -handle_datatypes(hid_t fid, char *type, void * UNUSED data) +handle_datatypes(hid_t fid, char *type, void UNUSED * data) { hid_t type_id; @@ -3200,7 +3200,7 @@ lookup_ref_path(hobj_ref_t * ref) *------------------------------------------------------------------------- */ static herr_t -fill_ref_path_table(hid_t group, const char *name, void * UNUSED op_data) +fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) { hid_t obj; char *tmp; @@ -3980,7 +3980,7 @@ xml_dump_dataspace(hid_t space) *------------------------------------------------------------------------- */ static void -xml_dump_data(hid_t obj_id, int obj_data, struct subset_t * UNUSED sset) +xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset) { h5dump_t *outputformat = &xml_dataformat; int status = -1; @@ -4084,7 +4084,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t * UNUSED sset) *------------------------------------------------------------------------- */ static herr_t -xml_dump_attr(hid_t attr, const char *attr_name, void * UNUSED op_data) +xml_dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data) { hid_t attr_id, type, space; char *t_aname = xml_escape_the_name(attr_name); @@ -4744,7 +4744,7 @@ check_compression(hid_t dcpl) *------------------------------------------------------------------------- */ static void -xml_dump_dataset(hid_t did, const char *name, struct subset_t * UNUSED sset) +xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) { hid_t type, space; hid_t dcpl; diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 09b8c7f..c532e5d 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -15,6 +15,7 @@ *------------------------------------------------------------------------- */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ #include "H5private.h" #include "H5Iprivate.h" @@ -24,7 +25,7 @@ #include "H5Gprivate.h" #include "H5HGprivate.h" #include "H5HLprivate.h" -#include "H5Oprivate.h" +#include "H5Opkg.h" /* File drivers */ #include "H5FDfamily.h" |