summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-01-07 17:14:26 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-01-07 17:14:26 (GMT)
commit159fa7a232e1961940b83f035f4c27338d26337e (patch)
treeb7344e9cfaadbbec3bc3a0576df8c264debb8239 /src/H5D.c
parent1d17defdfc977c063c7ff20b5868bef9a76e5d9a (diff)
downloadhdf5-159fa7a232e1961940b83f035f4c27338d26337e.zip
hdf5-159fa7a232e1961940b83f035f4c27338d26337e.tar.gz
hdf5-159fa7a232e1961940b83f035f4c27338d26337e.tar.bz2
[svn-r151] Changes since 19980105
---------------------- ./config/freebsd2.2.1 ./config/linux Added -UH5O_DEBUG to the debug flags. Turn this on to get lots of lines on stderr to show what objects are opened and closed. ./src/H5C.o ./src/H5Cpublic.h ./test/dsets.c ./test/tfile.c Split H5Cget_prop() and H5Cset_prop() into functions for each property. ./src/H5D.c ./src/H5Dpublic.h ./src/H5Gstab.c ./src/H5O.c ./src/H5Ocont.c ./src/H5Ocstore.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Oistore.c ./src/H5Oname.c ./src/H5Onull.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Ostab.c ./src/H5P.c ./src/istore.c ./test/tohdr.c Object header functions now understand constant vs. non-constant messages. ./src/H5F.c ./src/H5Fprivate.h The file OID can be closed before other OID's. ./src/H5Flow.c H5F_addr_defined() is a macro in this file. ./src/H5G.c ./src/H5Gpublic.h ./test/tstab.c A current working group cannot be deleted. ./src/H5Gent.c ./src/H5Gpkg.h Removed unused functionality. ./src/H5public.h Includes <sys/types.h> for size_t.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c53
1 files changed, 24 insertions, 29 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 242cc8b..5c91866 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -36,7 +36,6 @@ static char RcsId[] = "@(#)$Revision$";
* A dataset is the following struct.
*/
struct H5D_t {
- H5F_t *file; /*file store for this object */
H5G_entry_t ent; /*cached object header stuff */
H5T_t *type; /*datatype of this dataset */
H5P_t *space; /*dataspace of this dataset */
@@ -310,7 +309,7 @@ H5Dclose (hid_t dataset_id)
/* Check args */
if (H5_DATASET!=H5Aatom_group (dataset_id) ||
NULL==(dataset=H5Aatom_object (dataset_id)) ||
- NULL==dataset->file) {
+ NULL==dataset->ent.file) {
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
}
@@ -378,7 +377,7 @@ H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id,
/* check arguments */
if (H5_DATASET!=H5Aatom_group (dataset_id) ||
NULL==(dataset=H5Aatom_object (dataset_id)) ||
- NULL==dataset->file) {
+ NULL==dataset->ent.file) {
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
}
if (H5_DATATYPE!=H5Aatom_group (type_id) ||
@@ -458,7 +457,7 @@ H5Dwrite (hid_t dataset_id, hid_t type_id, hid_t space_id,
/* check arguments */
if (H5_DATASET!=H5Aatom_group (dataset_id) ||
NULL==(dataset=H5Aatom_object (dataset_id)) ||
- NULL==dataset->file) {
+ NULL==dataset->ent.file) {
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
}
if (H5_DATATYPE!=H5Aatom_group (type_id) ||
@@ -575,7 +574,6 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
/* Initialize the dataset object */
new_dset = H5MM_xcalloc (1, sizeof(H5D_t));
- new_dset->file = f;
H5F_addr_undef (&(new_dset->ent.header));
new_dset->type = H5T_copy (type);
new_dset->space = H5P_copy (space);
@@ -590,7 +588,7 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
}
/* Update the type and space header messages */
- if (H5O_modify (f, &(new_dset->ent), H5O_DTYPE, 0, new_dset->type)<0 ||
+ if (H5O_modify (&(new_dset->ent), H5O_DTYPE, 0, 0, new_dset->type)<0 ||
H5P_modify (f, &(new_dset->ent), new_dset->space)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"can't update type or space header messages");
@@ -608,7 +606,7 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
HGOTO_ERROR (H5E_DATASET, H5E_NOSPACE, NULL,
"can't allocate raw file storage");
}
- if (H5O_modify (f, &(new_dset->ent), H5O_CSTORE, 0,
+ if (H5O_modify (&(new_dset->ent), H5O_CSTORE, 0, 0,
&(new_dset->storage.cstore))<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"can't update dataset object header");
@@ -635,7 +633,7 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"can't initialize chunked storage");
}
- if (H5O_modify (f, &(new_dset->ent), H5O_ISTORE, 0,
+ if (H5O_modify (&(new_dset->ent), H5O_ISTORE, 0, 0,
&(new_dset->storage.istore))<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"can't update dataset object header");
@@ -648,7 +646,7 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
}
/* Give the dataset a name */
- if (H5G_insert (f, name, &(new_dset->ent))<0) {
+ if (H5G_insert (name, &(new_dset->ent))<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset");
}
@@ -661,9 +659,9 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
if (new_dset->type) H5T_close (new_dset->type);
if (new_dset->space) H5P_close (new_dset->space);
if (H5F_addr_defined (&(new_dset->ent.header))) {
- H5O_close (f, &(new_dset->ent));
+ H5O_close (&(new_dset->ent));
}
- new_dset->file = NULL;
+ new_dset->ent.file = NULL;
H5MM_xfree (new_dset);
}
@@ -705,7 +703,6 @@ H5D_open (H5F_t *f, const char *name)
assert (name && *name);
dataset = H5MM_xcalloc (1, sizeof(H5D_t));
- dataset->file = f;
dataset->create_parms = H5D_create_dflt;
H5F_addr_undef (&(dataset->ent.header));
@@ -718,9 +715,8 @@ H5D_open (H5F_t *f, const char *name)
}
/* Get the type and space */
- if (NULL==(dataset->type = H5O_read (f, &(dataset->ent), H5O_DTYPE,
- 0, NULL)) ||
- NULL==(dataset->space = H5P_read (f, &(dataset->ent)))) {
+ if (NULL==(dataset->type=H5O_read (&(dataset->ent), H5O_DTYPE, 0, NULL)) ||
+ NULL==(dataset->space=H5P_read (f, &(dataset->ent)))) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"can't load type of space info from dataset header");
}
@@ -731,12 +727,11 @@ H5D_open (H5F_t *f, const char *name)
* values are copied to the dataset create template so the user can query
* them.
*/
- if (H5O_read (dataset->file, &(dataset->ent), H5O_CSTORE, 0,
- &(dataset->storage.cstore))) {
+ if (H5O_read (&(dataset->ent), H5O_CSTORE, 0, &(dataset->storage.cstore))) {
/* Contiguous storage */
dataset->create_parms.layout = H5D_CONTIGUOUS;
- } else if (H5O_read (dataset->file, &(dataset->ent), H5O_ISTORE, 0,
+ } else if (H5O_read (&(dataset->ent), H5O_ISTORE, 0,
&(dataset->storage.istore))) {
/*
* Chunked storage. The creation template's dimension is one less than
@@ -763,11 +758,11 @@ H5D_open (H5F_t *f, const char *name)
done:
if (!ret_value && dataset) {
if (H5F_addr_defined (&(dataset->ent.header))) {
- H5O_close (f, &(dataset->ent));
+ H5O_close (&(dataset->ent));
}
if (dataset->type) H5T_close (dataset->type);
if (dataset->space) H5P_close (dataset->space);
- dataset->file = NULL;
+ dataset->ent.file = NULL;
H5MM_xfree (dataset);
}
@@ -805,10 +800,10 @@ H5D_close (H5D_t *dataset)
FUNC_ENTER (H5D_close, FAIL);
/* check args */
- assert (dataset && dataset->file);
+ assert (dataset && dataset->ent.file);
/* Close the dataset object */
- H5O_close (dataset->file, &(dataset->ent));
+ H5O_close (&(dataset->ent));
/*
* Release dataset type and space - there isn't much we can do if one of
@@ -823,7 +818,7 @@ H5D_close (H5D_t *dataset)
* sure we're not accessing an already freed dataset (see the assert()
* above).
*/
- dataset->file = NULL;
+ dataset->ent.file = NULL;
H5MM_xfree (dataset);
if (free_failed) {
@@ -869,7 +864,7 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space,
FUNC_ENTER (H5D_read, FAIL);
/* check args */
- assert (dataset && dataset->file);
+ assert (dataset && dataset->ent.file);
assert (type);
assert (xfer_parms);
assert (buf);
@@ -895,7 +890,7 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space,
/*
* Read a block of contiguous data.
*/
- if (H5F_block_read (dataset->file, &(dataset->storage.cstore.addr),
+ if (H5F_block_read (dataset->ent.file, &(dataset->storage.cstore.addr),
nbytes, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed");
}
@@ -908,7 +903,7 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space,
for (i=0; i<dataset->storage.istore.ndims; i++) offset[i] = 0;
H5P_get_dims (dataset->space, size);
size[dataset->storage.istore.ndims-1] = H5T_get_size (dataset->type);
- if (H5F_istore_read (dataset->file, &(dataset->storage.istore),
+ if (H5F_istore_read (dataset->ent.file, &(dataset->storage.istore),
offset, size, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed");
}
@@ -958,7 +953,7 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space,
FUNC_ENTER (H5D_write, FAIL);
/* check args */
- assert (dataset && dataset->file);
+ assert (dataset && dataset->ent.file);
assert (type);
assert (xfer_parms);
assert (buf);
@@ -985,7 +980,7 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space,
/*
* Write a contiguous chunk of data.
*/
- if (H5F_block_write (dataset->file, &(dataset->storage.cstore.addr),
+ if (H5F_block_write (dataset->ent.file, &(dataset->storage.cstore.addr),
nbytes, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed");
}
@@ -998,7 +993,7 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space,
for (i=0; i<dataset->storage.istore.ndims; i++) offset[i] = 0;
H5P_get_dims (dataset->space, size);
size[dataset->storage.istore.ndims-1] = H5T_get_size (dataset->type);
- if (H5F_istore_write (dataset->file, &(dataset->storage.istore),
+ if (H5F_istore_write (dataset->ent.file, &(dataset->storage.istore),
offset, size, buf)<0) {
HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed");
}