summaryrefslogtreecommitdiffstats
path: root/src/H5Oshared.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /src/H5Oshared.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'src/H5Oshared.c')
-rw-r--r--src/H5Oshared.c278
1 files changed, 124 insertions, 154 deletions
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 43d48d8..a33da0f 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -28,70 +28,62 @@
/* Module Setup */
/****************/
-#include "H5Omodule.h" /* This source code file is part of the H5O module */
-
+#include "H5Omodule.h" /* This source code file is part of the H5O module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5Gprivate.h" /* Groups */
-#include "H5HFprivate.h" /* Fractal heap */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMprivate.h" /* Shared object header messages */
-#include "H5WBprivate.h" /* Wrapped Buffers */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5Gprivate.h" /* Groups */
+#include "H5HFprivate.h" /* Fractal heap */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMprivate.h" /* Shared object header messages */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
/* Local Macros */
/****************/
/* First version, with full symbol table entry as link for object header sharing */
-#define H5O_SHARED_VERSION_1 1
+#define H5O_SHARED_VERSION_1 1
/* Older version, with just address of object as link for object header sharing */
-#define H5O_SHARED_VERSION_2 2
+#define H5O_SHARED_VERSION_2 2
/* Newest version, which recognizes messages that are stored in the SOHM heap */
-#define H5O_SHARED_VERSION_3 3
-#define H5O_SHARED_VERSION_LATEST H5O_SHARED_VERSION_3
+#define H5O_SHARED_VERSION_3 3
+#define H5O_SHARED_VERSION_LATEST H5O_SHARED_VERSION_3
/* Size of stack buffer for serialized messages */
-#define H5O_MESG_BUF_SIZE 128
-
+#define H5O_MESG_BUF_SIZE 128
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-static void *H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
- const H5O_shared_t *shared, const H5O_msg_class_t *type);
-static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh,
- const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust);
-
+static void * H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t *shared,
+ const H5O_msg_class_t *type);
+static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
+ H5O_shared_t *shared, int adjust);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_read
*
@@ -108,13 +100,13 @@ static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh,
*-------------------------------------------------------------------------
*/
static void *
-H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
- const H5O_shared_t *shared, const H5O_msg_class_t *type)
+H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t *shared,
+ const H5O_msg_class_t *type)
{
H5HF_t *fheap = NULL;
- H5WB_t *wb = NULL; /* Wrapped buffer for attribute data */
+ H5WB_t *wb = NULL; /* Wrapped buffer for attribute data */
uint8_t mesg_buf[H5O_MESG_BUF_SIZE]; /* Buffer for deserializing messages */
- void *ret_value = NULL; /* Return value */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -130,77 +122,77 @@ H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
HDassert(H5O_IS_STORED_SHARED(shared->type));
/* Check for implicit shared object header message */
- if(shared->type == H5O_SHARE_TYPE_SOHM) {
- haddr_t fheap_addr; /* Address of SOHM heap */
- uint8_t *mesg_ptr; /* Pointer to raw message in heap */
- size_t mesg_size; /* Size of message */
+ if (shared->type == H5O_SHARE_TYPE_SOHM) {
+ haddr_t fheap_addr; /* Address of SOHM heap */
+ uint8_t *mesg_ptr; /* Pointer to raw message in heap */
+ size_t mesg_size; /* Size of message */
/* Retrieve the fractal heap address for shared messages */
- if(H5SM_get_fheap_addr(f, type->id, &fheap_addr) < 0)
+ if (H5SM_get_fheap_addr(f, type->id, &fheap_addr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get fheap address for shared messages")
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, fheap_addr)))
+ if (NULL == (fheap = H5HF_open(f, fheap_addr)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap")
/* Get the size of the message in the heap */
- if(H5HF_get_obj_len(fheap, &(shared->u.heap_id), &mesg_size) < 0)
+ if (H5HF_get_obj_len(fheap, &(shared->u.heap_id), &mesg_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get message size from fractal heap.")
/* Wrap the local buffer for serialized message */
- if(NULL == (wb = H5WB_wrap(mesg_buf, sizeof(mesg_buf))))
+ if (NULL == (wb = H5WB_wrap(mesg_buf, sizeof(mesg_buf))))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Get a pointer to a buffer that's large enough for message */
- if(NULL == (mesg_ptr = (uint8_t *)H5WB_actual(wb, mesg_size)))
+ if (NULL == (mesg_ptr = (uint8_t *)H5WB_actual(wb, mesg_size)))
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Retrieve the message from the heap */
- if(H5HF_read(fheap, &(shared->u.heap_id), mesg_ptr) < 0)
+ if (H5HF_read(fheap, &(shared->u.heap_id), mesg_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.")
/* Decode the message */
- if(NULL == (ret_value = (type->decode)(f, open_oh, 0, ioflags, mesg_size, mesg_ptr)))
+ if (NULL == (ret_value = (type->decode)(f, open_oh, 0, ioflags, mesg_size, mesg_ptr)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.")
} /* end if */
else {
- H5O_loc_t oloc; /* Location for object header where message is stored */
+ H5O_loc_t oloc; /* Location for object header where message is stored */
HDassert(shared->type == H5O_SHARE_TYPE_COMMITTED);
/* Build the object location for the shared message's object header */
- oloc.file = f;
- oloc.addr = shared->u.loc.oh_addr;
+ oloc.file = f;
+ oloc.addr = shared->u.loc.oh_addr;
oloc.holding_file = FALSE;
- if(open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) {
+ if (open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) {
/* The shared message is in the already opened object header. This
* is possible, for example, if an attribute's datatype is shared in
* the same object header the attribute is in. Read the message
* directly. */
- if(NULL == (ret_value = H5O_msg_read_oh(f, open_oh, type->id, NULL)))
+ if (NULL == (ret_value = H5O_msg_read_oh(f, open_oh, type->id, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message")
- } else
+ }
+ else
/* The shared message is in another object header */
- if(NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL)))
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message")
+ if (NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL)))
+ HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message")
} /* end else */
/* Mark the message as shared */
- if(H5O_msg_set_share(type->id, shared, ret_value) < 0)
+ if (H5O_msg_set_share(type->id, shared, ret_value) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to set sharing information")
done:
/* Release resources */
- if(fheap && H5HF_close(fheap) < 0)
+ if (fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't close fractal heap")
- if(wb && H5WB_unwrap(wb) < 0)
+ if (wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__shared_read() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_link_adj
*
@@ -221,10 +213,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
- H5O_shared_t *shared, int adjust)
+H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -233,8 +224,8 @@ H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
HDassert(shared);
/* Check for type of shared message */
- if(shared->type == H5O_SHARE_TYPE_COMMITTED) {
- H5O_loc_t oloc; /* Location for object header where message is stored */
+ if (shared->type == H5O_SHARE_TYPE_COMMITTED) {
+ H5O_loc_t oloc; /* Location for object header where message is stored */
/*
* The shared message is stored in some object header.
@@ -255,46 +246,46 @@ H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "interfile hard links are not allowed")*/
/* Build the object location for the shared message's object header */
- oloc.file = f;
- oloc.addr = shared->u.loc.oh_addr;
+ oloc.file = f;
+ oloc.addr = shared->u.loc.oh_addr;
oloc.holding_file = FALSE;
- if(open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) {
+ if (open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) {
/* The shared message is in the already opened object header. This
* is possible, for example, if an attribute's datatype is shared in
* the same object header the attribute is in. Adjust the link
* count directly. */
hbool_t deleted = FALSE; /* This is used only to satisfy H5O__link_oh */
- if(H5O__link_oh(f, adjust, open_oh, &deleted) < 0)
+ if (H5O__link_oh(f, adjust, open_oh, &deleted) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
HDassert(!deleted);
- } else
+ }
+ else
/* The shared message is in another object header */
- if(H5O_link(&oloc, adjust) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
+ if (H5O_link(&oloc, adjust) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
} /* end if */
else {
HDassert(shared->type == H5O_SHARE_TYPE_SOHM || shared->type == H5O_SHARE_TYPE_HERE);
/* Check for decrementing reference count on shared message */
- if(adjust < 0) {
- if(H5SM_delete(f, open_oh, shared) < 0)
+ if (adjust < 0) {
+ if (H5SM_delete(f, open_oh, shared) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to delete message from SOHM table")
} /* end if */
/* Check for incrementing reference count on message */
- else if(adjust > 0) {
- if(H5SM_try_share(f, open_oh, 0, type->id, shared, NULL) < 0)
+ else if (adjust > 0) {
+ if (H5SM_try_share(f, open_oh, 0, type->id, shared, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "error trying to share message")
} /* end if */
- } /* end else */
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__shared_link_adj() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_decode
*
@@ -310,11 +301,11 @@ done:
*/
void *
H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
- const H5O_msg_class_t *type)
+ const H5O_msg_class_t *type)
{
- H5O_shared_t sh_mesg; /* Shared message info */
- unsigned version; /* Shared message version */
- void *ret_value = NULL; /* Return value */
+ H5O_shared_t sh_mesg; /* Shared message info */
+ unsigned version; /* Shared message version */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -325,13 +316,13 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b
/* Version */
version = *buf++;
- if(version < H5O_SHARED_VERSION_1 || version > H5O_SHARED_VERSION_LATEST)
+ if (version < H5O_SHARED_VERSION_1 || version > H5O_SHARED_VERSION_LATEST)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for shared object message")
/* Get the shared information type
* Flags are unused before version 3.
*/
- if(version >= H5O_SHARED_VERSION_2)
+ if (version >= H5O_SHARED_VERSION_2)
sh_mesg.type = *buf++;
else {
sh_mesg.type = H5O_SHARE_TYPE_COMMITTED;
@@ -339,23 +330,23 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b
} /* end else */
/* Skip reserved bytes (for version 1) */
- if(version == H5O_SHARED_VERSION_1)
+ if (version == H5O_SHARED_VERSION_1)
buf += 6;
/* Body */
- if(version == H5O_SHARED_VERSION_1) {
+ if (version == H5O_SHARED_VERSION_1) {
/* Initialize other location fields */
sh_mesg.u.loc.index = 0;
/* Decode stored "symbol table entry" into message location */
- buf += H5F_SIZEOF_SIZE(f); /* Skip over local heap address */
+ buf += H5F_SIZEOF_SIZE(f); /* Skip over local heap address */
H5F_addr_decode(f, &buf, &(sh_mesg.u.loc.oh_addr));
} /* end if */
else if (version >= H5O_SHARED_VERSION_2) {
/* If this message is in the heap, copy a heap ID.
* Otherwise, it is a named datatype, so copy an H5O_loc_t.
*/
- if(sh_mesg.type == H5O_SHARE_TYPE_SOHM) {
+ if (sh_mesg.type == H5O_SHARE_TYPE_SOHM) {
HDassert(version >= H5O_SHARED_VERSION_3);
H5MM_memcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id));
} /* end if */
@@ -363,27 +354,26 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b
/* The H5O_COMMITTED_FLAG should be set if this message
* is from an older version before the flag existed.
*/
- if(version < H5O_SHARED_VERSION_3)
+ if (version < H5O_SHARED_VERSION_3)
sh_mesg.type = H5O_SHARE_TYPE_COMMITTED;
sh_mesg.u.loc.index = 0;
H5F_addr_decode(f, &buf, &sh_mesg.u.loc.oh_addr);
} /* end else */
- } /* end else if */
+ } /* end else if */
/* Set file pointer & message type for all types of shared messages */
- sh_mesg.file = f;
+ sh_mesg.file = f;
sh_mesg.msg_type_id = type->id;
/* Retrieve actual message, through decoded shared message info */
- if(NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type)))
+ if (NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__shared_decode() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_encode
*
@@ -397,9 +387,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg)
+H5O__shared_encode(const H5F_t *f, uint8_t *buf /*out*/, const H5O_shared_t *sh_mesg)
{
- unsigned version;
+ unsigned version;
FUNC_ENTER_PACKAGE_NOERR
@@ -411,12 +401,12 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_m
/* If this message is shared in the heap, we need to use version 3 of the
* encoding and encode the SHARED_IN_HEAP flag.
*/
- if(sh_mesg->type == H5O_SHARE_TYPE_SOHM)
+ if (sh_mesg->type == H5O_SHARE_TYPE_SOHM)
version = H5O_SHARED_VERSION_LATEST;
else {
HDassert(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED);
version = H5O_SHARED_VERSION_2; /* version 1 is no longer used */
- } /* end else */
+ } /* end else */
*buf++ = (uint8_t)version;
*buf++ = (uint8_t)sh_mesg->type;
@@ -424,7 +414,7 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_m
/* Encode either the heap ID of the message or the address of the
* object header that holds it.
*/
- if(sh_mesg->type == H5O_SHARE_TYPE_SOHM)
+ if (sh_mesg->type == H5O_SHARE_TYPE_SOHM)
H5MM_memcpy(buf, &(sh_mesg->u.heap_id), sizeof(sh_mesg->u.heap_id));
else
H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr);
@@ -432,7 +422,6 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_m
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__shared_encode() */
-
/*-------------------------------------------------------------------------
* Function: H5O_set_shared
*
@@ -460,7 +449,6 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_set_shared() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_size
*
@@ -477,26 +465,25 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src)
size_t
H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
{
- size_t ret_value = 0; /* Return value */
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
- if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) {
- ret_value = (size_t)1 + /* Version */
- (size_t)1 + /* Type field */
- (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */
- } /* end if */
+ if (sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) {
+ ret_value = (size_t)1 + /* Version */
+ (size_t)1 + /* Type field */
+ (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */
+ } /* end if */
else {
HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM);
- ret_value = 1 + /* Version */
- 1 + /* Type field */
- H5O_FHEAP_ID_LEN; /* Shared in the heap */
- } /* end else */
+ ret_value = 1 + /* Version */
+ 1 + /* Type field */
+ H5O_FHEAP_ID_LEN; /* Shared in the heap */
+ } /* end else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__shared_size() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_delete
*
@@ -510,10 +497,9 @@ H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
*-------------------------------------------------------------------------
*/
herr_t
-H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
- H5O_shared_t *sh_mesg)
+H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_shared_t *sh_mesg)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -531,14 +517,13 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
*/
/* Decrement the reference count on the shared object */
- if(H5O__shared_link_adj(f, open_oh, type, sh_mesg, -1) < 0)
+ if (H5O__shared_link_adj(f, open_oh, type, sh_mesg, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__shared_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_link
*
@@ -553,10 +538,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
- H5O_shared_t *sh_mesg)
+H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_shared_t *sh_mesg)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -565,14 +549,13 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
HDassert(sh_mesg);
/* Increment the reference count on the shared object */
- if(H5O__shared_link_adj(f, open_oh, type, sh_mesg, 1) < 0)
+ if (H5O__shared_link_adj(f, open_oh, type, sh_mesg, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__shared_link() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_copy_file
*
@@ -587,13 +570,15 @@ done:
*/
herr_t
H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst,
- const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst,
- hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info,
- void H5_ATTR_UNUSED *udata)
+ const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst,
+ hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags,
+ H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata)
{
- const H5O_shared_t *shared_src = (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */
- H5O_shared_t *shared_dst = (H5O_shared_t *)_native_dst; /* Alias to shared info in native destination message */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_shared_t *shared_src =
+ (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */
+ H5O_shared_t *shared_dst =
+ (H5O_shared_t *)_native_dst; /* Alias to shared info in native destination message */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -615,12 +600,12 @@ H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst,
* be updated (to allow calculation of the final size) but the message is
* not actually shared.
*/
- if(shared_src->type != H5O_SHARE_TYPE_COMMITTED) {
+ if (shared_src->type != H5O_SHARE_TYPE_COMMITTED) {
/* Simulate trying to share new message in the destination file. */
/* Set copied metadata tag */
H5_BEGIN_TAG(H5AC__COPIED_TAG);
- if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, mesg_type->id, _native_dst, mesg_flags) < 0)
+ if (H5SM_try_share(file_dst, NULL, H5SM_DEFER, mesg_type->id, _native_dst, mesg_flags) < 0)
HGOTO_ERROR_TAG(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared")
/* Reset metadata tag */
@@ -637,7 +622,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O__shared_copy_file() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_post_copy_file
*
@@ -656,11 +640,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
- const H5O_shared_t *shared_src, H5O_shared_t *shared_dst,
- unsigned *mesg_flags, H5O_copy_t *cpy_info)
+H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src,
+ H5O_shared_t *shared_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -670,7 +653,7 @@ H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
HDassert(shared_dst);
/* Copy the target of committed messages, try to share others */
- if(shared_src->type == H5O_SHARE_TYPE_COMMITTED) {
+ if (shared_src->type == H5O_SHARE_TYPE_COMMITTED) {
H5O_loc_t dst_oloc;
H5O_loc_t src_oloc;
@@ -679,7 +662,7 @@ H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
dst_oloc.file = f;
src_oloc.file = shared_src->file;
src_oloc.addr = shared_src->u.loc.oh_addr;
- if(H5O_copy_header_map(&src_oloc, &dst_oloc, cpy_info, FALSE, NULL, NULL) < 0)
+ if (H5O_copy_header_map(&src_oloc, &dst_oloc, cpy_info, FALSE, NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Set up destination message's shared info */
@@ -687,14 +670,13 @@ H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
} /* end if */
else
/* Share the message */
- if(H5SM_try_share(f, NULL, H5SM_WAS_DEFERRED, mesg_type->id, shared_dst, mesg_flags) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't share message")
+ if (H5SM_try_share(f, NULL, H5SM_WAS_DEFERRED, mesg_type->id, shared_dst, mesg_flags) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't share message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__shared_post_copy_file() */
-
/*-------------------------------------------------------------------------
* Function: H5O__shared_debug
*
@@ -718,43 +700,31 @@ H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- switch(mesg->type) {
+ switch (mesg->type) {
case H5O_SHARE_TYPE_UNSHARED:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Shared Message type:",
- "Unshared");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Unshared");
break;
case H5O_SHARE_TYPE_COMMITTED:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Shared Message type:",
- "Obj Hdr");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Obj Hdr");
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
- "Object address:",
- mesg->u.loc.oh_addr);
+ "Object address:", mesg->u.loc.oh_addr);
break;
case H5O_SHARE_TYPE_SOHM:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Shared Message type:",
- "SOHM");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "SOHM");
HDfprintf(stream, "%*s%-*s %016llx\n", indent, "", fwidth,
- "Heap ID:",
- (unsigned long long)mesg->u.heap_id.val);
+ "Heap ID:", (unsigned long long)mesg->u.heap_id.val);
break;
case H5O_SHARE_TYPE_HERE:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Shared Message type:",
- "Here");
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Here");
break;
default:
- HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
- "Shared Message type:",
- "Unknown", (unsigned)mesg->type);
+ HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Shared Message type:", "Unknown",
+ (unsigned)mesg->type);
} /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__shared_debug() */
-