summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c212
-rw-r--r--src/H5Fmount.c89
-rw-r--r--src/H5Fpkg.h5
-rw-r--r--src/H5Fprivate.h3
-rw-r--r--src/H5Fsfile.c226
-rwxr-xr-xsrc/Makefile.am2
-rw-r--r--src/Makefile.in42
7 files changed, 327 insertions, 252 deletions
diff --git a/src/H5F.c b/src/H5F.c
index ea9e608..4cd5b67 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -60,12 +60,6 @@ typedef struct H5F_olist_t {
int max_index; /* Maximum # of IDs to put into array */
} H5F_olist_t;
-/* Struct for tracking "shared" file structs */
-typedef struct H5F_sfile_node_t {
- H5F_file_t *shared; /* Pointer to "shared" struct */
- struct H5F_sfile_node_t *next; /* Pointer to next node */
-} H5F_sfile_node_t;
-
/* PRIVATE PROTOTYPES */
#ifdef NOT_YET
@@ -81,23 +75,12 @@ static unsigned H5F_get_objects(const H5F_t *f, unsigned types, int max_objs, hi
static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void** file_handle);
-/* Routines to operate on the shared file list */
-static herr_t H5F_shared_add(H5F_file_t *shared);
-static H5F_file_t * H5F_shared_search(H5FD_t *lf);
-static herr_t H5F_shared_remove(H5F_file_t *shared);
-
/* Declare a free list to manage the H5F_t struct */
H5FL_DEFINE_STATIC(H5F_t);
/* Declare a free list to manage the H5F_file_t struct */
H5FL_DEFINE_STATIC(H5F_file_t);
-/* Declare a free list to manage the H5F_sfile_node_t struct */
-H5FL_DEFINE_STATIC(H5F_sfile_node_t);
-
-/* Declare a local variable to track the shared file information */
-H5F_sfile_node_t *H5F_sfile_head_g = NULL;
-
/*-------------------------------------------------------------------------
* Function: H5F_init
@@ -452,7 +435,7 @@ H5F_term_interface(void)
H5I_clear_type(H5I_FILE, FALSE);
} else {
/* Make certain we've cleaned up all the shared file objects */
- HDassert(H5F_sfile_head_g == NULL);
+ H5F_sfile_assert_num(0);
H5I_dec_type_ref(H5I_FILE);
H5_interface_initialize_g = 0;
@@ -1535,7 +1518,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
/* Add new "shared" struct to list of open files */
- if(H5F_shared_add(f->shared) < 0)
+ if(H5F_sfile_add(f->shared) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files")
} /* end else */
@@ -1601,7 +1584,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
if (1==f->shared->nrefs) {
/* Remove shared file struct from list of open files */
- if(H5F_shared_remove(f->shared) < 0) {
+ if(H5F_sfile_remove(f->shared) < 0) {
HERROR(H5E_FILE, H5E_CANTRELEASE, "problems closing file");
ret_value = FAIL; /*but keep going*/
} /* end if */
@@ -1811,7 +1794,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
} /* end if */
/* Is the file already open? */
- if ((shared = H5F_shared_search(lf)) != NULL) {
+ if ((shared = H5F_sfile_search(lf)) != NULL) {
/*
* The file is already open, so use that one instead of the one we
* just opened. We only one one H5FD_t* per file so one doesn't
@@ -2579,6 +2562,24 @@ H5F_close(H5F_t *f)
HDassert(f);
HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */
+ /* Perform checks for "semi" file close degree here, since closing the
+ * file is not allowed if there are objects still open */
+ if(f->shared->fc_degree == H5F_CLOSE_SEMI) {
+ unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */
+ unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */
+
+ /* Get the number of open objects and open files on this file/mount hierarchy */
+ if(H5F_mount_count_ids(f, &nopen_files, &nopen_objs) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy")
+
+ /* If there are no other file IDs open on this file/mount hier., but
+ * there are still open objects, issue an error and bail out now,
+ * without decrementing the file ID's reference count and triggering
+ * a "real" attempt at closing the file */
+ if(nopen_files == 1 && nopen_objs > 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open")
+ } /* end if */
+
/* Reset the file ID for this file */
f->file_id = -1;
@@ -2781,43 +2782,15 @@ done:
herr_t
H5Fclose(hid_t file_id)
{
- H5F_t *f;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Fclose, FAIL)
H5TRACE1("e","i",file_id);
/* Check/fix arguments. */
- if (NULL == (f = H5I_object_verify(file_id,H5I_FILE)))
+ if (H5I_FILE != H5I_get_type(file_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID")
- /* Perform checks for "semi" file close degree here, since closing the
- * file ID will mess things up if we need to return FAIL */
- if(f->shared->fc_degree == H5F_CLOSE_SEMI) {
- int ref_count; /* Reference count for file's ID */
-
- /* Get the reference count for this ID */
- if((ref_count = H5I_get_ref(file_id)) < 0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count")
-
- /* If we will be decrementing the reference count to zero, check for objects open */
- if(ref_count == 1) {
- unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */
- unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */
-
- /* Get the number of open objects and open files on this file/mount hierarchy */
- if(H5F_mount_count_ids(f, &nopen_files, &nopen_objs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy")
-
- /* If there are no other file IDs open on this file/mount hier., but
- * there are still open objects, issue an error and bail out now,
- * before decrementing the file ID's reference count and triggering
- * a "real" attempt at closing the file */
- if(nopen_files == 1 && nopen_objs > 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open")
- } /* end if */
- } /* end if */
-
/*
* Decrement reference count on atom. When it reaches zero the file will
* be closed.
@@ -4163,142 +4136,3 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_name() */
-
-/*-------------------------------------------------------------------------
- * Function: H5F_shared_add
- *
- * Purpose: Add a "shared" file struct to the list of open files
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * Monday, July 18, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5F_shared_add(H5F_file_t *shared)
-{
- H5F_sfile_node_t *new_shared; /* New shared file node */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5F_shared_add)
-
- /* Sanity check */
- HDassert(shared);
-
- /* Allocate new shared file node */
- if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Set shared file value */
- new_shared->shared = shared;
-
- /* Prepend to list of shared files open */
- new_shared->next = H5F_sfile_head_g;
- H5F_sfile_head_g = new_shared;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_shared_add() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_shared_search
- *
- * Purpose: Search for a "shared" file with low-level file info that
- * matches
- *
- * Return: Non-NULL on success / NULL on failure
- *
- * Programmer: Quincey Koziol
- * Monday, July 18, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static H5F_file_t *
-H5F_shared_search(H5FD_t *lf)
-{
- H5F_sfile_node_t *curr; /* Current shared file node */
- H5F_file_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_shared_search)
-
- /* Sanity check */
- HDassert(lf);
-
- /* Iterate through low-level files for matching low-level file info */
- curr = H5F_sfile_head_g;
- while(curr) {
- /* Check for match */
- if(0==H5FD_cmp(curr->shared->lf, lf))
- HGOTO_DONE(curr->shared)
-
- /* Advance to next shared file node */
- curr = curr->next;
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_shared_search() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_shared_remove
- *
- * Purpose: Remove a "shared" file struct from the list of open files
- *
- * Return: SUCCEED/FAIL
- *
- * Programmer: Quincey Koziol
- * Monday, July 18, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5F_shared_remove(H5F_file_t *shared)
-{
- H5F_sfile_node_t *curr; /* Current shared file node */
- H5F_sfile_node_t *last; /* Last shared file node */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5F_shared_remove)
-
- /* Sanity check */
- HDassert(shared);
-
- /* Locate shared file node with correct shared file */
- last = NULL;
- curr = H5F_sfile_head_g;
- while(curr && curr->shared != shared) {
- /* Advance to next node */
- last = curr;
- curr = curr->next;
- } /* end while */
-
- /* Indicate error if the node wasn't found */
- if(curr == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
-
- /* Remove node found from list */
- if(last != NULL)
- /* Removing middle or tail node in list */
- last->next = curr->next;
- else
- /* Removing head node in list */
- H5F_sfile_head_g = curr->next;
-
- /* Release the shared file node struct */
- /* (the shared file info itself is freed elsewhere) */
- H5FL_FREE(H5F_sfile_node_t, curr);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_shared_remove() */
-
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 7e234a5..18feb9c 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -34,7 +34,7 @@
NAME
H5F_init_mount_interface -- Initialize interface-specific information
USAGE
- herr_t H5T_init_mount_interface()
+ herr_t H5F_init_mount_interface()
RETURNS
Non-negative on success/Negative on failure
@@ -256,15 +256,15 @@ static herr_t
H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
{
H5G_t *mounted = NULL; /*mount point group */
+ H5G_t *child_group = NULL; /* Child's group in parent mtab */
+ H5F_t *child_file = NULL; /* Child's file in parent mtab */
H5G_entry_t *mnt_ent = NULL; /*mounted symbol table entry */
H5F_t *child = NULL; /*mounted file */
H5F_t *parent = NULL; /*file where mounted */
H5G_entry_t *ent = NULL; /*temporary symbol table entry */
- H5G_entry_t mnt_open_ent; /* entry used to open mount point*/
- herr_t ret_value = FAIL; /*return value */
- unsigned i; /*coutners */
- unsigned lt, rt, md=0; /*binary search indices */
- int cmp; /*binary search comparison value*/
+ H5G_entry_t mnt_open_ent; /* entry used to open mount point*/
+ int child_idx; /* Index of child in parent's mtab */
+ herr_t ret_value = SUCCEED; /*return value */
FUNC_ENTER_NOAPI_NOINIT(H5F_unmount)
@@ -283,37 +283,27 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
child = H5G_fileof(mounted);
mnt_ent = H5G_entof(mounted);
ent = H5G_entof(child->shared->root_grp);
+ child_idx = -1;
if (child->mtab.parent && H5F_addr_eq(mnt_ent->header, ent->header)) {
+ unsigned u; /*counters */
+
/*
* We've been given the root group of the child. We do a reverse
* lookup in the parent's mount table to find the correct entry.
*/
parent = child->mtab.parent;
- for (i=0; i<parent->mtab.nmounts; i++) {
- if (parent->mtab.child[i].file==child) {
- /* Search the open IDs replace names to reflect unmount operation */
- if (H5G_replace_name( H5G_UNKNOWN, mnt_ent, mnt_ent->user_path_r, NULL, NULL, NULL, OP_UNMOUNT )<0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to replace name ")
-
- /* Unmount the child */
- parent->mtab.nmounts -= 1;
- if(H5G_unmount(parent->mtab.child[md].group)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to reset group mounted flag")
- if(H5G_close(parent->mtab.child[i].group)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group")
- child->mtab.parent = NULL;
- if(H5F_try_close(child)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted file")
-
- /* Eliminate the mount point from the table */
- HDmemmove(parent->mtab.child+i, parent->mtab.child+i+1,
- (parent->mtab.nmounts-i)* sizeof(parent->mtab.child[0]));
- ret_value = SUCCEED;
+ for (u=0; u<parent->mtab.nmounts; u++) {
+ if (parent->mtab.child[u].file==child) {
+ /* Found the correct index */
+ child_idx = u;
+ break;
}
}
- HDassert(ret_value>=0);
} else {
+ unsigned lt, rt, md=0; /*binary search indices */
+ int cmp; /*binary search comparison value*/
+
/*
* We've been given the mount point in the parent. We use a binary
* search in the parent to locate the mounted file, if any.
@@ -335,22 +325,37 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id)
if (cmp)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "not a mount point")
- /* Unmount the child */
- parent->mtab.nmounts -= 1;
- if(H5G_unmount(parent->mtab.child[md].group)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to reset group mounted flag")
- if(H5G_close(parent->mtab.child[md].group)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group")
- parent->mtab.child[md].file->mtab.parent = NULL;
- if(H5F_try_close(parent->mtab.child[md].file)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted file")
-
- /* Eliminate the mount point from the table */
- HDmemmove(parent->mtab.child+md, parent->mtab.child+md+1,
- (parent->mtab.nmounts-md)*sizeof(parent->mtab.child[0]));
- ret_value = SUCCEED;
+ /* Found the correct index */
+ child_idx = md;
+ mnt_ent = ent;
}
-
+
+ HDassert(child_idx >= 0);
+
+ /* Search the open IDs replace names to reflect unmount operation */
+ if (H5G_replace_name(H5G_UNKNOWN, mnt_ent, mnt_ent->user_path_r, NULL, NULL, NULL, OP_UNMOUNT )<0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to replace name ")
+
+ /* Save the information about the child from the mount table */
+ child_group = parent->mtab.child[child_idx].group;
+ child_file = parent->mtab.child[child_idx].file;
+
+ /* Eliminate the mount point from the table */
+ HDmemmove(parent->mtab.child+child_idx, parent->mtab.child+child_idx+1,
+ (parent->mtab.nmounts-child_idx)*sizeof(parent->mtab.child[0]));
+ parent->mtab.nmounts -= 1;
+
+ /* Unmount the child file from the parent file */
+ if(H5G_unmount(child_group)<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to reset group mounted flag")
+ if(H5G_close(child_group)<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group")
+
+ /* Detach child file from parent & see if it should close */
+ child_file->mtab.parent = NULL;
+ if(H5F_try_close(child_file)<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted file")
+
done:
if (mounted)
if(H5G_close(mounted)<0 && ret_value>=0)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 596103e..8e68d0b 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -178,5 +178,10 @@ H5_DLL hsize_t H5F_init_superblock(const H5F_t *f, hid_t dxpl_id);
H5_DLL herr_t H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf);
H5_DLL herr_t H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr, uint8_t *buf, size_t buf_size);
+/* Shared file list related routines */
+H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared);
+H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf);
+H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared);
+
#endif
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 52b92dc..697a260 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -481,6 +481,9 @@ H5_DLL herr_t H5F_acs_close(hid_t fapl_id, void *close_data);
H5_DLL herr_t H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id,
void *close_data);
+/* Shared file list related routines */
+H5_DLL herr_t H5F_sfile_assert_num(unsigned n);
+
/* Debugging functions */
H5_DLL herr_t H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth);
diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c
new file mode 100644
index 0000000..70eb420
--- /dev/null
+++ b/src/H5Fsfile.c
@@ -0,0 +1,226 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+
+/* Packages needed by this file... */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free lists */
+
+/* PRIVATE TYPEDEFS */
+
+/* Struct for tracking "shared" file structs */
+typedef struct H5F_sfile_node_t {
+ H5F_file_t *shared; /* Pointer to "shared" file struct */
+ struct H5F_sfile_node_t *next; /* Pointer to next node */
+} H5F_sfile_node_t;
+
+/* PRIVATE PROTOTYPES */
+
+/* PRIVATE VARIABLES */
+
+/* Declare a free list to manage the H5F_sfile_node_t struct */
+H5FL_DEFINE_STATIC(H5F_sfile_node_t);
+
+/* Declare a local variable to track the shared file information */
+H5F_sfile_node_t *H5F_sfile_head_g = NULL;
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_sfile_assert_empty
+ *
+ * Purpose: Sanity checking that shared file list is empty
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, July 25, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_sfile_assert_num(unsigned n)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_sfile_assert_num)
+
+ if(n == 0) {
+ /* Sanity checking */
+ HDassert(H5F_sfile_head_g == NULL);
+ } /* end if */
+ else {
+ unsigned count; /* Number of open shared files */
+ H5F_sfile_node_t *curr; /* Current shared file node */
+
+ /* Iterate through low-level files for matching low-level file info */
+ curr = H5F_sfile_head_g;
+ count = 0;
+ while(curr) {
+ /* Increment # of open shared file structs */
+ count++;
+
+ /* Advance to next shared file node */
+ curr = curr->next;
+ } /* end while */
+
+ /* Sanity checking */
+ HDassert(count == n);
+ } /* end else */
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5F_sfile_assert_num() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_sfile_add
+ *
+ * Purpose: Add a "shared" file struct to the list of open files
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, July 18, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_sfile_add(H5F_file_t *shared)
+{
+ H5F_sfile_node_t *new_shared; /* New shared file node */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5F_sfile_add)
+
+ /* Sanity check */
+ HDassert(shared);
+
+ /* Allocate new shared file node */
+ if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Set shared file value */
+ new_shared->shared = shared;
+
+ /* Prepend to list of shared files open */
+ new_shared->next = H5F_sfile_head_g;
+ H5F_sfile_head_g = new_shared;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_sfile_add() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_sfile_search
+ *
+ * Purpose: Search for a "shared" file with low-level file info that
+ * matches
+ *
+ * Return: Non-NULL on success / NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, July 18, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_file_t *
+H5F_sfile_search(H5FD_t *lf)
+{
+ H5F_sfile_node_t *curr; /* Current shared file node */
+ H5F_file_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_sfile_search)
+
+ /* Sanity check */
+ HDassert(lf);
+
+ /* Iterate through low-level files for matching low-level file info */
+ curr = H5F_sfile_head_g;
+ while(curr) {
+ /* Check for match */
+ if(0==H5FD_cmp(curr->shared->lf, lf))
+ HGOTO_DONE(curr->shared)
+
+ /* Advance to next shared file node */
+ curr = curr->next;
+ } /* end while */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_sfile_search() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_sfile_remove
+ *
+ * Purpose: Remove a "shared" file struct from the list of open files
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, July 18, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_sfile_remove(H5F_file_t *shared)
+{
+ H5F_sfile_node_t *curr; /* Current shared file node */
+ H5F_sfile_node_t *last; /* Last shared file node */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5F_sfile_remove)
+
+ /* Sanity check */
+ HDassert(shared);
+
+ /* Locate shared file node with correct shared file */
+ last = NULL;
+ curr = H5F_sfile_head_g;
+ while(curr && curr->shared != shared) {
+ /* Advance to next node */
+ last = curr;
+ curr = curr->next;
+ } /* end while */
+
+ /* Indicate error if the node wasn't found */
+ if(curr == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info")
+
+ /* Remove node found from list */
+ if(last != NULL)
+ /* Removing middle or tail node in list */
+ last->next = curr->next;
+ else
+ /* Removing head node in list */
+ H5F_sfile_head_g = curr->next;
+
+ /* Release the shared file node struct */
+ /* (the shared file info itself is freed elsewhere) */
+ H5FL_FREE(H5F_sfile_node_t, curr);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_sfile_remove() */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 0644418..7091120 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,7 +48,7 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
H5Dcontig.c \
H5Dcompact.c \
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \
- H5Fdbg.c H5Fmount.c H5Fsuper.c H5FD.c H5FDcore.c \
+ H5Fdbg.c H5Fmount.c H5Fsfile.c H5Fsuper.c H5FD.c H5FDcore.c \
H5FDfamily.c H5FDfphdf5.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index c92dabe..109c53f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -88,25 +88,26 @@ am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo \
H5BTdbg.lo H5BTtest.lo H5C.lo H5D.lo H5Dcontig.lo \
H5Dcompact.lo H5Defl.lo H5Dio.lo H5Distore.lo H5Dmpio.lo \
H5Dselect.lo H5Dtest.lo H5E.lo H5F.lo H5Fdbg.lo H5Fmount.lo \
- H5Fsuper.lo H5FD.lo H5FDcore.lo H5FDfamily.lo H5FDfphdf5.lo \
- H5FDlog.lo H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \
- H5FDsec2.lo H5FDstdio.lo H5FDstream.lo H5FL.lo H5FO.lo H5FP.lo \
- H5FPclient.lo H5FPserver.lo H5FS.lo H5G.lo H5Gent.lo \
- H5Gnode.lo H5Gstab.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo \
- H5HP.lo H5I.lo H5MF.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \
- H5Oattr.lo H5Obogus.lo H5Ocont.lo H5Odtype.lo H5Oefl.lo \
- H5Ofill.lo H5Olayout.lo H5Omtime.lo H5Oname.lo H5Onull.lo \
- H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo H5P.lo \
- H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pocpl.lo \
- H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo \
- H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \
- H5SH.lo H5SHcache.lo H5SHdbg.lo H5SL.lo H5ST.lo H5T.lo \
- H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo \
- H5Tcset.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo \
- H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Topaque.lo H5Torder.lo \
- H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo \
- H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \
- H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo
+ H5Fsfile.lo H5Fsuper.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
+ H5FDfphdf5.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \
+ H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDstdio.lo \
+ H5FDstream.lo H5FL.lo H5FO.lo H5FP.lo H5FPclient.lo \
+ H5FPserver.lo H5FS.lo H5G.lo H5Gent.lo H5Gnode.lo H5Gstab.lo \
+ H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5MF.lo \
+ H5MM.lo H5MP.lo H5MPtest.lo H5O.lo H5Oattr.lo H5Obogus.lo \
+ H5Ocont.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Olayout.lo \
+ H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Osdspace.lo \
+ H5Oshared.lo H5Ostab.lo H5P.lo H5Pdcpl.lo H5Pdxpl.lo \
+ H5Pfapl.lo H5Pfcpl.lo H5Pocpl.lo H5Ptest.lo H5R.lo H5RC.lo \
+ H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \
+ H5Spoint.lo H5Sselect.lo H5Stest.lo H5SH.lo H5SHcache.lo \
+ H5SHdbg.lo H5SL.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo \
+ H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tenum.lo \
+ H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo \
+ H5Toffset.lo H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo \
+ H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo \
+ H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo H5Zszip.lo \
+ H5Zscaleoffset.lo H5Ztrans.lo
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
H5detect_SOURCES = H5detect.c
@@ -380,7 +381,7 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
H5Dcontig.c \
H5Dcompact.c \
H5Defl.c H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \
- H5Fdbg.c H5Fmount.c H5Fsuper.c H5FD.c H5FDcore.c \
+ H5Fdbg.c H5Fmount.c H5Fsfile.c H5Fsuper.c H5FD.c H5FDcore.c \
H5FDfamily.c H5FDfphdf5.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDstdio.c \
H5FDstream.c H5FL.c H5FO.c H5FP.c H5FPclient.c H5FPserver.c H5FS.c \
@@ -583,6 +584,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FS.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fdbg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fmount.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsfile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsuper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5G.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gent.Plo@am__quote@