summaryrefslogtreecommitdiffstats
path: root/src/H5Opkg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Opkg.h')
-rw-r--r--src/H5Opkg.h91
1 files changed, 51 insertions, 40 deletions
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index a55ea1e..262386a 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -30,7 +30,7 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */
-#define H5O_MSG_TYPES 24 /* # of types of messages */
+#define H5O_MSG_TYPES 25 /* # of types of messages */
#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
@@ -43,7 +43,7 @@
*/
#define H5O_VERSION_2 2
-/* The latest version of the format. Look through the 'flush'
+/* The latest version of the format. Look through the 'flush'
* and 'size' callback for places to change when updating this. */
#define H5O_VERSION_LATEST H5O_VERSION_2
@@ -67,13 +67,6 @@
#define H5O_ALIGN_F(F, X) \
H5O_ALIGN_VERS((H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
-/* Size of signature information (on disk) */
-#define H5O_SIZEOF_MAGIC 4
-
-/* Object header signatures */
-#define H5O_HDR_MAGIC "OHDR" /* Header */
-#define H5O_CHK_MAGIC "OCHK" /* Continuation chunk */
-
/* Size of checksum (on disk) */
#define H5O_SIZEOF_CHKSUM 4
@@ -106,7 +99,7 @@
4 + /*reference count */ \
4) /*chunk data size */ \
: \
- (H5O_SIZEOF_MAGIC + /*magic number */ \
+ (H5_SIZEOF_MAGIC + /*magic number */ \
1 + /*version number */ \
1 + /*flags */ \
(((O)->flags & H5O_HDR_STORE_TIMES) ? ( \
@@ -155,7 +148,7 @@
0 + /*no magic # */ \
0 /*no checksum */ \
: \
- H5O_SIZEOF_MAGIC + /*magic # */ \
+ H5_SIZEOF_MAGIC + /*magic # */ \
H5O_SIZEOF_CHKSUM /*checksum */ \
)
#define H5O_SIZEOF_CHKHDR_OH(O) \
@@ -174,17 +167,37 @@
#define H5O_SIZEOF_CHKSUM_OH(O) \
H5O_SIZEOF_CHKSUM_VERS((O)->version)
+/* Input/output flags for decode functions */
+#define H5O_DECODEIO_NOCHANGE 0x01u /* IN: do not modify values */
+#define H5O_DECODEIO_DIRTY 0x02u /* OUT: message has been changed */
+
+/* Macro to incremend ndecode_dirtied (only if we are debugging) */
+#ifndef NDEBUG
+#define INCR_NDECODE_DIRTIED(OH) (OH)->ndecode_dirtied++;
+#else /* NDEBUG */
+#define INCR_NDECODE_DIRTIED(OH) ;
+#endif /* NDEBUG */
+
/* Load native information for a message, if it's not already present */
/* (Only works for messages with decode callback) */
-#define H5O_LOAD_NATIVE(F, DXPL, OH, MSG, ERR) \
+#define H5O_LOAD_NATIVE(F, DXPL, IOF, OH, MSG, ERR) \
if(NULL == (MSG)->native) { \
const H5O_msg_class_t *msg_type = (MSG)->type; \
+ unsigned ioflags = (IOF); \
\
/* Decode the message */ \
HDassert(msg_type->decode); \
- if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (MSG)->flags, (MSG)->raw))) \
+ if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw))) \
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \
\
+ /* Mark the message dirty if it was changed by decoding */ \
+ if((ioflags & H5O_DECODEIO_DIRTY) && (H5F_get_intent((F)) & H5F_ACC_RDWR)) { \
+ (MSG)->dirty = TRUE; \
+ /* Increment the count of messages dirtied by decoding, but */ \
+ /* only ifndef NDEBUG */ \
+ INCR_NDECODE_DIRTIED(OH) \
+ } \
+ \
/* Set the message's "shared info", if it's shareable */ \
if((MSG)->flags & H5O_MSG_FLAG_SHAREABLE) { \
H5O_UPDATE_SHARED((H5O_shared_t *)(MSG)->native, H5O_SHARE_TYPE_HERE, (F), msg_type->id, (MSG)->crt_idx, (OH)->chunk[0].addr) \
@@ -209,7 +222,7 @@ struct H5O_msg_class_t {
const char *name; /*for debugging */
size_t native_size; /*size of native message */
unsigned share_flags; /* Message sharing settings */
- void *(*decode)(H5F_t *, hid_t, unsigned, const uint8_t *);
+ void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *);
herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *);
void *(*copy)(const void *, void *); /*copy native value */
size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */
@@ -253,12 +266,20 @@ struct H5O_t {
/* File-specific information (not stored) */
size_t sizeof_size; /* Size of file sizes */
size_t sizeof_addr; /* Size of file addresses */
+
+ /* Misc. information (not stored) */
+ unsigned npins; /* Number of times the header is pinned */
+
+ /* Debugging information (not stored) */
#ifdef H5O_ENABLE_BAD_MESG_COUNT
hbool_t store_bad_mesg_count; /* Flag to indicate that a bad message count should be stored */
/* (This is to simulate a bug in earlier
* versions of the library)
*/
#endif /* H5O_ENABLE_BAD_MESG_COUNT */
+#ifndef NDEBUG
+ size_t ndecode_dirtied; /* Number of messages dirtied by decoding */
+#endif /* NDEBUG */
/* Object information (stored) */
hbool_t has_refcount_msg; /* Whether the object has a ref. count message */
@@ -289,13 +310,6 @@ struct H5O_t {
H5O_chunk_t *chunk; /*array of chunks */
};
-/* Callback information for copying dataset */
-typedef struct {
- struct H5S_extent_t *src_space_extent; /* Copy of dataspace extent for dataset */
- H5T_t *src_dtype; /* Copy of datatype for dataset */
- H5O_pline_t *src_pline; /* Copy of filter pipeline for dataet */
-} H5D_copy_file_ud_t;
-
/* Class for types of objects in file */
typedef struct H5O_obj_class_t {
H5O_type_t type; /*object type on disk */
@@ -303,9 +317,10 @@ typedef struct H5O_obj_class_t {
void *(*get_copy_file_udata)(void); /*retrieve user data for 'copy file' operation */
void (*free_copy_file_udata)(void *); /*free user data for 'copy file' operation */
htri_t (*isa)(H5O_t *); /*if a header matches an object class */
- hid_t (*open)(const H5G_loc_t *, hid_t ); /*open an object of this class */
+ hid_t (*open)(const H5G_loc_t *, hid_t, hid_t, hbool_t ); /*open an object of this class */
void *(*create)(H5F_t *, void *, H5G_loc_t *, hid_t ); /*create an object of this class */
H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */
+ 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 */
} H5O_obj_class_t;
/* Node in skip list to map addresses from one file to another during object header copy */
@@ -323,9 +338,6 @@ H5_DLLVAR const H5AC_class_t H5AC_OHDR[1];
/* Header message ID to class mapping */
H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES];
-/* Header object ID to class mapping */
-H5_DLLVAR const H5O_obj_class_t *const H5O_obj_class_g[3];
-
/* Declare external the free list for H5O_t's */
H5FL_EXTERN(H5O_t);
@@ -401,7 +413,7 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_NAME[1];
*/
H5_DLLVAR const H5O_msg_class_t H5O_MSG_MTIME[1];
-/* Shared Message information message (0x000f)
+/* Shared Message information message (0x000f)
* A message for the superblock extension, holding information about
* the file-wide shared message "SOHM" table
*/
@@ -419,13 +431,13 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_STAB[1];
*/
H5_DLLVAR const H5O_msg_class_t H5O_MSG_MTIME_NEW[1];
-/* v1 B-tree 'K' value message (0x0013)
+/* v1 B-tree 'K' value message (0x0013)
* A message for the superblock extension, holding information about
* the file-wide v1 B-tree 'K' values.
*/
H5_DLLVAR const H5O_msg_class_t H5O_MSG_BTREEK[1];
-/* Driver info message (0x0014)
+/* Driver info message (0x0014)
* A message for the superblock extension, holding information about
* the file driver settings
*/
@@ -437,9 +449,11 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_AINFO[1];
/* Reference Count Message. (0x0016) */
H5_DLLVAR const H5O_msg_class_t H5O_MSG_REFCOUNT[1];
-/* Placeholder for unknown message. (0x0017) */
-H5_DLLVAR const H5O_msg_class_t H5O_MSG_UNKNOWN[1];
+/* Free-space Manager Info message. (0x0017) */
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_FSINFO[1];
+/* Placeholder for unknown message. (0x0018) */
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_UNKNOWN[1];
/*
* Object header "object" types
@@ -458,7 +472,7 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
/* Package-local function prototypes */
H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
-H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t dxpl_id);
+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);
H5_DLL herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_mesg_t *mesg);
H5_DLL const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh);
@@ -471,12 +485,9 @@ H5_DLL herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_DLL herr_t H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags,
void *mesg);
-H5_DLL void *H5O_msg_read_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- unsigned type_id, void *mesg);
H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL herr_t H5O_msg_free_mesg(H5O_mesg_t *mesg);
H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type);
-H5_DLL htri_t H5O_msg_exists_oh(const H5O_t *oh, unsigned type_id);
H5_DLL herr_t H5O_msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
H5_DLL void *H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
@@ -486,10 +497,6 @@ H5_DLL herr_t H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t
const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id);
/* Collect storage info for btree and heap */
-H5_DLL herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- H5_ih_info_t *bh_info);
-H5_DLL herr_t H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- H5_ih_info_t *bh_info);
H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);
@@ -502,14 +509,15 @@ H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5O_mesg_t *mesg, hbool_t adj_link);
/* Shared object operators */
-H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *buf, const H5O_msg_class_t *type);
+H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
+ unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type);
H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg);
H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg);
H5_DLL herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg);
-H5_DLL herr_t H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
+H5_DLL herr_t H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst,
hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id);
H5_DLL herr_t H5O_shared_post_copy_file (H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *mesg);
@@ -520,6 +528,9 @@ H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream,
H5_DLL herr_t H5O_attr_reset(void *_mesg);
H5_DLL herr_t H5O_attr_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg);
H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg);
+H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
+ hsize_t *nattrs);
+
/* These functions operate on object locations */
H5_DLL H5O_loc_t *H5O_get_loc(hid_t id);