summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-03-27 20:25:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-03-27 20:25:03 (GMT)
commit7e9738f290af26d1bf4ab9db64544d9a89505f0a (patch)
treee5e0986486cbd1440a6acd3adf14cc533c70cfe0 /src/H5F.c
parent30aa868e1082ddd7cc59b4f0716434f4a02fcbdd (diff)
downloadhdf5-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/H5F.c')
-rw-r--r--src/H5F.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 199807c..71b009a 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -3222,7 +3222,7 @@ H5F_sizeof_size(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_get_intent
+ * Function: H5F_get_driver_id
*
* Purpose: Quick and dirty routine to retrieve the file's 'driver_id' value
* (Mainly added to stop non-file routines from poking about in the
@@ -3251,6 +3251,43 @@ H5F_get_driver_id(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_fileno
+ *
+ * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * March 27, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_get_fileno(const H5F_t *f, unsigned long *filenum)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER(H5F_get_fileno, FAIL);
+
+ assert(f);
+ assert(f->shared);
+ assert(f->shared->lf);
+ assert(filenum);
+
+ /* Retrieve the file's serial number */
+ if(H5FD_get_fileno(f->shared->lf,filenum)<0)
+ HRETURN_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5F_get_fileno() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_block_read
*
* Purpose: Reads some data from a file/server/etc into a buffer.