summaryrefslogtreecommitdiffstats
path: root/src/H5Rpkg.h
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2019-07-16 16:15:43 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2019-10-08 19:30:24 (GMT)
commitae490016b9659d4e31e0e242d0653daf02b7c83c (patch)
treee057dde8bb12749d9ae3ed8e4b7ddc3b63fd0ff2 /src/H5Rpkg.h
parent0f4e080309d09a5f0d6911efce064ee487a759be (diff)
downloadhdf5-ae490016b9659d4e31e0e242d0653daf02b7c83c.zip
hdf5-ae490016b9659d4e31e0e242d0653daf02b7c83c.tar.gz
hdf5-ae490016b9659d4e31e0e242d0653daf02b7c83c.tar.bz2
Add new H5R API that abstracts object, region and attribute reference types
Also support references to external files Add new H5T_REF type and type conversion routines Support conversion from H5T_REF_OBJ/DSET_REG to H5T_REF Add H5Treclaim() API to reclaim memory of vlen/reference types Deprecate H5Dvlen_reclaim() Fix H5T_vlen_reclaim() and H5T_reclaim() to use private callback Add H5T_ref_reclaim() Move previous H5R APIs to H5Rdeprec.c Clean up H5Ocopy Separate H5O_copy_expand_ref() to H5Ocopy_ref() Add support for copying new reference types Clean up deprecated routines to go through VOL and same code path Fix return codes in existing trefer.c test Rename trefer.c to trefer_deprec.c trefer.c is for new references Add performance test for trefer Add additional obj_copy_ref test Make use of tokens and blobs to store references Skip blob encoding for object references Start adding new reference examples
Diffstat (limited to 'src/H5Rpkg.h')
-rw-r--r--src/H5Rpkg.h80
1 files changed, 75 insertions, 5 deletions
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index 1c1c8eb..1843bcf 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -36,11 +36,51 @@
/* Package Private Macros */
/**************************/
+/* Encode flags */
+#define H5R_IS_EXTERNAL 0x1 /* Set when encoding reference to external file */
+
+/* Macros for convenience */
+#define H5R_REF_FILENAME(x) ((x)->ref.obj.filename)
+#define H5R_REF_ATTRNAME(x) ((x)->ref.attr.name)
+
+/* Header size */
+#define H5R_ENCODE_HEADER_SIZE (2 * H5_SIZEOF_UINT8_T)
/****************************/
/* Package Private Typedefs */
/****************************/
+/* Object reference */
+typedef struct H5R_ref_priv_obj_t {
+ H5VL_token_t token; /* Object token */
+ char *filename; /* File name */
+} H5R_ref_priv_obj_t;
+
+/* Region reference */
+typedef struct H5R_ref_priv_reg_t {
+ H5R_ref_priv_obj_t obj; /* Object reference */
+ H5S_t *space; /* Selection */
+} H5R_ref_priv_reg_t;
+
+/* Attribute reference */
+typedef struct H5R_ref_priv_attr_t {
+ H5R_ref_priv_obj_t obj; /* Object reference */
+ char *name; /* Attribute name */
+} H5R_ref_priv_attr_t;
+
+/* Generic reference type (keep it cache aligned) */
+typedef struct H5R_ref_priv_t {
+ union {
+ H5R_ref_priv_obj_t obj;/* Object reference */
+ H5R_ref_priv_reg_t reg;/* Region reference */
+ H5R_ref_priv_attr_t attr;/* Attribute Reference */
+ } ref;
+ hid_t loc_id; /* Cached location identifier */
+ uint32_t encode_size; /* Cached encoding size */
+ int8_t type; /* Reference type */
+ uint8_t token_size; /* Cached token size */
+ char unused[18]; /* Unused */
+} H5R_ref_priv_t;
/*****************************/
/* Package Private Variables */
@@ -50,11 +90,41 @@
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space);
-H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref);
-H5_DLL H5S_t *H5R__get_region(H5F_t *file, const void *_ref);
-H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type);
-H5_DLL ssize_t H5R__get_name(H5F_t *file, H5R_type_t ref_type, const void *_ref, char *name, size_t size);
+H5_DLL herr_t H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref);
+H5_DLL herr_t H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref);
+H5_DLL herr_t H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref);
+H5_DLL herr_t H5R__destroy(H5R_ref_priv_t *ref);
+
+H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref);
+H5_DLL hid_t H5R__get_loc_id(const H5R_ref_priv_t *ref);
+H5_DLL hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id);
+
+H5_DLL H5R_type_t H5R__get_type(const H5R_ref_priv_t *ref);
+H5_DLL htri_t H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2);
+H5_DLL herr_t H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref);
+
+H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, size_t *token_size);
+H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, size_t token_size);
+H5_DLL herr_t H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space);
+
+H5_DLL ssize_t H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size);
+H5_DLL ssize_t H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size);
+
+H5_DLL herr_t H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, size_t *nalloc, unsigned flags);
+H5_DLL herr_t H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref);
+
+/* Native HDF5 specific routines */
+H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, const unsigned char *data, size_t data_size);
+H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size);
+H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes);
+
+H5_DLL herr_t H5R__decode_addr_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, haddr_t *addr_ptr);
+
+H5_DLL herr_t H5R__encode_addr_obj_compat(haddr_t obj_addr, unsigned char *buf, size_t *nalloc);
+H5_DLL herr_t H5R__decode_addr_obj_compat(const unsigned char *buf, size_t *nbytes, haddr_t *obj_addr_ptr);
+
+H5_DLL herr_t H5R__encode_addr_region_compat(H5F_t *f, haddr_t obj_addr, H5S_t *space, unsigned char *buf, size_t *nalloc);
+H5_DLL herr_t H5R__decode_addr_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, haddr_t *obj_addr_ptr, H5S_t **space_ptr);
#endif /* _H5Rpkg_H */