summaryrefslogtreecommitdiffstats
path: root/src/H5FDcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDcore.c')
-rw-r--r--src/H5FDcore.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index f15120d..cb36223 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -66,7 +66,7 @@ typedef struct H5FD_core_fapl_t {
* REGION_OVERFLOW: Checks whether an address and size pair describe data
* which can be addressed entirely in memory.
*/
-#define MAXADDR ((haddr_t)~(size_t)0)
+#define MAXADDR ((haddr_t)((~(size_t)0)-1))
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
((A) & ~(haddr_t)MAXADDR))
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR)
@@ -84,6 +84,7 @@ static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
static haddr_t H5FD_core_get_eoa(H5FD_t *_file);
static herr_t H5FD_core_set_eoa(H5FD_t *_file, haddr_t addr);
static haddr_t H5FD_core_get_eof(H5FD_t *_file);
+static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, void *buf);
static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
@@ -112,6 +113,7 @@ static const H5FD_class_t H5FD_core_g = {
H5FD_core_get_eoa, /*get_eoa */
H5FD_core_set_eoa, /*set_eoa */
H5FD_core_get_eof, /*get_eof */
+ H5FD_core_get_handle, /*get_handle */
H5FD_core_read, /*read */
H5FD_core_write, /*write */
H5FD_core_flush, /*flush */
@@ -189,7 +191,7 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value;
- FUNC_ENTER_API(H5FD_set_fapl_core, FAIL);
+ FUNC_ENTER_API(H5Pset_fapl_core, FAIL);
H5TRACE3("e","izb",fapl_id,increment,backing_store);
/* Check argument */
@@ -621,6 +623,38 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5FD_core_get_handle
+ *
+ * Purpose: Returns the file handle of CORE file driver.
+ *
+ * Returns: Non-negative if succeed or negative if fails.
+ *
+ * Programmer: Raymond Lu
+ * Sept. 16, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_core_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle)
+{
+ H5FD_core_t *file = (H5FD_core_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5FD_core_get_handle, FAIL);
+
+ if(!file_handle)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid");
+
+ *file_handle = &(file->mem);
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5FD_core_read
*
* Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR