summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2001-10-25 19:52:10 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2001-10-25 19:52:10 (GMT)
commit33189bd39be337df900a5dbd65190b111a959f31 (patch)
tree27f6de45d7232c4fabdd6c2285aeb98a29c5e424
parentb3afaccfe51320c3cb38a2338d17ba8f79c15073 (diff)
downloadhdf5-33189bd39be337df900a5dbd65190b111a959f31.zip
hdf5-33189bd39be337df900a5dbd65190b111a959f31.tar.gz
hdf5-33189bd39be337df900a5dbd65190b111a959f31.tar.bz2
[svn-r4573]
Purpose: Switch mount property list to the new generic property list. Platforms tested: IRIX64 6.5, SunOS 5.7, FreeBSD.
-rw-r--r--c++/src/H5PropList.cpp3
-rw-r--r--src/H5.c15
-rw-r--r--src/H5F.c55
-rw-r--r--src/H5Fprivate.h12
-rw-r--r--src/H5P.c72
-rw-r--r--src/H5Pprivate.h7
-rw-r--r--src/H5Ppublic.h4
7 files changed, 54 insertions, 114 deletions
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 907791a..38bf355 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -30,8 +30,7 @@ Description:
*/
PropList::PropList( const hid_t plist_id ) : IdComponent(0)
{
- if (H5I_GENPROP_CLS == H5Iget_type(plist_id)
- || plist_id==H5P_MOUNT) {
+ if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) {
// call C routine to create the new property
id = H5Pcreate(plist_id);
if( id <= 0 )
diff --git a/src/H5.c b/src/H5.c
index 1eb156b..f8cf191 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -1970,18 +1970,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case H5I_TEMPLATE_5:
case H5I_TEMPLATE_6:
case H5I_TEMPLATE_7:
- /* These will eventually go away when the old-style */
- /* property lists are converted to generic property */
- /* lists -QAK */
- switch (H5P_get_class(id_type)) {
- case H5P_MOUNT_OLD:
- fprintf(out, "H5P_MOUNT");
- break;
- default:
- fprintf (out, "H5I_TEMPLATE_%d",
- (int)(id_type-H5I_TEMPLATE_0));
- break;
- }
break;
case H5I_GROUP:
fprintf (out, "H5I_GROUP");
@@ -2134,9 +2122,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case H5P_NO_CLASS_OLD:
fprintf (out, "H5P_NO_CLASS");
break;
- case H5P_MOUNT_OLD:
- fprintf (out, "H5P_MOUNT");
- break;
default:
fprintf (out, "%ld", (long)plist_class);
break;
diff --git a/src/H5F.c b/src/H5F.c
index 7477acf..cecb5f5 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -48,13 +48,6 @@
#define PABLO_MASK H5F_mask
-/*
- * Define the default mount property list.
- */
-const H5F_mprop_t H5F_mount_dflt = {
- FALSE, /* Absolute symlinks are wrt mount root */
-};
-
/* Interface initialization */
static int interface_initialize_g = 0;
#define INTERFACE_INIT H5F_init_interface
@@ -165,6 +158,7 @@ H5F_init_interface(void)
int objectdir_ver = H5F_CRT_OBJ_DIR_VERS_DEF;
int sharedheader_ver = H5F_CRT_SHARE_HEAD_VERS_DEF;
/* File access property class variables. In sequence, they are
+ * - File access property class to modify
* - Size of meta data cache(elements)
* - Size of raw data chunk cache(elements)
* - Size of raw data chunk cache(bytes)
@@ -189,7 +183,12 @@ H5F_init_interface(void)
unsigned gc_ref = H5F_ACS_GARBG_COLCT_REF_DEF;
hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF;
void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF;
-
+ /* File mount property class variable.
+ * - Mount property class to modify
+ * - whether absolute symlinks is local to file
+ */
+ H5P_genclass_t *mnt_pclass;
+ hbool_t local = H5F_MNT_SYM_LOCAL_DEF;
FUNC_ENTER(H5F_init_interface, FAIL);
@@ -381,10 +380,27 @@ H5F_init_interface(void)
"can't insert property into class");
/* Register the default file access property list */
+
if((H5P_LST_FILE_ACCESS_g = H5Pcreate_list(H5P_CLS_FILE_ACCESS_g))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL,
"can't insert property into class");
+ /* ================ Mount Porperty Class Initialization ==============*/
+ assert(H5P_CLS_MOUNT_g!=-1);
+ /* Get the pointer to file mount class */
+ if(H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_MOUNT_g) ||
+ NULL == (mnt_pclass = H5I_object(H5P_CLS_MOUNT_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class");
+
+ /* Register property of whether symlinks is local to file */
+ if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+ /* Register the default file mount property list */
+ if((H5P_LST_MOUNT_g = H5Pcreate_list(H5P_CLS_MOUNT_g))<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL,
+ "can't insert property into class");
+
done:
FUNC_LEAVE(ret_value);
}
@@ -2456,7 +2472,7 @@ done:
*/
static herr_t
H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
- const H5F_mprop_t * UNUSED plist)
+ const hid_t UNUSED plist_id)
{
H5G_t *mount_point = NULL; /*mount point group */
H5G_entry_t *mp_ent = NULL; /*mount point symbol table entry*/
@@ -2470,7 +2486,10 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
assert(loc);
assert(name && *name);
assert(child);
- assert(plist);
+
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id) ||
+ TRUE != H5Pisa_class(plist_id, H5P_MOUNT))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list");
/*
* Check that the child isn't mounted, that the mount point exists, and
@@ -2740,7 +2759,6 @@ herr_t
H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
{
H5G_entry_t *loc = NULL;
- const H5F_mprop_t *plist = NULL;
H5F_t *child = NULL;
FUNC_ENTER(H5Fmount, FAIL);
@@ -2757,16 +2775,15 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
NULL==(child=H5I_object(child_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file");
}
- if (H5P_DEFAULT==plist_id) {
- plist = &H5F_mount_dflt;
- } else if (H5P_MOUNT!=H5P_get_class(plist_id) ||
- NULL==(plist=H5I_object(plist_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a mount property list");
- }
+ if(H5P_DEFAULT == plist_id)
+ plist_id = H5P_MOUNT_DEFAULT;
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id) ||
+ TRUE != H5Pisa_class(plist_id, H5P_MOUNT))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property list");
+
/* Do the mount */
- if (H5F_mount(loc, name, child, plist)<0) {
+ if (H5F_mount(loc, name, child, plist_id)<0) {
HRETURN_ERROR(H5E_FILE, H5E_MOUNT, FAIL,
"unable to mount file");
}
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index aaa29de..15c1ec9 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -346,13 +346,11 @@ __DLL__ size_t H5F_sizeof_size(const H5F_t *f);
#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*)
#define H5F_ACS_FILE_DRV_INFO_DEF NULL
-/* Mount property list */
-typedef struct H5F_mprop_t {
- hbool_t local; /* Are absolute symlinks local to file? */
-} H5F_mprop_t;
-
-/* library variables */
-__DLLVAR__ const H5F_mprop_t H5F_mount_dflt;
+/* ======================== File Mount properties ====================*/
+/* Definition for whether absolute symlinks local to file. */
+#define H5F_MNT_SYM_LOCAL_NAME "local"
+#define H5F_MNT_SYM_LOCAL_SIZE sizeof(hbool_t)
+#define H5F_MNT_SYM_LOCAL_DEF FALSE
/* Forward declarations for prototypes arguments */
struct H5O_layout_t;
diff --git a/src/H5P.c b/src/H5P.c
index 7737913..ff3d848 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -38,7 +38,6 @@ static herr_t H5P_init_interface(void);
/* These go away as each old-style property list is converted to a generic */
/* property list -QAK */
hid_t H5P_NO_CLASS=(hid_t)H5P_NO_CLASS_OLD;
-hid_t H5P_MOUNT=(hid_t)H5P_MOUNT_OLD;
/*
* Predefined property list classes. These are initialized at runtime by
@@ -216,7 +215,7 @@ H5P_init_interface(void)
if (NULL==(pclass = H5P_create_class (root_class,"file create",H5P_FILE_CREATE_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL)))
HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
- /* Register the dataset creation class */
+ /* Register the file creation class */
if ((H5P_CLS_FILE_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
@@ -246,6 +245,15 @@ H5P_init_interface(void)
if ((H5P_CLS_DATASET_XFER_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+ /* Allocate the mount class */
+ if (NULL==(pclass = H5P_create_class (root_class,"file mount",H5P_MOUNT_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
+
+ /* Register the mount class */
+ if ((H5P_CLS_MOUNT_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
+ HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
+
FUNC_LEAVE(ret_value);
}
@@ -339,33 +347,6 @@ H5Pcreate(hid_t type)
if((ret_value=H5Pcreate_list(type))<0)
HRETURN_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list");
} /* end if */
- else {
- /* Set the type of the property list to create for older property lists */
- old_type=(H5P_class_t_old)type;
- assert( old_type == H5P_MOUNT_OLD);
-
- /* Allocate a new property list and initialize it with default values */
- switch (old_type) {
- case H5P_MOUNT_OLD:
- src = &H5F_mount_dflt;
- break;
- default:
- HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
- "unknown property list class");
- } /* end switch */
-
- /* Copy the property list */
- if (NULL==(new_plist=H5P_copy(old_type, src))) {
- HRETURN_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,
- "unable to copy default property list");
- } /* end if */
-
- /* Atomize the new property list */
- if ((ret_value = H5P_create(old_type, new_plist)) < 0) {
- HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL,
- "unable to register property list");
- } /* end if */
- } /* end else */
FUNC_LEAVE(ret_value);
}
@@ -489,16 +470,6 @@ H5P_close(void *_plist)
if (!plist)
HRETURN (SUCCEED);
- /* Some property lists may need to do special things */
- switch (plist->cls) {
- case H5P_MOUNT_OLD:
- break;
-
- default:
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "unknown property list class");
- }
-
/* Return the property list to the free list */
H5FL_FREE(H5P_t,plist);
@@ -918,17 +889,6 @@ H5P_copy (H5P_class_t_old type, const void *src)
FUNC_ENTER (H5P_copy, NULL);
- /* How big is the property list */
- switch (type) {
- case H5P_MOUNT_OLD:
- size = sizeof(H5F_mprop_t);
- break;
-
- default:
- HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL,
- "unknown property list class");
- }
-
/* Create the new property list */
if (NULL==(dst = H5FL_ALLOC(H5P_t,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
@@ -941,18 +901,6 @@ H5P_copy (H5P_class_t_old type, const void *src)
/* Set the type of the property list */
dst->cls=type;
- /* Deep-copy pointers */
- switch (type) {
-
- case H5P_MOUNT_OLD:
- /* Nothing to do */
- break;
-
- default:
- HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL,
- "unknown property list class");
- }
-
FUNC_LEAVE (dst);
}
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index f6d7573..bc68de8 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -90,13 +90,8 @@ typedef struct H5P_genplist_tag {
H5P_genprop_t *props[1]; /* Hash table of pointers to properties in the list */
} H5P_genplist_t;
-/* Master property list structure */
typedef struct {
- /* Union of all the different kinds of property lists */
- union {
- H5F_mprop_t mount; /* Mounting properties */
- } u;
- H5P_class_t_old cls; /* Property list class */
+ H5P_class_t cls;
} H5P_t;
/* Private functions, not part of the publicly documented API */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index d9a1911..a58d00a 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -39,7 +39,6 @@ typedef long off_t;
/* Property list classes */
typedef enum H5P_class_t_old {
H5P_NO_CLASS_OLD = -1, /*error return value */
- H5P_MOUNT_OLD = 0, /*file mounting properties */
H5P_NCLASSES_OLD /*this must be last! */
} H5P_class_t_old;
@@ -54,7 +53,6 @@ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */
/* - merge/delete H5Pcopy and H5Pcopy_new */
/* - merge/delete H5Pclose and H5Pclose_list */
__DLLVAR__ hid_t H5P_NO_CLASS;
-__DLLVAR__ hid_t H5P_MOUNT;
/* H5P_DATASET_XFER was the name from the beginning through 1.2. It was
* changed to H5P_DATA_XFER on v1.3.0. Then it was changed back to
@@ -98,7 +96,7 @@ extern "C" {
#define H5P_DATASET_CREATE_HASH_SIZE 17
#define H5P_DATASET_XFER (H5open(), H5P_CLS_DATASET_XFER_g)
#define H5P_DATASET_XFER_HASH_SIZE 17
-#define H5P_MOUNT_NEW (H5open(), H5P_CLS_MOUNT_g)
+#define H5P_MOUNT (H5open(), H5P_CLS_MOUNT_g)
#define H5P_MOUNT_HASH_SIZE 17
__DLLVAR__ hid_t H5P_CLS_NO_CLASS_g;
__DLLVAR__ hid_t H5P_CLS_FILE_CREATE_g;