summaryrefslogtreecommitdiffstats
path: root/src/H5FDsec2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDsec2.c')
-rw-r--r--src/H5FDsec2.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 35ade20..0b4632d 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -90,6 +90,10 @@ typedef struct H5FD_sec2_t {
DWORD fileindexlo;
DWORD fileindexhi;
#endif
+
+ /* Information from properties set by 'h5repart' tool */
+ hbool_t fam_to_sec2; /* Whether to eliminate the family driver info
+ * and convert this file to a single file */
} H5FD_sec2_t;
@@ -325,8 +329,7 @@ done:
*/
/* ARGSUSED */
static H5FD_t *
-H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
- haddr_t maxaddr)
+H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
int o_flags;
int fd=(-1);
@@ -388,8 +391,26 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
#endif
+ /* Check for non-default FAPL */
+ if(H5P_FILE_ACCESS_DEFAULT != fapl_id) {
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ /* Get the FAPL */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
+
+ /* This step is for h5repart tool only. If user wants to change file driver from
+ * family to sec2 while using h5repart, this private property should be set so that
+ * in the later step, the library can ignore the family driver information saved
+ * in the superblock.
+ */
+ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0)
+ if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property of changing family to sec2")
+ } /* end if */
+
/* Set return value */
- ret_value=(H5FD_t*)file;
+ ret_value = (H5FD_t*)file;
done:
if(ret_value==NULL) {
@@ -398,7 +419,7 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_sec2_open() */
/*-------------------------------------------------------------------------
@@ -516,11 +537,11 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5FD_sec2_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */)
+H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5FD_sec2_t *file = (const H5FD_sec2_t*)_file; /* sec2 VFD info */
- FUNC_ENTER_NOAPI(H5FD_sec2_query, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_query)
/* Set the VFL feature flags that this driver supports */
if(flags) {
@@ -529,10 +550,13 @@ H5FD_sec2_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */)
*flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */
*flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
*flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
+
+ /* Check for flags that are set by h5repart */
+ if(file->fam_to_sec2)
+ *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD_sec2_query() */