summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-28 15:24:12 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-28 15:24:12 (GMT)
commit1b1be9918c1a654225f2040619f0b26ae83028fb (patch)
treedb8bfa193965145aea917d4f06f122238324555d /src/H5O.c
parent69ed3c270a64d5c60544126b34431d1a7e9a7c8c (diff)
downloadhdf5-1b1be9918c1a654225f2040619f0b26ae83028fb.zip
hdf5-1b1be9918c1a654225f2040619f0b26ae83028fb.tar.gz
hdf5-1b1be9918c1a654225f2040619f0b26ae83028fb.tar.bz2
[svn-r627] Changes since 19980827
---------------------- ./src/H5G.c Fixed a link count on groups. Groups were always created with a link count of zero instead of one. ./src/H5Gpublic.h Added H5G_NTYPES so applications can easily declare arrays which are indexed by object type. ./src/H5O.c Calling `H5O_link(&ent,0)' will succeed when the file is open for read only because it's the only way to get the object's current link count. ./tools/h5ls.c Can take non-group object names on the command line (and multiple objects). Reorganized to be more extendible. The link count is displayed for `-v'. ./src/H5F.c Dumping of cache statistics is controlled by only the HDF5_DEBUG environment variable and not the H5F_ACC_DEBUG flag for H5Fopen() and H5Fcreate() since this makes it similar to the other debugging options. ./src/H5R.c ./test/ragged.c ./test/Makefile.in Tests pass but still a little work left to be done.
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 81efca7..addd14b 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -779,6 +779,11 @@ H5O_copy (const H5O_class_t *type, const void *mesg, void *dst)
*
* Modifications:
*
+ * Robb Matzke, 1998-08-27
+ * This function can also be used to obtain the current number of links
+ * if zero is passed for ADJUST. If that's the case then we don't check
+ * for write access on the file.
+ *
*-------------------------------------------------------------------------
*/
intn
@@ -793,7 +798,7 @@ H5O_link(H5G_entry_t *ent, intn adjust)
assert(ent);
assert(ent->file);
assert(H5F_addr_defined(&(ent->header)));
- if (0==(ent->file->intent & H5F_ACC_RDWR)) {
+ if (adjust!=0 && 0==(ent->file->intent & H5F_ACC_RDWR)) {
HGOTO_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL,
"no write intent on file");
}
@@ -806,19 +811,19 @@ H5O_link(H5G_entry_t *ent, intn adjust)
}
/* adjust link count */
- if (adjust < 0) {
+ if (adjust<0) {
if (oh->nlink + adjust < 0) {
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL,
"link count would be negative");
}
oh->nlink += adjust;
- } else {
+ oh->dirty = TRUE;
+ } else if (adjust>0) {
oh->nlink += adjust;
+ oh->dirty = TRUE;
}
- oh->dirty = TRUE;
ret_value = oh->nlink;
-
done:
if (oh && H5AC_unprotect(ent->file, H5AC_OHDR, &(ent->header), oh) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_PROTECT, FAIL,