1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * Copyright by the Board of Trustees of the University of Illinois. * 4 * All rights reserved. * 5 * * 6 * This file is part of HDF5. The full HDF5 copyright notice, including * 7 * terms governing use, modification, and redistribution, is contained in * 8 * the files COPYING and Copyright.html. COPYING can be found at the root * 9 * of the source code distribution tree; Copyright.html can be found at the * 10 * root level of an installed copy of the electronic HDF5 document set and * 11 * is linked from the top-level documents page. It can also be found at * 12 * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * 13 * access to either file, you may request a copy from help@hdfgroup.org. * 14 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 15 16 #ifndef H5O_PACKAGE 17 #error "Do not include this file outside the H5O package!" 18 #endif 19 20 #ifndef _H5Opkg_H 21 #define _H5Opkg_H 22 23 /* Get package's private header */ 24 #include "H5Oprivate.h" /* Object headers */ 25 26 /* Other private headers needed by this file */ 27 #include "H5ACprivate.h" /* Metadata cache */ 28 #include "H5FLprivate.h" /* Free Lists */ 29 30 /* Object header macros */ 31 #define H5O_NMESGS 8 /*initial number of messages */ 32 #define H5O_NCHUNKS 2 /*initial number of chunks */ 33 #define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */ 34 #define H5O_MSG_TYPES 24 /* # of types of messages */ 35 #define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */ 36 37 /* Versions of object header structure */ 38 39 /* Initial version of the object header format */ 40 #define H5O_VERSION_1 1 41 42 /* Revised version - leaves out reserved bytes and alignment padding, and adds 43 * magic number as prefix and checksum as suffix for all chunks. 44 */ 45 #define H5O_VERSION_2 2 46 47 /* The latest version of the format. Look through the 'flush' 48 * and 'size' callback for places to change when updating this. */ 49 #define H5O_VERSION_LATEST H5O_VERSION_2 50 51 /* 52 * Align messages on 8-byte boundaries because we would like to copy the 53 * object header chunks directly into memory and operate on them there, even 54 * on 64-bit architectures. This allows us to reduce the number of disk I/O 55 * requests with a minimum amount of mem-to-mem copies. 56 * 57 * Note: We no longer attempt to do this. - QAK, 10/16/06 58 */ 59 #define H5O_ALIGN_OLD(X) (8 * (((X) + 7) / 8)) 60 #define H5O_ALIGN_VERS(V, X) \ 61 (((V) == H5O_VERSION_1) ? \ 62 H5O_ALIGN_OLD(X) \ 63 : \ 64 (X) \ 65 ) 66 #define H5O_ALIGN_OH(O, X) \ 67 H5O_ALIGN_VERS((O)->version, X) 68 #define H5O_ALIGN_F(F, X) \ 69 H5O_ALIGN_VERS((H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), X) 70 71 /* Size of checksum (on disk) */ 72 #define H5O_SIZEOF_CHKSUM 4 73 74 /* ========= Object Creation properties ============ */ 75 /* Default values for some of the object creation properties */ 76 /* NOTE: The H5O_CRT_ATTR_MAX_COMPACT_DEF & H5O_CRT_ATTR_MIN_DENSE_DEF values 77 * are "built into" the file format, make certain existing files with 78 * default attribute phase change storage are handled correctly if they 79 * are changed. 80 */ 81 #define H5O_CRT_ATTR_MAX_COMPACT_DEF 8 82 #define H5O_CRT_ATTR_MIN_DENSE_DEF 6 83 #define H5O_CRT_OHDR_FLAGS_DEF H5O_HDR_STORE_TIMES 84 85 /* Object header status flag definitions */ 86 #define H5O_HDR_CHUNK0_1 0x00 /* Use 1-byte value for chunk #0 size */ 87 #define H5O_HDR_CHUNK0_2 0x01 /* Use 2-byte value for chunk #0 size */ 88 #define H5O_HDR_CHUNK0_4 0x02 /* Use 4-byte value for chunk #0 size */ 89 #define H5O_HDR_CHUNK0_8 0x03 /* Use 8-byte value for chunk #0 size */ 90 91 /* 92 * Size of object header prefix. 93 */ 94 #define H5O_SIZEOF_HDR(O) \ 95 (((O)->version == H5O_VERSION_1) \ 96 ? \ 97 H5O_ALIGN_OLD(1 + /*version number */ \ 98 1 + /*reserved */ \ 99 2 + /*number of messages */ \ 100 4 + /*reference count */ \ 101 4) /*chunk data size */ \ 102 : \ 103 (H5_SIZEOF_MAGIC + /*magic number */ \ 104 1 + /*version number */ \ 105 1 + /*flags */ \ 106 (((O)->flags & H5O_HDR_STORE_TIMES) ? ( \ 107 4 + /*access time */ \ 108 4 + /*modification time */ \ 109 4 + /*change time */ \ 110 4 /*birth time */ \ 111 ) : 0) + \ 112 (((O)->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? ( \ 113 2 + /*max compact attributes */ \ 114 2 /*min dense attributes */ \ 115 ) : 0) + \ 116 (1 << ((O)->flags & H5O_HDR_CHUNK0_SIZE)) + /*chunk 0 data size */ \ 117 H5O_SIZEOF_CHKSUM) /*checksum size */ \ 118 ) 119 120 /* 121 * Size of object header message prefix 122 */ 123 #define H5O_SIZEOF_MSGHDR_VERS(V,C) \ 124 (((V) == H5O_VERSION_1) \ 125 ? \ 126 H5O_ALIGN_OLD(2 + /*message type */ \ 127 2 + /*sizeof message data */ \ 128 1 + /*flags */ \ 129 3) /*reserved */ \ 130 : \ 131 (1 + /*message type */ \ 132 2 + /*sizeof message data */ \ 133 1 + /*flags */ \ 134 ((C) ? ( \ 135 2 /*creation index */ \ 136 ) : 0)) \ 137 ) 138 #define H5O_SIZEOF_MSGHDR_OH(O) \ 139 H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) 140 #define H5O_SIZEOF_MSGHDR_F(F, C) \ 141 H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FORMAT(F) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C)) 142 143 /* 144 * Size of chunk "header" for each chunk 145 */ 146 #define H5O_SIZEOF_CHKHDR_VERS(V) \ 147 (((V) == H5O_VERSION_1) \ 148 ? \ 149 0 + /*no magic # */ \ 150 0 /*no checksum */ \ 151 : \ 152 H5_SIZEOF_MAGIC + /*magic # */ \ 153 H5O_SIZEOF_CHKSUM /*checksum */ \ 154 ) 155 #define H5O_SIZEOF_CHKHDR_OH(O) \ 156 H5O_SIZEOF_CHKHDR_VERS((O)->version) 157 158 /* 159 * Size of checksum for each chunk 160 */ 161 #define H5O_SIZEOF_CHKSUM_VERS(V) \ 162 (((V) == H5O_VERSION_1) \ 163 ? \ 164 0 /*no checksum */ \ 165 : \ 166 H5O_SIZEOF_CHKSUM /*checksum */ \ 167 ) 168 #define H5O_SIZEOF_CHKSUM_OH(O) \ 169 H5O_SIZEOF_CHKSUM_VERS((O)->version) 170 171 /* Input/output flags for decode functions */ 172 #define H5O_DECODEIO_NOCHANGE 0x01u /* IN: do not modify values */ 173 #define H5O_DECODEIO_DIRTY 0x02u /* OUT: message has been changed */ 174 175 /* Macro to incremend ndecode_dirtied (only if we are debugging) */ 176 #ifndef NDEBUG 177 #define INCR_NDECODE_DIRTIED(OH) (OH)->ndecode_dirtied++; 178 #else /* NDEBUG */ 179 #define INCR_NDECODE_DIRTIED(OH) ; 180 #endif /* NDEBUG */ 181 182 /* Load native information for a message, if it's not already present */ 183 /* (Only works for messages with decode callback) */ 184 #define H5O_LOAD_NATIVE(F, DXPL, IOF, OH, MSG, ERR) \ 185 if(NULL == (MSG)->native) { \ 186 const H5O_msg_class_t *msg_type = (MSG)->type; \ 187 unsigned ioflags = (IOF); \ 188 \ 189 /* Decode the message */ \ 190 HDassert(msg_type->decode); \ 191 if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw))) \ 192 HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \ 193 \ 194 /* Mark the message dirty if it was changed by decoding */ \ 195 if((ioflags & H5O_DECODEIO_DIRTY) && (H5F_get_intent((F)) & H5F_ACC_RDWR)) { \ 196 (MSG)->dirty = TRUE; \ 197 /* Increment the count of messages dirtied by decoding, but */ \ 198 /* only ifndef NDEBUG */ \ 199 INCR_NDECODE_DIRTIED(OH) \ 200 } \ 201 \ 202 /* Set the message's "shared info", if it's shareable */ \ 203 if((MSG)->flags & H5O_MSG_FLAG_SHAREABLE) { \ 204 H5O_UPDATE_SHARED((H5O_shared_t *)(MSG)->native, H5O_SHARE_TYPE_HERE, (F), msg_type->id, (MSG)->crt_idx, (OH)->chunk[0].addr) \ 205 } /* end if */ \ 206 \ 207 /* Set the message's "creation index", if it has one */ \ 208 if(msg_type->set_crt_index) { \ 209 /* Set the creation index for the message */ \ 210 if((msg_type->set_crt_index)((MSG)->native, (MSG)->crt_idx) < 0) \ 211 HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, ERR, "unable to set creation index") \ 212 } /* end if */ \ 213 } /* end if */ 214 215 /* Flags for a message class's "sharability" */ 216 #define H5O_SHARE_IS_SHARABLE 0x01 217 #define H5O_SHARE_IN_OHDR 0x02 218 219 220 /* The "message class" type */ 221 struct H5O_msg_class_t { 222 unsigned id; /*message type ID on disk */ 223 const char *name; /*for debugging */ 224 size_t native_size; /*size of native message */ 225 unsigned share_flags; /* Message sharing settings */ 226 void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *); 227 herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *); 228 void *(*copy)(const void *, void *); /*copy native value */ 229 size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */ 230 herr_t (*reset)(void *); /*free nested data structs */ 231 herr_t (*free)(void *); /*free main data struct */ 232 herr_t (*del)(H5F_t *, hid_t, H5O_t *, void *); /* Delete space in file referenced by this message */ 233 herr_t (*link)(H5F_t *, hid_t, H5O_t *, void *); /* Increment any links in file reference by this message */ 234 herr_t (*set_share)(void*, const H5O_shared_t*); /* Set shared information */ 235 htri_t (*can_share)(const void *); /* Is message allowed to be shared? */ 236 herr_t (*pre_copy_file)(H5F_t *, const void *, hbool_t *, const H5O_copy_t *, void *); /*"pre copy" action when copying native value to file */ 237 void *(*copy_file)(H5F_t *, void *, H5F_t *, hbool_t *, unsigned *, H5O_copy_t *, void *, hid_t); /*copy native value to file */ 238 herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, unsigned *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */ 239 herr_t (*get_crt_index)(const void *, H5O_msg_crt_idx_t *); /* Get message's creation index */ 240 herr_t (*set_crt_index)(void *, H5O_msg_crt_idx_t); /* Set message's creation index */ 241 herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int); 242 }; 243 244 struct H5O_mesg_t { 245 const H5O_msg_class_t *type; /*type of message */ 246 hbool_t dirty; /*raw out of date wrt native */ 247 hbool_t locked; /*message is locked into chunk */ 248 uint8_t flags; /*message flags */ 249 H5O_msg_crt_idx_t crt_idx; /*message creation index */ 250 unsigned chunkno; /*chunk number for this mesg */ 251 void *native; /*native format message */ 252 uint8_t *raw; /*ptr to raw data */ 253 size_t raw_size; /*size with alignment */ 254 }; 255 256 typedef struct H5O_chunk_t { 257 haddr_t addr; /*chunk file address */ 258 size_t size; /*chunk size */ 259 size_t gap; /*space at end of chunk too small for null message */ 260 uint8_t *image; /*image of file */ 261 } H5O_chunk_t; 262 263 struct H5O_t { 264 H5AC_info_t cache_info; /* Information for metadata cache functions, _must_ be */ 265 /* first field in structure */ 266 267 /* File-specific information (not stored) */ 268 size_t sizeof_size; /* Size of file sizes */ 269 size_t sizeof_addr; /* Size of file addresses */ 270 271 /* Debugging information (not stored) */ 272 #ifdef H5O_ENABLE_BAD_MESG_COUNT 273 hbool_t store_bad_mesg_count; /* Flag to indicate that a bad message count should be stored */ 274 /* (This is to simulate a bug in earlier 275 * versions of the library) 276 */ 277 #endif /* H5O_ENABLE_BAD_MESG_COUNT */ 278 #ifndef NDEBUG 279 size_t ndecode_dirtied; /* Number of messages dirtied by decoding */ 280 #endif /* NDEBUG */ 281 282 /* Chunk management information (not stored) */ 283 size_t rc; /* Reference count of [continuation] chunks using this structure */ 284 size_t chunk0_size; /* Size of serialized first chunk */ 285 hbool_t mesgs_modified; /* Whether any messages were modified when the object header was deserialized */ 286 hbool_t prefix_modified; /* Whether prefix was modified when the object header was deserialized */ 287 288 /* Object information (stored) */ 289 hbool_t has_refcount_msg; /* Whether the object has a ref. count message */ 290 unsigned nlink; /*link count */ 291 uint8_t version; /*version number */ 292 uint8_t flags; /*flags */ 293 294 /* Time information (stored, for versions > 1 & H5O_HDR_STORE_TIMES flag set) */ 295 time_t atime; /*access time */ 296 time_t mtime; /*modification time */ 297 time_t ctime; /*change time */ 298 time_t btime; /*birth time */ 299 300 /* Attribute information (stored, for versions > 1) */ 301 unsigned max_compact; /* Maximum # of compact attributes */ 302 unsigned min_dense; /* Minimum # of "dense" attributes */ 303 304 /* Message management (stored, encoded in chunks) */ 305 size_t nmesgs; /*number of messages */ 306 size_t alloc_nmesgs; /*number of message slots */ 307 H5O_mesg_t *mesg; /*array of messages */ 308 size_t link_msgs_seen; /* # of link messages seen when loading header */ 309 size_t attr_msgs_seen; /* # of attribute messages seen when loading header */ 310 311 /* Chunk management (not stored) */ 312 size_t nchunks; /*number of chunks */ 313 size_t alloc_nchunks; /*chunks allocated */ 314 H5O_chunk_t *chunk; /*array of chunks */ 315 }; 316 317 /* Class for types of objects in file */ 318 typedef struct H5O_obj_class_t { 319 H5O_type_t type; /*object type on disk */ 320 const char *name; /*for debugging */ 321 void *(*get_copy_file_udata)(void); /*retrieve user data for 'copy file' operation */ 322 void (*free_copy_file_udata)(void *); /*free user data for 'copy file' operation */ 323 htri_t (*isa)(H5O_t *); /*if a header matches an object class */ 324 hid_t (*open)(const H5G_loc_t *, hid_t, hid_t, hbool_t ); /*open an object of this class */ 325 void *(*create)(H5F_t *, void *, H5G_loc_t *, hid_t ); /*create an object of this class */ 326 H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */ 327 herr_t (*bh_info)(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */ 328 herr_t (*flush)(H5G_loc_t *loc, hid_t dxpl_id); /*flush an opened object of this class */ 329 } H5O_obj_class_t; 330 331 /* Node in skip list to map addresses from one file to another during object header copy */ 332 typedef struct H5O_addr_map_t { 333 H5_obj_t src_obj_pos; /* Location of source object */ 334 haddr_t dst_addr; /* Address of object in destination file */ 335 hbool_t is_locked; /* Indicate that the destination object is locked currently */ 336 hsize_t inc_ref_count; /* Number of deferred increments to reference count */ 337 const H5O_obj_class_t *obj_class; /* Object class */ 338 void *udata; /* Object class copy file udata */ 339 } H5O_addr_map_t; 340 341 /* Stack of continuation messages to interpret */ 342 typedef struct H5O_cont_msgs_t { 343 size_t nmsgs; /* Number of continuation messages found so far */ 344 size_t alloc_nmsgs; /* Continuation messages allocated */ 345 H5O_cont_t *msgs; /* Array of continuation messages */ 346 } H5O_cont_msgs_t; 347 348 /* Common callback information for loading object header prefix from disk */ 349 typedef struct H5O_common_cache_ud_t { 350 H5F_t *f; /* Pointer to file for object header/chunk */ 351 hid_t dxpl_id; /* DXPL for operation */ 352 unsigned file_intent; /* Read/write intent for file */ 353 unsigned merged_null_msgs; /* Number of null messages merged together */ 354 hbool_t mesgs_modified; /* Whether any messages were modified when the object header was deserialized */ 355 H5O_cont_msgs_t *cont_msg_info; /* Pointer to continuation messages to work on */ 356 haddr_t addr; /* Address of the prefix or chunk */ 357 } H5O_common_cache_ud_t; 358 359 /* Callback information for loading object header prefix from disk */ 360 typedef struct H5O_cache_ud_t { 361 hbool_t made_attempt; /* Whether the deserialize routine was already attempted */ 362 unsigned v1_pfx_nmesgs; /* Number of messages from v1 prefix header */ 363 H5O_common_cache_ud_t common; /* Common object header cache callback info */ 364 } H5O_cache_ud_t; 365 366 /* Structure representing each chunk in the cache */ 367 typedef struct H5O_chunk_proxy_t { 368 H5AC_info_t cache_info; /* Information for metadata cache functions, _must_ be */ 369 /* first field in structure */ 370 371 H5O_t *oh; /* Object header for this chunk */ 372 unsigned chunkno; /* Chunk number for this chunk */ 373 } H5O_chunk_proxy_t; 374 375 /* Callback information for loading object header chunk from disk */ 376 typedef struct H5O_chk_cache_ud_t { 377 hbool_t decoding; /* Whether the object header is being decoded */ 378 H5O_t *oh; /* Object header for this chunk */ 379 unsigned chunkno; /* Index of chunk being brought in (for re-loads) */ 380 size_t size; /* Size of chunk in the file */ 381 H5O_common_cache_ud_t common; /* Common object header cache callback info */ 382 } H5O_chk_cache_ud_t; 383 384 385 /* H5O object header inherits cache-like properties from H5AC */ 386 H5_DLLVAR const H5AC_class_t H5AC_OHDR[1]; 387 388 /* H5O object header chunk inherits cache-like properties from H5AC */ 389 H5_DLLVAR const H5AC_class_t H5AC_OHDR_CHK[1]; 390 391 /* Header message ID to class mapping */ 392 H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES]; 393 394 /* Declare external the free list for H5O_t's */ 395 H5FL_EXTERN(H5O_t); 396 397 /* Declare external the free list for H5O_mesg_t sequences */ 398 H5FL_SEQ_EXTERN(H5O_mesg_t); 399 400 /* Declare external the free list for H5O_chunk_t sequences */ 401 H5FL_SEQ_EXTERN(H5O_chunk_t); 402 403 /* Declare external the free list for chunk_image blocks */ 404 H5FL_BLK_EXTERN(chunk_image); 405 406 /* 407 * Object header messages 408 */ 409 410 /* Null Message. (0x0000) */ 411 H5_DLLVAR const H5O_msg_class_t H5O_MSG_NULL[1]; 412 413 /* Simple Dataspace Message. (0x0001) */ 414 H5_DLLVAR const H5O_msg_class_t H5O_MSG_SDSPACE[1]; 415 416 /* Link Information Message. (0x0002) */ 417 H5_DLLVAR const H5O_msg_class_t H5O_MSG_LINFO[1]; 418 419 /* Datatype Message. (0x0003) */ 420 H5_DLLVAR const H5O_msg_class_t H5O_MSG_DTYPE[1]; 421 422 /* Old Fill Value Message. (0x0004) */ 423 H5_DLLVAR const H5O_msg_class_t H5O_MSG_FILL[1]; 424 425 /* New Fill Value Message. (0x0005) */ 426 /* 427 * The new fill value message is fill value plus 428 * space allocation time and fill value writing time and whether fill 429 * value is defined. 430 */ 431 H5_DLLVAR const H5O_msg_class_t H5O_MSG_FILL_NEW[1]; 432 433 /* Link Message. (0x0006) */ 434 H5_DLLVAR const H5O_msg_class_t H5O_MSG_LINK[1]; 435 436 /* External File List Message. (0x0007) */ 437 H5_DLLVAR const H5O_msg_class_t H5O_MSG_EFL[1]; 438 439 /* Data Layout Message. (0x0008) */ 440 H5_DLLVAR const H5O_msg_class_t H5O_MSG_LAYOUT[1]; 441 442 #ifdef H5O_ENABLE_BOGUS 443 /* "Bogus" Message. (0x0009) */ 444 /* 445 * Used for debugging - should never be found in valid HDF5 file. 446 */ 447 H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS[1]; 448 #endif /* H5O_ENABLE_BOGUS */ 449 450 /* Group Information Message. (0x000a) */ 451 H5_DLLVAR const H5O_msg_class_t H5O_MSG_GINFO[1]; 452 453 /* Filter pipeline message. (0x000b) */ 454 H5_DLLVAR const H5O_msg_class_t H5O_MSG_PLINE[1]; 455 456 /* Attribute Message. (0x000c) */ 457 H5_DLLVAR const H5O_msg_class_t H5O_MSG_ATTR[1]; 458 459 /* Object name message. (0x000d) */ 460 H5_DLLVAR const H5O_msg_class_t H5O_MSG_NAME[1]; 461 462 /* Modification Time Message. (0x000e) */ 463 /* 464 * The message is just a `time_t'. 465 * (See also the "new" modification time message) 466 */ 467 H5_DLLVAR const H5O_msg_class_t H5O_MSG_MTIME[1]; 468 469 /* Shared Message information message (0x000f) 470 * A message for the superblock extension, holding information about 471 * the file-wide shared message "SOHM" table 472 */ 473 H5_DLLVAR const H5O_msg_class_t H5O_MSG_SHMESG[1]; 474 475 /* Object Header Continuation Message. (0x0010) */ 476 H5_DLLVAR const H5O_msg_class_t H5O_MSG_CONT[1]; 477 478 /* Symbol Table Message. (0x0011) */ 479 H5_DLLVAR const H5O_msg_class_t H5O_MSG_STAB[1]; 480 481 /* New Modification Time Message. (0x0012) */ 482 /* 483 * The message is just a `time_t'. 484 */ 485 H5_DLLVAR const H5O_msg_class_t H5O_MSG_MTIME_NEW[1]; 486 487 /* v1 B-tree 'K' value message (0x0013) 488 * A message for the superblock extension, holding information about 489 * the file-wide v1 B-tree 'K' values. 490 */ 491 H5_DLLVAR const H5O_msg_class_t H5O_MSG_BTREEK[1]; 492 493 /* Driver info message (0x0014) 494 * A message for the superblock extension, holding information about 495 * the file driver settings 496 */ 497 H5_DLLVAR const H5O_msg_class_t H5O_MSG_DRVINFO[1]; 498 499 /* Attribute Information Message. (0x0015) */ 500 H5_DLLVAR const H5O_msg_class_t H5O_MSG_AINFO[1]; 501 502 /* Reference Count Message. (0x0016) */ 503 H5_DLLVAR const H5O_msg_class_t H5O_MSG_REFCOUNT[1]; 504 505 /* Placeholder for unknown message. (0x0017) */ 506 H5_DLLVAR const H5O_msg_class_t H5O_MSG_UNKNOWN[1]; 507 508 509 /* 510 * Object header "object" types 511 */ 512 513 /* Group Object. (H5O_TYPE_GROUP - 0) */ 514 H5_DLLVAR const H5O_obj_class_t H5O_OBJ_GROUP[1]; 515 516 /* Dataset Object. (H5O_TYPE_DATASET - 1) */ 517 H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; 518 519 /* Datatype Object. (H5O_TYPE_NAMED_DATATYPE - 2) */ 520 H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; 521 522 523 /* Package-local function prototypes */ 524 H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg); 525 H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh); 526 H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref); 527 H5_DLL herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_mesg_t *mesg); 528 H5_DLL const H5O_obj_class_t * H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id); 529 H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted); 530 H5_DLL herr_t H5O_inc_rc(H5O_t *oh); 531 H5_DLL herr_t H5O_dec_rc(H5O_t *oh); 532 H5_DLL herr_t H5O_free(H5O_t *oh); 533 534 /* Object header message routines */ 535 H5_DLL herr_t H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 536 const H5O_msg_class_t *type, unsigned *mesg_flags, void *mesg, 537 size_t *mesg_idx); 538 H5_DLL herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 539 const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, 540 void *mesg); 541 H5_DLL herr_t H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 542 const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, 543 void *mesg); 544 H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg); 545 H5_DLL herr_t H5O_msg_free_mesg(H5O_mesg_t *mesg); 546 H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type); 547 H5_DLL herr_t H5O_msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, 548 int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id); 549 H5_DLL void *H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, 550 void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, 551 unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id); 552 H5_DLL herr_t H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, 553 const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id); 554 555 /* Object header chunk routines */ 556 H5_DLL herr_t H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx); 557 H5_DLL H5O_chunk_proxy_t *H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 558 unsigned idx); 559 H5_DLL herr_t H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, 560 H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied); 561 H5_DLL herr_t H5O_chunk_update_idx(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx); 562 H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy); 563 H5_DLL herr_t H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx); 564 565 /* Collect storage info for btree and heap */ 566 H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 567 H5_ih_info_t *bh_info); 568 569 /* Object header allocation routines */ 570 H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc); 571 H5_DLL herr_t H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 572 const H5O_msg_class_t *type, const void *mesg, size_t *mesg_idx); 573 H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id); 574 H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 575 H5O_mesg_t *mesg, hbool_t adj_link); 576 577 /* Shared object operators */ 578 H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, 579 unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type); 580 H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); 581 H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); 582 H5_DLL herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, 583 const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg); 584 H5_DLL herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, 585 const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg); 586 H5_DLL herr_t H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst, 587 const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst, 588 hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, 589 void *udata, hid_t dxpl_id); 590 H5_DLL herr_t H5O_shared_post_copy_file (H5F_t *f, 591 const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src, 592 H5O_shared_t *shared_dst, unsigned *mesg_flags, hid_t dxpl_id, 593 H5O_copy_t *cpy_info); 594 H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, 595 int indent, int fwidth); 596 597 /* Attribute message operators */ 598 H5_DLL herr_t H5O_attr_reset(void *_mesg); 599 H5_DLL herr_t H5O_attr_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg); 600 H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg); 601 H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, 602 hsize_t *nattrs); 603 604 605 /* These functions operate on object locations */ 606 H5_DLL H5O_loc_t *H5O_get_loc(hid_t id); 607 608 /* Testing functions */ 609 #ifdef H5O_TESTING 610 H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid); 611 H5_DLL htri_t H5O_is_attr_dense_test(hid_t oid); 612 H5_DLL herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs); 613 H5_DLL herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); 614 H5_DLL herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val); 615 H5_DLL herr_t H5O_expunge_chunks_test(const H5O_loc_t *oloc, hid_t dxpl_id); 616 H5_DLL herr_t H5O_get_rc(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc); 617 #endif /* H5O_TESTING */ 618 619 /* Object header debugging routines */ 620 #ifdef H5O_DEBUG 621 H5_DLL herr_t H5O_assert(const H5O_t *oh); 622 #endif /* H5O_DEBUG */ 623 H5_DLL herr_t H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth); 624 625 #endif /* _H5Opkg_H */ 626 627