summaryrefslogtreecommitdiffstats
path: root/src/H5FO.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-09-28 19:04:19 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-09-28 19:04:19 (GMT)
commit5c0011a71384223791d18028968382db43f08a6f (patch)
tree113cc1dd6c8d0ecd1996ddb8f0e9f7693f470e95 /src/H5FO.c
parenta841ea35292de8097b429f98af48b29f21c97893 (diff)
downloadhdf5-5c0011a71384223791d18028968382db43f08a6f.zip
hdf5-5c0011a71384223791d18028968382db43f08a6f.tar.gz
hdf5-5c0011a71384223791d18028968382db43f08a6f.tar.bz2
[svn-r9329]
Purpose: Feature Description: Datatypes and groups now use H5FO "file object" code that was previously only used by datasets. These objects will hold a file open if the file is closed but they have not yet been closed. If these objects are unlinked then relinked, they will not be destroyed. If they are opened twice (even by two different names), both IDs will "see" changes made to the object using the other ID. When an object is opened using two different names (e.g., if a dataset was opened under one name, then mounted and opened under its new name), calling H5Iget_name() on a given hid_t will return the name used to open that hid_t, not the current name of the object (this is a feature, and a change from the previous behavior of datasets). Solution: Used H5FO code that was already in place for datasets. Broke H5D_t's, H5T_t's, and H5G_t's into a "shared" struct and a private struct. The shared structs (H5D_shared_t, etc.) hold the object's information and are used by all IDs that point to a given object in the file. The private structs are pointed to by the hid_t and contain the object's group entry information (including its name) and a pointer to the shared struct for that object. This changed the naming of structs throughout the library (e.g., datatype->size is now datatype->shared->size). I added an updated H5Tinit.c to windows.zip. Platforms tested: Visual Studio 7, sleipnir, arabica, verbena Misc. update:
Diffstat (limited to 'src/H5FO.c')
-rw-r--r--src/H5FO.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/H5FO.c b/src/H5FO.c
index 32b3706..4f6fcce 100644
--- a/src/H5FO.c
+++ b/src/H5FO.c
@@ -38,7 +38,7 @@
typedef struct H5FO_open_obj_t {
haddr_t addr; /* Address of object header for object */
/* THIS MUST BE FIRST FOR TBBT ROUTINES */
- hid_t id; /* Current ID for object */
+ void *obj; /* Pointer to the object */
hbool_t deleted; /* Flag to indicate that the object was deleted from the file */
} H5FO_open_obj_t;
@@ -90,12 +90,12 @@ done:
PURPOSE
Checks if an object at an address is already open in the file.
USAGE
- hid_t H5FO_opened(f,addr)
+ void * H5FO_opened(f,addr)
const H5F_t *f; IN: File to check opened object info set
haddr_t addr; IN: Address of object to check
RETURNS
- Returns a non-negative ID for the object on success, negative on failure
+ Returns a pointer to the object on success, NULL on failure
DESCRIPTION
Check is an object at an address (the address of the object's object header)
is already open in the file and return the ID for that object if it is open.
@@ -104,12 +104,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hid_t
+void *
H5FO_opened(const H5F_t *f, haddr_t addr)
{
H5TB_NODE *obj_node; /* TBBT node holding open object */
H5FO_open_obj_t *open_obj; /* Information about open object */
- hid_t ret_value; /* Return value */
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOFUNC(H5FO_opened)
@@ -123,11 +123,11 @@ H5FO_opened(const H5F_t *f, haddr_t addr)
if((obj_node=H5TB_dfind(f->shared->open_objs,&addr,NULL))!=NULL) {
open_obj=H5TB_NODE_DATA(obj_node);
assert(open_obj);
- ret_value=open_obj->id;
+ ret_value=open_obj->obj;
assert(ret_value>0);
} /* end if */
else
- ret_value=FAIL;
+ ret_value=NULL;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FO_opened() */
@@ -137,12 +137,12 @@ H5FO_opened(const H5F_t *f, haddr_t addr)
NAME
H5FO_insert
PURPOSE
- Insert a newly opened object/ID pair into the opened object info set
+ Insert a newly opened object/pointer pair into the opened object info set
USAGE
- herr_t H5FO_insert(f,addr,id)
+ herr_t H5FO_insert(f,addr,obj)
H5F_t *f; IN/OUT: File's opened object info set
haddr_t addr; IN: Address of object to insert
- hid_t id; IN: ID of object to insert
+ void *obj; IN: Pointer to object to insert
int type; IN: Type of object being inserted
RETURNS
@@ -155,7 +155,7 @@ H5FO_opened(const H5F_t *f, haddr_t addr)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5FO_insert(const H5F_t *f, haddr_t addr, hid_t id)
+H5FO_insert(const H5F_t *f, haddr_t addr, void *obj)
{
H5FO_open_obj_t *open_obj; /* Information about open object */
herr_t ret_value=SUCCEED; /* Return value */
@@ -167,7 +167,7 @@ H5FO_insert(const H5F_t *f, haddr_t addr, hid_t id)
assert(f->shared);
assert(f->shared->open_objs);
assert(H5F_addr_defined(addr));
- assert(id>0);
+ assert(obj);
/* Allocate new opened object information structure */
if((open_obj=H5FL_MALLOC(H5FO_open_obj_t))==NULL)
@@ -175,7 +175,7 @@ H5FO_insert(const H5F_t *f, haddr_t addr, hid_t id)
/* Assign information */
open_obj->addr=addr;
- open_obj->id=id;
+ open_obj->obj=obj;
open_obj->deleted=0;
/* Insert into TBBT */