summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-10-24 21:03:10 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-10-24 21:03:10 (GMT)
commit833e82fec5f654c1ed93a6e4e4266f280e20311c (patch)
tree4c1f5d776652cfef707455fbee246af0a5780a80 /src/H5F.c
parente1e488bd4758a0e5b85a8e04052146a93c3e5751 (diff)
downloadhdf5-833e82fec5f654c1ed93a6e4e4266f280e20311c.zip
hdf5-833e82fec5f654c1ed93a6e4e4266f280e20311c.tar.gz
hdf5-833e82fec5f654c1ed93a6e4e4266f280e20311c.tar.bz2
[svn-r134] Changes since 19971023
---------------------- ./config/conclude.in Test work when `.' isn't in $PATH. ./src/H5F.c ./src/H5Fcore.c NEW ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fstdio.c ./src/Makefile.in ./MANIFEST Added the in-core temporary file driver as an exercise to clean up some of the H5F package. It speeds up `testhdf5 -o stab' by 25 percent! If you want to try it you'll need to recompile everything with `-DH5F_LOW_DFLT=H5F_LOW_CORE'. Don't expect testhdf5 to ever work since creating a file, closing it, and then opening it for read-only will fail.
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/H5F.c b/src/H5F.c
index e0b0744..754be9c 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -339,7 +339,7 @@ hbool_t H5Fis_hdf5(const char *filename)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, BFAIL); /*no filename specified*/
/* Open the file */
- if (NULL==(f_handle=H5F_low_open (H5F_LOW_DFLT, filename, 0))) {
+ if (NULL==(f_handle=H5F_low_open (H5F_LOW_DFLT, filename, 0, NULL))) {
/* Low-level file open failure */
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, BFAIL);
}
@@ -557,7 +557,6 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
H5F_t *f = NULL; /*return value */
H5F_t *ret_value = NULL; /*a copy of `f' */
H5F_t *old = NULL; /*a file already opened */
- struct stat sb; /*file stat info */
H5F_search_t search; /*file search key */
H5F_low_t *fd = NULL; /*low level file desc */
hbool_t empty_file = FALSE; /*is file empty? */
@@ -593,7 +592,7 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
* with hard or soft links) it doesn't work to compare files based only on
* their full path name.
*/
- file_exists = (stat (name, &sb)>=0);
+ file_exists = H5F_low_access (type, name, F_OK, &search);
/*
* Open the low-level file (if necessary) and create an H5F_t struct that
@@ -604,17 +603,16 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
/* File already exists - CREAT EXCL failed */
HRETURN_ERROR (H5E_FILE, H5E_FILEEXISTS, NULL);
}
- if (access (name, R_OK)<0) {
+ if (!H5F_low_access (type, name, R_OK, NULL)) {
/* File is not readable */
HRETURN_ERROR (H5E_FILE, H5E_READERROR, NULL);
}
- if ((flags & H5F_ACC_WRITE) && access (name, W_OK)<0) {
+ if ((flags & H5F_ACC_WRITE) &&
+ !H5F_low_access (type, name, W_OK, NULL)) {
/* File is not writable */
HRETURN_ERROR (H5E_FILE, H5E_WRITEERROR, NULL);
}
- search.dev = sb.st_dev;
- search.ino = sb.st_ino;
if ((old=H5Asearch_atom (H5_FILE, H5F_compare_files, &search))) {
if (flags & H5F_ACC_TRUNC) {
/* File already open - TRUNC failed */
@@ -622,7 +620,7 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
}
if ((flags & H5F_ACC_WRITE) &&
0==(old->shared->flags & H5F_ACC_WRITE)) {
- if (NULL==(fd=H5F_low_open (type, name, H5F_ACC_WRITE))) {
+ if (NULL==(fd=H5F_low_open (type, name, H5F_ACC_WRITE, NULL))) {
/* File cannot be reopened with write access */
HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL);
}
@@ -639,20 +637,19 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
/* Can't truncate without write intent */
HRETURN_ERROR (H5E_FILE, H5E_BADVALUE, NULL);
}
- fd = H5F_low_open (type, name, H5F_ACC_WRITE|H5F_ACC_TRUNC);
+ fd = H5F_low_open (type, name, H5F_ACC_WRITE|H5F_ACC_TRUNC, NULL);
if (!fd) {
/* Can't truncate file */
HRETURN_ERROR (H5E_FILE, H5E_CANTCREATE, NULL);
}
f = H5F_new (NULL);
- f->shared->key.dev = sb.st_dev;
- f->shared->key.ino = sb.st_ino;
+ f->shared->key = search;
f->shared->flags = flags;
f->shared->file_handle = fd;
empty_file = TRUE;
} else {
- fd = H5F_low_open (type, name, (flags & H5F_ACC_WRITE));
+ fd = H5F_low_open (type, name, (flags & H5F_ACC_WRITE), NULL);
if (!fd) {
/* Cannot open existing file */
HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL);
@@ -668,18 +665,15 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
/* Can't create file without write intent */
HRETURN_ERROR (H5E_FILE, H5E_BADVALUE, NULL);
}
- fd = H5F_low_open (type, name, H5F_ACC_WRITE|H5F_ACC_CREAT|H5F_ACC_EXCL);
+ fd = H5F_low_open (type, name,
+ H5F_ACC_WRITE|H5F_ACC_CREAT|H5F_ACC_EXCL,
+ &search);
if (!fd) {
/* Can't create file */
HRETURN_ERROR (H5E_FILE, H5E_CANTCREATE, NULL);
}
- if (stat (name, &sb)<0) {
- /* Can't stat file - can't get dev or inode */
- HRETURN_ERROR (H5E_FILE, H5E_CANTCREATE, NULL);
- }
f = H5F_new (NULL);
- f->shared->key.dev = sb.st_dev;
- f->shared->key.ino = sb.st_ino;
+ f->shared->key = search;
f->shared->flags = flags;
f->shared->file_handle = fd;
empty_file = TRUE;