summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-08-10 20:47:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-08-10 20:47:05 (GMT)
commit95862451f78960cab031031011e5c6a131e0d026 (patch)
tree391101ca102fbecbfe9cee1f608b90bb87d49b1a /src/H5FD.c
parent4049965d1337bc54a21a4d3af71aa793e4baf029 (diff)
downloadhdf5-95862451f78960cab031031011e5c6a131e0d026.zip
hdf5-95862451f78960cab031031011e5c6a131e0d026.tar.gz
hdf5-95862451f78960cab031031011e5c6a131e0d026.tar.bz2
[svn-r4324] Purpose:
New Features! Description: Start migrating the internal use of property lists in the library from the older implementation to the new generic property lists. Currently, only the dataset transfer property lists are migrated to the new architecture, all the rest of the property list types are still using the older architecture. Also, the backward compatibility features are not implemented yet, so applications which use dataset transfer properties may need to make the following changes: H5Pcreate(H5P_DATASET_XFER) -> H5Pcreate_list(H5P_DATASET_XFER_NEW) and H5Pclose(<a dataset transfer property list>) -> H5Pclose_list(id) This still may have some bugs in it, especially with Fortran, but I should be wrapping up those later today. Platforms tested: FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c91
1 files changed, 39 insertions, 52 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index f8538ae..fd24594 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -284,7 +284,6 @@ H5FD_get_class(hid_t id)
{
H5FD_class_t *ret_value=NULL;
H5F_access_t *fapl=NULL;
- H5D_xfer_t *dxpl=NULL;
FUNC_ENTER(H5FD_get_class, NULL);
@@ -292,28 +291,23 @@ H5FD_get_class(hid_t id)
ret_value = H5FD_get_class(H5F_access_dflt.driver_id);
} else if (H5I_VFL==H5I_get_type(id)) {
ret_value = H5I_object(id);
+ } else if (H5I_GENPROP_LST == H5I_get_type(id) &&
+ TRUE==H5Pisa_class(id,H5P_DATASET_XFER_NEW)) {
+ ret_value = H5FD_get_class(H5P_peek_hid_t(id,H5D_XFER_VFL_ID_NAME));
} else {
switch (H5P_get_class(id)) {
- case H5P_FILE_ACCESS:
- if (NULL==(fapl=H5I_object(id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
- "not a file access property list");
- }
- ret_value = H5FD_get_class(fapl->driver_id);
- break;
-
- case H5P_DATASET_XFER:
- if (NULL==(dxpl=H5I_object(id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
- "not a data transfer property list");
- }
- ret_value = H5FD_get_class(dxpl->driver_id);
- break;
-
- default:
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
- "not a driver id, file access property list or "
- "data transfer property list");
+ case H5P_FILE_ACCESS:
+ if (NULL==(fapl=H5I_object(id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
+ "not a file access property list");
+ }
+ ret_value = H5FD_get_class(fapl->driver_id);
+ break;
+
+ default:
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
+ "not a driver id, file access property list or "
+ "data transfer property list");
}
}
FUNC_LEAVE(ret_value);
@@ -1968,23 +1962,20 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
- if (!file || !file->cls) {
+ if (!file || !file->cls)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
- }
- if (H5P_DEFAULT!=dxpl_id &&
- (H5P_DATASET_XFER!=H5P_get_class(dxpl_id) ||
- NULL==H5I_object(dxpl_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a data transfer property list");
- }
- if (!buf) {
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) ||
+ TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list");
+ if (!buf)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer");
- }
/* Do the real work */
- if (H5FD_read(file, type, dxpl_id, addr, size, buf)<0) {
+ if (H5FD_read(file, type, dxpl_id, addr, size, buf)<0)
HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file read request failed");
- }
FUNC_LEAVE(SUCCEED);
}
@@ -2016,8 +2007,8 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
{
FUNC_ENTER(H5FD_read, FAIL);
assert(file && file->cls);
- assert(H5P_DEFAULT==dxpl_id ||
- (H5P_DATASET_XFER==H5P_get_class(dxpl_id) || H5I_object(dxpl_id)));
+ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
+ assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW));
assert(buf);
#ifndef H5_HAVE_PARALLEL
@@ -2124,24 +2115,20 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
H5TRACE6("e","xMtiazx",file,type,dxpl_id,addr,size,buf);
/* Check args */
- if (!file || !file->cls) {
+ if (!file || !file->cls)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer");
- }
- if (H5P_DEFAULT!=dxpl_id &&
- (H5P_DATASET_XFER!=H5P_get_class(dxpl_id) ||
- NULL==H5I_object(dxpl_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a data transfer property list");
- }
- if (!buf) {
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) ||
+ TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list");
+ if (!buf)
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer");
- }
/* The real work */
- if (H5FD_write(file, type, dxpl_id, addr, size, buf)<0) {
- HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL,
- "file write request failed");
- }
+ if (H5FD_write(file, type, dxpl_id, addr, size, buf)<0)
+ HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file write request failed");
FUNC_LEAVE(SUCCEED);
}
@@ -2176,8 +2163,8 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
FUNC_ENTER(H5FD_write, FAIL);
assert(file && file->cls);
- assert(H5P_DEFAULT==dxpl_id ||
- (H5P_DATASET_XFER==H5P_get_class(dxpl_id) && H5I_object(dxpl_id)));
+ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
+ assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER_NEW));
assert(buf);
#ifndef H5_HAVE_PARALLEL
@@ -2427,7 +2414,7 @@ H5FD_flush(H5FD_t *file)
if((file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA) && file->accum_dirty && file->accum_size>0) {
/* Flush the metadata contents */
/* Not certain if the type and dxpl should be the way they are... -QAK */
- if ((file->cls->write)(file, H5FD_MEM_DEFAULT, H5P_DEFAULT, file->accum_loc, file->accum_size, file->meta_accum)<0)
+ if ((file->cls->write)(file, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, file->accum_loc, file->accum_size, file->meta_accum)<0)
HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver write request failed");
/* Reset the dirty flag */