diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-03-27 20:25:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-03-27 20:25:03 (GMT) |
commit | 7e9738f290af26d1bf4ab9db64544d9a89505f0a (patch) | |
tree | e5e0986486cbd1440a6acd3adf14cc533c70cfe0 /src/H5G.c | |
parent | 30aa868e1082ddd7cc59b4f0716434f4a02fcbdd (diff) | |
download | hdf5-7e9738f290af26d1bf4ab9db64544d9a89505f0a.zip hdf5-7e9738f290af26d1bf4ab9db64544d9a89505f0a.tar.gz hdf5-7e9738f290af26d1bf4ab9db64544d9a89505f0a.tar.bz2 |
[svn-r5096] Purpose:
Bug Fix
Description:
The H5Gget_objinfo() function was not setting the 'fileno' field in the
H5G_stat_t struct passed in.
Solution:
Added a "file serial number" to each file currently open in the library
and put that in the 'fileno' field. If a file is opened twice (with
H5Fopen) and the VFL driver detects that it is the same file (i.e. the
two file structures have the same "shared file info" in the library's
memory structures), they will have the same serial number.
This serial number has two drawbacks:
- If a VFL driver doesn't/can't detect that two calls to H5Fopen with
the same file actually _are_ the same file, each will get a
different serial number
- If the same file is closed and re-opened, the serial number will be
different.
It is be possible to fix the second drawback for many VFL drivers, but it
would be a lot of effort and probably isn't worth it until we've got a
good reason to do it. Dunno if we'll ever be able to fix the first
drawback...
Platforms tested:
FreeBSD 4.5 (sleipnir)
VS: ----------------------------------------------------------------------
Diffstat (limited to 'src/H5G.c')
-rw-r--r-- | src/H5G.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -2044,7 +2044,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, if (H5G_CACHED_SLINK==obj_ent.type) { /* Named object is a symbolic link */ if (NULL==H5O_read (&grp_ent, H5O_STAB, 0, &stab_mesg) || - NULL==(s=H5HL_peek (grp_ent.file, stab_mesg.heap_addr, + NULL==(s=H5HL_peek (grp_ent.file, stab_mesg.heap_addr, obj_ent.cache.slink.lval_offset))) { HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value"); @@ -2069,11 +2069,15 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, if (NULL==H5O_read(&obj_ent, H5O_MTIME, 0, &(statbuf->mtime))) { H5E_clear(); statbuf->mtime = 0; - } + } /* end if */ statbuf->type = H5G_get_type(&obj_ent); H5E_clear(); /*clear errors resulting from checking type*/ - } - } + } /* end else */ + + /* Common code to retrieve the file's fileno */ + if(H5F_get_fileno(obj_ent.file,statbuf->fileno)<0) + HRETURN_ERROR (H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno"); + } /* end if */ FUNC_LEAVE (SUCCEED); } |