H5Oprivate.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /*-------------------------------------------------------------------------
00017  *
00018  * Created:             H5Oprivate.h
00019  *                      Aug  5 1997
00020  *                      Robb Matzke <matzke@llnl.gov>
00021  *
00022  * Purpose:             Object header private include file.
00023  *
00024  * Modifications:
00025  *
00026  *-------------------------------------------------------------------------
00027  */
00028 #ifndef _H5Oprivate_H
00029 #define _H5Oprivate_H
00030 
00031 /* Include the public header file for this API */
00032 #include "H5Opublic.h"          /* Object header functions              */
00033 
00034 /* Public headers needed by this file */
00035 #include "H5Dpublic.h"          /* Dataset functions                    */
00036 #include "H5Lpublic.h"          /* Link functions                       */
00037 #include "H5Spublic.h"          /* Dataspace functions                  */
00038 
00039 /* Private headers needed by this file */
00040 #include "H5Fprivate.h"         /* File access                          */
00041 #include "H5SLprivate.h"        /* Skip lists                           */
00042 #include "H5Tprivate.h"         /* Datatype functions                   */
00043 #include "H5Zprivate.h"         /* I/O pipeline filters                 */
00044 
00045 /* Forward references of package typedefs */
00046 typedef struct H5O_msg_class_t H5O_msg_class_t;
00047 typedef struct H5O_mesg_t H5O_mesg_t;
00048 typedef struct H5O_t H5O_t;
00049 
00050 /* Values used to create the shared message & attribute heaps */
00051 /* (Note that these parameters have been tuned so that the resulting heap ID
00052  *      is exactly 8 bytes.  This is an efficient size as it can be stored
00053  *      directly in an 8 byte integer in memory, think carefully before changing it.
00054  *      -QAK)
00055  */
00056 #define H5O_FHEAP_MAN_WIDTH                     4
00057 #define H5O_FHEAP_MAN_START_BLOCK_SIZE          1024
00058 #define H5O_FHEAP_MAN_MAX_DIRECT_SIZE           (64 * 1024)
00059 #define H5O_FHEAP_MAN_MAX_INDEX                 40
00060 #define H5O_FHEAP_MAN_START_ROOT_ROWS           1
00061 #define H5O_FHEAP_CHECKSUM_DBLOCKS              TRUE
00062 #define H5O_FHEAP_MAX_MAN_SIZE                  (4 * 1024)
00063 #define H5O_FHEAP_ID_LEN                        8
00064 
00065 /* Object header macros */
00066 #define H5O_MESG_MAX_SIZE       65536   /*max obj header message size        */
00067 #define H5O_ALL         (-1)            /* Operate on all messages of type   */
00068 #define H5O_FIRST       (-2)            /* Operate on first message of type  */
00069 
00070 /* Flags needed when encoding messages */
00071 #define H5O_MSG_FLAG_CONSTANT   0x01u
00072 #define H5O_MSG_FLAG_SHARED     0x02u
00073 #define H5O_MSG_FLAG_DONTSHARE  0x04u
00074 #define H5O_MSG_FLAG_FAIL_IF_UNKNOWN 0x08u
00075 #define H5O_MSG_FLAG_MARK_IF_UNKNOWN 0x10u
00076 #define H5O_MSG_FLAG_WAS_UNKNOWN 0x20u
00077 #define H5O_MSG_FLAG_SHAREABLE  0x40u
00078 #define H5O_MSG_FLAG_BITS       (H5O_MSG_FLAG_CONSTANT|H5O_MSG_FLAG_SHARED|H5O_MSG_FLAG_DONTSHARE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN|H5O_MSG_FLAG_MARK_IF_UNKNOWN|H5O_MSG_FLAG_WAS_UNKNOWN|H5O_MSG_FLAG_SHAREABLE)
00079 
00080 /* Flags for updating messages */
00081 #define H5O_UPDATE_TIME         0x01u
00082 #define H5O_UPDATE_FORCE        0x02u   /* Force updating the message */
00083 
00084 /* Hash value constants */
00085 #define H5O_HASH_SIZE 32
00086 
00087 /* ========= Object Creation properties ============ */
00088 #define H5O_CRT_ATTR_MAX_COMPACT_NAME   "max compact attr"      /* Max. # of attributes to store compactly */
00089 #define H5O_CRT_ATTR_MIN_DENSE_NAME     "min dense attr"        /* Min. # of attributes to store densely */
00090 #define H5O_CRT_OHDR_FLAGS_NAME         "object header flags"   /* Object header flags */
00091 #define H5O_CRT_PIPELINE_NAME           "pline"                 /* Filter pipeline */
00092 #define H5O_CRT_PIPELINE_DEF            {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_PLINE_VERSION_1, 0, 0, NULL}
00093 #ifdef H5O_ENABLE_BOGUS
00094 #define H5O_BOGUS_MSG_FLAGS_NAME        "bogus msg flags"       /* Flags for 'bogus' message */
00095 #define H5O_BOGUS_MSG_FLAGS_SIZE        sizeof(uint8_t)
00096 #endif /* H5O_ENABLE_BOGUS */
00097 #ifdef H5O_ENABLE_BAD_MESG_COUNT
00098 #define H5O_BAD_MESG_COUNT_NAME         "bad message count"       /* Flag setting bad message count */
00099 #define H5O_BAD_MESG_COUNT_SIZE         sizeof(hbool_t)
00100 #endif /* H5O_ENABLE_BAD_MESG_COUNT */
00101 
00102 /* ========= Object Copy properties ============ */
00103 #define H5O_CPY_OPTION_NAME             "copy object"           /* Copy options */
00104 
00105 /* If the module using this macro is allowed access to the private variables, access them directly */
00106 #ifdef H5O_PACKAGE
00107 #define H5O_OH_GET_ADDR(O)    ((O)->chunk[0].addr)
00108 #else /* H5O_PACKAGE */
00109 #define H5O_OH_GET_ADDR(O)    (H5O_get_oh_addr(O))
00110 #endif /* H5O_PACKAGE */
00111 
00112 /* Set the fields in a shared message structure */
00113 #define H5O_UPDATE_SHARED(SH_MESG, SH_TYPE, F, MSG_TYPE, CRT_IDX, OH_ADDR)    \
00114     (SH_MESG)->type = (SH_TYPE);                                              \
00115     (SH_MESG)->file = (F);                                                    \
00116     (SH_MESG)->msg_type_id = (MSG_TYPE);                                      \
00117     (SH_MESG)->u.loc.index = (CRT_IDX);                                       \
00118     (SH_MESG)->u.loc.oh_addr = (OH_ADDR);
00119 
00120 
00121 /* Fractal heap ID type for shared message & attribute heap IDs. */
00122 typedef union {
00123     uint8_t id[H5O_FHEAP_ID_LEN];       /* Buffer to hold ID, for encoding/decoding */
00124     uint64_t val;                       /* Value, for quick comparisons */
00125 } H5O_fheap_id_t;
00126 
00127 /* The object location information for an object */
00128 typedef struct H5O_loc_t {
00129     H5F_t       *file;          /* File that object header is located within */
00130     haddr_t     addr;           /* File address of object header */
00131     hbool_t     holding_file;   /* True if this object header has incremented
00132                                  * its file's count of open objects. */
00133 } H5O_loc_t;
00134 
00135 /* Settings/flags for copying an object */
00136 typedef struct H5O_copy_t {
00137     hbool_t copy_shallow;               /* Flag to perform shallow hierarchy copy */
00138     hbool_t expand_soft_link;           /* Flag to expand soft links */
00139     hbool_t expand_ext_link;            /* Flag to expand external links */
00140     hbool_t expand_ref;                 /* Flag to expand object references */
00141     hbool_t copy_without_attr;          /* Flag to not copy attributes */
00142     hbool_t preserve_null;              /* Flag to not delete NULL messages */
00143     int     curr_depth;                 /* Current depth in hierarchy copied */
00144     int     max_depth;                  /* Maximum depth in hierarchy to copy */
00145     H5SL_t  *map_list;                  /* Skip list to hold address mappings */
00146     H5O_t   *oh_dst;                    /* The destination object header */
00147 } H5O_copy_t;
00148 
00149 /* Header message IDs */
00150 #define H5O_NULL_ID     0x0000          /* Null Message.  */
00151 #define H5O_SDSPACE_ID  0x0001          /* Dataspace Message. */
00152 #define H5O_LINFO_ID    0x0002          /* Link info Message. */
00153 #define H5O_DTYPE_ID    0x0003          /* Datatype Message.  */
00154 #define H5O_FILL_ID     0x0004          /* Fill Value Message. (Old)  */
00155 #define H5O_FILL_NEW_ID 0x0005          /* Fill Value Message. (New)  */
00156 #define H5O_LINK_ID     0x0006          /* Link Message. */
00157 #define H5O_EFL_ID      0x0007          /* External File List Message  */
00158 #define H5O_LAYOUT_ID   0x0008          /* Data Storage Layout Message.  */
00159 #define H5O_BOGUS_ID    0x0009          /* "Bogus" Message.  */
00160 #define H5O_GINFO_ID    0x000a          /* Group info Message.  */
00161 #define H5O_PLINE_ID    0x000b          /* Filter pipeline message.  */
00162 #define H5O_ATTR_ID     0x000c          /* Attribute Message.  */
00163 #define H5O_NAME_ID     0x000d          /* Object name message.  */
00164 #define H5O_MTIME_ID    0x000e          /* Modification time message. (Old)  */
00165 #define H5O_SHMESG_ID   0x000f          /* Shared message "SOHM" table. */
00166 #define H5O_CONT_ID     0x0010          /* Object header continuation message.  */
00167 #define H5O_STAB_ID     0x0011          /* Symbol table message.  */
00168 #define H5O_MTIME_NEW_ID 0x0012         /* Modification time message. (New)  */
00169 #define H5O_BTREEK_ID   0x0013          /* v1 B-tree 'K' values message.  */
00170 #define H5O_DRVINFO_ID  0x0014          /* Driver info message.  */
00171 #define H5O_AINFO_ID    0x0015          /* Attribute info message.  */
00172 #define H5O_REFCOUNT_ID 0x0016          /* Reference count message.  */
00173 #define H5O_UNKNOWN_ID  0x0017          /* Placeholder message ID for unknown message.  */
00174                                         /* (this should never exist in a file) */
00175 
00176 
00177 /* Shared object message types.
00178  * Shared objects can be committed, in which case the shared message contains
00179  * the location of the object header that holds the message, or shared in the
00180  * heap, in which case the shared message holds their heap ID.
00181  */
00182 #define H5O_SHARE_TYPE_UNSHARED     0           /* Message is not shared */
00183 #define H5O_SHARE_TYPE_SOHM         1           /* Message is stored in SOHM heap */
00184 #define H5O_SHARE_TYPE_COMMITTED    2           /* Message is stored in another object header */
00185 #define H5O_SHARE_TYPE_HERE         3           /* Message is stored in this object header, but is sharable */
00186 
00187 /* Detect messages that aren't stored in message's object header */
00188 #define H5O_IS_STORED_SHARED(T) ((((T) == H5O_SHARE_TYPE_SOHM) || ((T) == H5O_SHARE_TYPE_COMMITTED)) ? TRUE : FALSE)
00189 
00190 /* Detect shared messages that are "tracked" in some other location */
00191 #define H5O_IS_TRACKED_SHARED(T) ((T) > 0)
00192 
00193 
00194 /* Specify the object header address and index needed
00195  *      to locate a message in another object header.
00196  */
00197 typedef struct H5O_mesg_loc_t {
00198     H5O_msg_crt_idx_t index;            /* index within object header   */
00199     haddr_t oh_addr;                    /* address of object header    */
00200 } H5O_mesg_loc_t;
00201 
00202 
00203 /*
00204  * Shared object header message info.
00205  *
00206  * (This structure is used in other messages that can be shared and will
00207  * include a H5O_shared_t struct as the first field in their "native" type)
00208  */
00209 typedef struct H5O_shared_t {
00210     unsigned type;                      /* Type describing how message is shared */
00211     H5F_t *file;                        /* File that message is located within */
00212     unsigned msg_type_id;               /* Message's type ID */
00213     union {
00214         H5O_mesg_loc_t  loc;            /* Object location info              */
00215         H5O_fheap_id_t  heap_id;        /* ID within the SOHM heap           */
00216     } u;
00217 } H5O_shared_t;
00218 
00219 
00220 /*
00221  * Link Info Message.
00222  * (Contains dynamic information about links in a group)
00223  * (Data structure in memory)
00224  * (if the fields in this struct are changed, remember to change the default
00225  *      link info structure in src/H5Gprivate.h - QAK)
00226  * (if the fields in this struct are changed, also look at the code that
00227  *      creates intermediate groups in src/H5Gtraverse.c - QAK)
00228  * (The "max. creation order" field is signed so that we might have an easy
00229  *      way to add links to the front of the creation ordering (with negative
00230  *      values) as well as the end of the creation ordering - QAK)
00231  */
00232 typedef struct H5O_linfo_t {
00233     /* Creation order info */
00234     hbool_t     track_corder;           /* Are creation order values tracked on links? */
00235     hbool_t     index_corder;           /* Are creation order values indexed on links? */
00236     int64_t     max_corder;             /* Current max. creation order value for group */
00237     haddr_t     corder_bt2_addr;        /* Address of v2 B-tree for indexing creation order values of links */
00238 
00239     /* Storage management info */
00240     hsize_t     nlinks;                 /* Number of links in the group      */
00241     haddr_t     fheap_addr;             /* Address of fractal heap for storing "dense" links */
00242     haddr_t     name_bt2_addr;          /* Address of v2 B-tree for indexing names of links */
00243 } H5O_linfo_t;
00244 
00245 /* Initial version of the "old" fill value information */
00246 /* (It doesn't look like this value was ever used in the file -QAK) */
00247 #define H5O_FILL_VERSION_1      1
00248 /* Revised version of the "new" fill value information */
00249 #define H5O_FILL_VERSION_2      2
00250 /* Version of the "new" fill value information with smaller default format */
00251 #define H5O_FILL_VERSION_3      3
00252 
00253 /* The latest version of the format.  Look through the 'encode', 'decode'
00254  *      and 'size' callback for places to change when updating this. */
00255 #define H5O_FILL_VERSION_LATEST H5O_FILL_VERSION_3
00256 
00257 /*
00258  * Fill Value Message.
00259  * (Data structure in memory for both "old" and "new" fill value messages)
00260  *
00261  * The fill value message is fill value plus space allocation time, fill value
00262  * writing time, whether fill value is defined, and the location of the
00263  * message if it's shared.
00264  */
00265 
00266 typedef struct H5O_fill_t {
00267     H5O_shared_t        sh_loc;         /* Shared message info (must be first) */
00268 
00269     unsigned            version;        /* Encoding version number           */
00270     H5T_t               *type;          /*type. Null implies same as dataset */
00271     ssize_t             size;           /*number of bytes in the fill value  */
00272     void                *buf;           /*the fill value                     */
00273     H5D_alloc_time_t    alloc_time;     /* time to allocate space            */
00274     H5D_fill_time_t     fill_time;      /* time to write fill value          */
00275     hbool_t             fill_defined;   /* whether fill value is defined     */
00276 } H5O_fill_t;
00277 
00278 /*
00279  * Link message.
00280  * (Data structure in memory)
00281  */
00282 typedef struct H5O_link_hard_t {
00283     haddr_t     addr;                   /* Object header address */
00284 } H5O_link_hard_t;
00285 
00286 typedef struct H5O_link_soft_t {
00287     char        *name;                  /* Destination name */
00288 } H5O_link_soft_t;
00289 
00290 typedef struct H5O_link_ud_t {
00291     void        *udata;                 /* Opaque data supplied by the user */
00292     size_t       size;                  /* Size of udata */
00293 } H5O_link_ud_t;
00294 
00295 typedef struct H5O_link_t {
00296     H5L_type_t  type;                   /* Type of link */
00297     hbool_t     corder_valid;           /* Creation order for link is valid (not stored) */
00298     int64_t     corder;                 /* Creation order for link (stored if it's valid) */
00299     H5T_cset_t  cset;                   /* Character set of link name   */
00300     char        *name;                  /* Link name */
00301     union {
00302         H5O_link_hard_t hard;           /* Information for hard links */
00303         H5O_link_soft_t soft;           /* Information for soft links */
00304         H5O_link_ud_t ud;               /* Information for user-defined links */
00305     } u;
00306 } H5O_link_t;
00307 
00308 /*
00309  * External File List Message
00310  * (Data structure in memory)
00311  */
00312 #define H5O_EFL_ALLOC           16      /*number of slots to alloc at once   */
00313 #define H5O_EFL_UNLIMITED       H5F_UNLIMITED /*max possible file size       */
00314 
00315 typedef struct H5O_efl_entry_t {
00316     size_t      name_offset;            /*offset of name within heap         */
00317     char        *name;                  /*malloc'd name                      */
00318     off_t       offset;                 /*offset of data within file         */
00319     hsize_t     size;                   /*size allocated within file         */
00320 } H5O_efl_entry_t;
00321 
00322 typedef struct H5O_efl_t {
00323     haddr_t     heap_addr;              /*address of name heap               */
00324     size_t      nalloc;                 /*number of slots allocated          */
00325     size_t      nused;                  /*number of slots used               */
00326     H5O_efl_entry_t *slot;              /*array of external file entries     */
00327 } H5O_efl_t;
00328 
00329 
00330 /*
00331  * Data Layout Message.
00332  * (Data structure in file)
00333  */
00334 #define H5O_LAYOUT_NDIMS        (H5S_MAX_RANK+1)
00335 
00336 /* Initial version of the layout information.  Used when space is allocated */
00337 #define H5O_LAYOUT_VERSION_1    1
00338 
00339 /* This version added support for delaying allocation */
00340 #define H5O_LAYOUT_VERSION_2    2
00341 
00342 /* This version is revised to store just the information needed for each
00343  *      storage type, and to straighten out problems with contiguous layout's
00344  *      sizes (was encoding them as 4-byte values when they were really n-byte
00345  *      values (where n usually is 8)).
00346  */
00347 #define H5O_LAYOUT_VERSION_3    3
00348 
00349 
00350 /* Forward declaration of structs used below */
00351 struct H5D_layout_ops_t;                /* Defined in H5Dpkg.h               */
00352 struct H5D_chunk_ops_t;                 /* Defined in H5Dpkg.h               */
00353 
00354 typedef struct H5O_storage_contig_t {
00355     haddr_t     addr;                   /* File address of data              */
00356     hsize_t     size;                   /* Size of data in bytes             */
00357 } H5O_storage_contig_t;
00358 
00359 typedef struct H5O_storage_chunk_btree_t {
00360     H5RC_t     *shared;                 /* Ref-counted shared info for B-tree nodes */
00361 } H5O_storage_chunk_btree_t;
00362 
00363 typedef struct H5O_storage_chunk_t {
00364     H5D_chunk_index_t idx_type;         /* Type of chunk index               */
00365     haddr_t     idx_addr;               /* File address of chunk index       */
00366     const struct H5D_chunk_ops_t *ops;  /* Pointer to chunked storage operations */
00367     union {
00368         H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index   */
00369     } u;
00370 } H5O_storage_chunk_t;
00371 
00372 typedef struct H5O_storage_compact_t {
00373     hbool_t     dirty;                  /* Dirty flag for compact dataset    */
00374     size_t      size;                   /* Size of buffer in bytes           */
00375     void        *buf;                   /* Buffer for compact dataset        */
00376 } H5O_storage_compact_t;
00377 
00378 typedef struct H5O_storage_t {
00379     H5D_layout_t type;                  /* Type of layout                    */
00380     union {
00381         H5O_storage_contig_t contig;    /* Information for contiguous storage */
00382         H5O_storage_chunk_t chunk;      /* Information for chunked storage    */
00383         H5O_storage_compact_t compact;  /* Information for compact storage    */
00384     } u;
00385 } H5O_storage_t;
00386 
00387 typedef struct H5O_layout_chunk_t {
00388     unsigned    ndims;                  /* Num dimensions in chunk           */
00389     uint32_t    dim[H5O_LAYOUT_NDIMS];  /* Size of chunk in elements         */
00390     uint32_t    size;                   /* Size of chunk in bytes            */
00391     hsize_t     nchunks;                /* Number of chunks in dataset       */
00392     hsize_t     chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in dataset dimensions */
00393     hsize_t     down_chunks[H5O_LAYOUT_NDIMS];  /* "down" size of number of chunks in each dimension */
00394 } H5O_layout_chunk_t;
00395 
00396 typedef struct H5O_layout_t {
00397     H5D_layout_t type;                  /* Type of layout                    */
00398     unsigned version;                   /* Version of message                */
00399     const struct H5D_layout_ops_t *ops; /* Pointer to data layout I/O operations */
00400     union {
00401         H5O_layout_chunk_t chunk;       /* Information for chunked layout    */
00402     } u;
00403     H5O_storage_t storage;              /* Information for storing dataset elements */
00404 } H5O_layout_t;
00405 
00406 /* Enable reading/writing "bogus" messages */
00407 /* #define H5O_ENABLE_BOGUS */
00408 
00409 #ifdef H5O_ENABLE_BOGUS
00410 /*
00411  * "Bogus" Message.
00412  * (Data structure in memory)
00413  */
00414 #define H5O_BOGUS_VALUE         0xdeadbeef
00415 typedef struct H5O_bogus_t {
00416     unsigned u;                         /* Hold the bogus info */
00417 } H5O_bogus_t;
00418 #endif /* H5O_ENABLE_BOGUS */
00419 
00420 /*
00421  * Group info message.
00422  * (Contains constant information about a group)
00423  * (Data structure in memory)
00424  * (if the fields in this struct are changed, remember to change the default
00425  *      group info structure in src/H5Gprivate.h - QAK)
00426  */
00427 typedef struct H5O_ginfo_t {
00428     /* "Old" format group info (not stored) */
00429     uint32_t    lheap_size_hint;        /* Local heap size hint              */
00430 
00431     /* "New" format group info (stored) */
00432 
00433     /* (storage management info) */
00434     hbool_t     store_link_phase_change;/* Whether to store the link phase change values */
00435     uint16_t    max_compact;            /* Maximum # of compact links        */
00436     uint16_t    min_dense;              /* Minimum # of "dense" links        */
00437 
00438     /* (initial object header size info) */
00439     hbool_t     store_est_entry_info;   /* Whether to store the est. entry values */
00440     uint16_t    est_num_entries;        /* Estimated # of entries in group   */
00441     uint16_t    est_name_len;           /* Estimated length of entry name    */
00442 } H5O_ginfo_t;
00443 
00444 /*
00445  * Filter pipeline message.
00446  * (Data structure in memory)
00447  */
00448 
00449 /* The initial version of the format */
00450 #define H5O_PLINE_VERSION_1     1
00451 
00452 /* This version encodes the message fields more efficiently */
00453 /* (Drops the reserved bytes, doesn't align the name and doesn't encode the
00454  *      filter name at all if it's a filter provided by the library)
00455  */
00456 #define H5O_PLINE_VERSION_2     2
00457 
00458 /* The latest version of the format.  Look through the 'encode' and 'size'
00459  *      callbacks for places to change when updating this. */
00460 #define H5O_PLINE_VERSION_LATEST H5O_PLINE_VERSION_2
00461 
00462 typedef struct H5O_pline_t {
00463     H5O_shared_t        sh_loc;         /* Shared message info (must be first) */
00464 
00465     unsigned    version;                /* Encoding version number */
00466     size_t      nalloc;                 /*num elements in `filter' array     */
00467     size_t      nused;                  /*num filters defined                */
00468     H5Z_filter_info_t *filter;          /*array of filters                   */
00469 } H5O_pline_t;
00470 
00471 /*
00472  * Object name message.
00473  * (Data structure in memory)
00474  */
00475 
00476 typedef struct H5O_name_t {
00477     char        *s;                     /*ptr to malloc'd memory             */
00478 } H5O_name_t;
00479 
00480 /*
00481  * Shared message table message
00482  * Information about file-wide shared message table, stored in superblock
00483  * extension
00484  * (Data structure in memory)
00485  */
00486 typedef struct H5O_shmesg_table_t {
00487     haddr_t             addr;           /*file address of SOHM table */
00488     unsigned            version;        /*SOHM table version number */
00489     unsigned            nindexes;       /*number of indexes in the table */
00490 } H5O_shmesg_table_t;
00491 
00492 /*
00493  * Object header continuation message.
00494  * (Data structure in memory)
00495  */
00496 
00497 typedef struct H5O_cont_t {
00498     haddr_t     addr;                   /*address of continuation block      */
00499     size_t      size;                   /*size of continuation block         */
00500 
00501     /* the following field(s) do not appear on disk */
00502     unsigned    chunkno;                /*chunk this mesg refers to          */
00503 } H5O_cont_t;
00504 
00505 /*
00506  * Symbol table message.
00507  * (Data structure in memory)
00508  */
00509 typedef struct H5O_stab_t {
00510     haddr_t     btree_addr;             /*address of B-tree                  */
00511     haddr_t     heap_addr;              /*address of name heap               */
00512 } H5O_stab_t;
00513 
00514 /*
00515  * v1 B-tree 'K' value message
00516  * Information about file-wide non-default v1 B-tree 'K' values, stored in
00517  * superblock extension
00518  * (Data structure in memory)
00519  */
00520 typedef struct H5O_btreek_t {
00521     unsigned        btree_k[H5B_NUM_BTREE_ID];  /* B-tree internal node 'K' values */
00522     unsigned        sym_leaf_k;                 /* Symbol table leaf node's 'K' value */
00523 } H5O_btreek_t;
00524 
00525 /*
00526  * Driver info message
00527  * Information about driver info, stored in superblock extension
00528  * (Data structure in memory)
00529  */
00530 typedef struct H5O_drvinfo_t {
00531     char                name[9];                /* Driver name */
00532     size_t              len;                    /* Length of encoded buffer */
00533     uint8_t            *buf;                    /* Buffer for encoded info */
00534 } H5O_drvinfo_t;
00535 
00536 /*
00537  * Attribute Info Message.
00538  * (Contains dynamic information about attributes on an object)
00539  * (Data structure in memory)
00540  */
00541 typedef struct H5O_ainfo_t {
00542     /* Creation order info */
00543     hbool_t     track_corder;           /* Are creation order values tracked on attributes? */
00544     hbool_t     index_corder;           /* Are creation order values indexed on attributes? */
00545     H5O_msg_crt_idx_t max_crt_idx;      /* Maximum attribute creation index used */
00546     haddr_t     corder_bt2_addr;        /* Address of v2 B-tree for indexing creation order values of "dense" attributes */
00547 
00548     /* Storage management info */
00549     hsize_t     nattrs;                 /* Number of attributes on the object */
00550     haddr_t     fheap_addr;             /* Address of fractal heap for storing "dense" attributes */
00551     haddr_t     name_bt2_addr;          /* Address of v2 B-tree for indexing names of "dense" attributes */
00552 } H5O_ainfo_t;
00553 
00554 /*
00555  * Reference Count Message.
00556  * (Data structure in memory)
00557  */
00558 typedef uint32_t H5O_refcount_t;        /* Contains # of links to object, if >1 */
00559 
00560 /*
00561  * "Unknown" Message.
00562  * (Data structure in memory)
00563  */
00564 typedef unsigned H5O_unknown_t;         /* Original message type ID */
00565 
00566 
00567 /* Typedef for "application" iteration operations */
00568 typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx,
00569     void *operator_data/*in,out*/);
00570 
00571 /* Typedef for "internal library" iteration operations */
00572 typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
00573     unsigned sequence, hbool_t *oh_modified/*out*/, void *operator_data/*in,out*/);
00574 
00575 /* Some syntactic sugar to make the compiler happy with two different kinds of iterator callbacks */
00576 typedef enum H5O_mesg_operator_type_t {
00577     H5O_MESG_OP_APP,            /* Application callback */
00578     H5O_MESG_OP_LIB             /* Library internal callback */
00579 } H5O_mesg_operator_type_t;
00580 
00581 typedef struct {
00582     H5O_mesg_operator_type_t op_type;
00583     union {
00584         H5O_operator_t app_op;      /* Application callback for each message */
00585         H5O_lib_operator_t lib_op;  /* Library internal callback for each message */
00586     } u;
00587 } H5O_mesg_operator_t;
00588 
00589 
00590 /* Typedef for abstract object creation */
00591 typedef struct {
00592     H5O_type_t obj_type;        /* Type of object to create */
00593     void *crt_info;             /* Information for object creation callback */
00594     void *new_obj;              /* Pointer to new object created */
00595 } H5O_obj_create_t;
00596 
00597 /* Forward declarations for prototype arguments */
00598 struct H5P_genplist_t;
00599 
00600 /* Object header routines */
00601 H5_DLL herr_t H5O_init(void);
00602 H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint,
00603     hid_t ocpl_id, H5O_loc_t *loc/*out*/);
00604 H5_DLL herr_t H5O_open(H5O_loc_t *loc);
00605 H5_DLL herr_t H5O_close(H5O_loc_t *loc);
00606 H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id);
00607 H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags);
00608 H5_DLL H5O_t *H5O_pin(H5O_loc_t *loc, hid_t dxpl_id);
00609 H5_DLL herr_t H5O_unpin(H5O_t *oh);
00610 H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id);
00611 H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
00612     hbool_t force);
00613 #ifdef H5O_ENABLE_BOGUS
00614 H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags);
00615 #endif /* H5O_ENABLE_BOGUS */
00616 H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
00617 H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr);
00618 H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
00619     H5O_info_t *oinfo);
00620 H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id);
00621 H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
00622 H5_DLL hid_t H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref);
00623 H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks);
00624 H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id);
00625 H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh);
00626 H5_DLL herr_t H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype);
00627 
00628 /* Object header message routines */
00629 H5_DLL herr_t H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
00630     unsigned update_flags, void *mesg, hid_t dxpl_id);
00631 H5_DLL herr_t H5O_msg_append_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id,
00632     unsigned mesg_flags, unsigned update_flags, void *mesg);
00633 H5_DLL herr_t H5O_msg_write(const H5O_loc_t *loc, unsigned type_id,
00634     unsigned mesg_flags, unsigned update_flags, void *mesg, hid_t dxpl_id);
00635 H5_DLL herr_t H5O_msg_write_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
00636     unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg);
00637 H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg,
00638     hid_t dxpl_id);
00639 H5_DLL void *H5O_msg_read_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id,
00640     void *mesg);
00641 H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native);
00642 H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg);
00643 H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst);
00644 H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id);
00645 H5_DLL htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id);
00646 H5_DLL htri_t H5O_msg_exists_oh(const H5O_t *oh, unsigned type_id);
00647 H5_DLL herr_t H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence,
00648     hbool_t adj_link, hid_t dxpl_id);
00649 H5_DLL herr_t H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
00650     H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
00651 H5_DLL herr_t H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id,
00652     const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id);
00653 H5_DLL size_t H5O_msg_raw_size(const H5F_t *f, unsigned type_id,
00654     hbool_t disable_shared, const void *mesg);
00655 H5_DLL size_t H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id,
00656     const void *mesg, size_t extra_raw);
00657 H5_DLL size_t H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id,
00658     const void *mesg, size_t extra_raw);
00659 H5_DLL htri_t H5O_msg_is_shared(unsigned type_id, const void *mesg);
00660 H5_DLL htri_t H5O_msg_can_share(unsigned type_id, const void *mesg);
00661 H5_DLL htri_t H5O_msg_can_share_in_ohdr(unsigned type_id);
00662 H5_DLL herr_t H5O_msg_set_share(unsigned type_id, const H5O_shared_t *share,
00663     void *mesg);
00664 H5_DLL herr_t H5O_msg_reset_share(unsigned type_id, void *mesg);
00665 H5_DLL herr_t H5O_msg_get_crt_index(unsigned type_id, const void *mesg,
00666     H5O_msg_crt_idx_t *crt_idx);
00667 H5_DLL herr_t H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared,
00668     unsigned char *buf, const void *obj);
00669 H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
00670     unsigned type_id, const unsigned char *buf);
00671 H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
00672     unsigned type_id, void *mesg);
00673 
00674 /* Object copying routines */
00675 H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
00676     hid_t dxpl_id, H5O_copy_t *cpy_info, hbool_t inc_depth);
00677 H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id,
00678     H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type,
00679     H5O_copy_t *cpy_info);
00680 
00681 /* Debugging routines */
00682 H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth);
00683 H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
00684                          int fwidth);
00685 
00686 /* These functions operate on object locations */
00687 H5_DLL herr_t H5O_loc_reset(H5O_loc_t *loc);
00688 H5_DLL herr_t H5O_loc_copy(H5O_loc_t *dst, const H5O_loc_t *src, H5_copy_depth_t depth);
00689 H5_DLL herr_t H5O_loc_hold_file(H5O_loc_t *loc);
00690 H5_DLL herr_t H5O_loc_free(H5O_loc_t *loc);
00691 
00692 /* EFL operators */
00693 H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl);
00694 
00695 /* Fill value operators */
00696 H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill);
00697 H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed, hid_t dxpl_id);
00698 H5_DLL herr_t H5O_fill_set_latest_version(H5O_fill_t *fill);
00699 
00700 /* Link operators */
00701 H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
00702     void *_mesg);
00703 
00704 /* Filter pipeline operators */
00705 H5_DLL herr_t H5O_pline_set_latest_version(H5O_pline_t *pline);
00706 
00707 /* Shared message operators */
00708 H5_DLL herr_t H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src);
00709 
00710 #endif /* _H5Oprivate_H */
00711