diff options
Diffstat (limited to 'src/H5Fprivate.h')
-rw-r--r-- | src/H5Fprivate.h | 301 |
1 files changed, 40 insertions, 261 deletions
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 85aa03b..efe8bd9 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -22,8 +22,8 @@ /* This is a near top-level header! Try not to include much! */ #include <H5private.h> -#include <H5Dpublic.h> /*for the H5D_transfer_t type */ -#include <H5MMpublic.h> /*for the H5MM_allocate_t and H5MM_free_t types */ +#include <H5FDpublic.h> /*file drivers */ +#include <H5MMpublic.h> /*for H5MM_allocate_t and H5MM_free_t types */ /* * Feature: Define this constant to be non-zero if you want to enable code @@ -51,16 +51,14 @@ #define H5F_SIGNATURE_LEN 8 /* size of size_t and off_t as they exist on disk */ -#define H5F_SIZEOF_ADDR(F) ((F)->shared->create_parms->sizeof_addr) -#define H5F_SIZEOF_SIZE(F) ((F)->shared->create_parms->sizeof_size) +#define H5F_SIZEOF_ADDR(F) ((F)->shared->fcpl->sizeof_addr) +#define H5F_SIZEOF_SIZE(F) ((F)->shared->fcpl->sizeof_size) /* * Private file open flags. */ #define H5F_ACC_PUBLIC_FLAGS 0x00ffu -#define H5F_ACC_CREAT 0x0100u /* Create non-existing files */ - /* * Encode and decode macros for file meta-data. * Currently, all file meta-data is little-endian. @@ -256,84 +254,12 @@ typedef struct H5F_access_t { double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ - uintn gc_ref; /* Garbage-collect references? */ - H5F_driver_t driver; /* Low level file driver */ - union { - - /* Properties for in-core files */ - struct { - size_t increment; /*amount by which to increment size*/ - } core; - - /* Properties for file families */ - struct { - struct H5F_access_t *memb_access; /*plist for the members */ - haddr_t memb_size; /*number of bits in offset */ - } fam; - - /* Properties for the split driver */ - struct { - char *meta_ext; /*name extension for meta file */ - char *raw_ext; /*name extension for raw file */ - struct H5F_access_t *meta_access; /*plist for meta file */ - struct H5F_access_t *raw_access; /*plist for raw data file */ - } split; - -#ifdef HAVE_PARALLEL - /* Properties for parallel I/O */ - struct { - MPI_Comm comm; /* communicator for file access */ - MPI_Info info; /* optional info for MPI-IO */ - MPI_Datatype btype; /* buffer type for xfers */ - MPI_Datatype ftype; /* file type for xfers */ - haddr_t disp; /* displacement for set_view in xfers */ - int use_types; /* if !0, use btype, ftype, disp. */ - /* otherwise do simple byteblk xfer */ - int old_use_types; /* remember value of use_types */ - /* from last xfer */ - } mpio; -#endif - - } u; + uintn gc_ref; /* Garbage-collect references? */ + hid_t driver_id; /* File driver ID */ + void *driver_info; /* File driver specific information */ } H5F_access_t; -/* - * These things make a file unique. - */ -typedef struct H5F_search_t { - dev_t dev; /* Device number containing file */ - ino_t ino; /* Unique file number on device */ -#if WIN32 - /* - * Specifies the low-order word of a unique identifier associated with the - * file. This identifier and the volume serial number uniquely identify a - * file. This number may change when the system is restarted or when the - * file is opened. After a process opens a file, the identifier is - * constant until the file is closed. An application can use this - * identifier and the volume serial number to determine whether two - * handles refer to the same file. - */ - int fileindexlo; - int fileindexhi; -#endif -} H5F_search_t; - -/* For determining what the last file operation was */ -typedef enum { - H5F_OP_UNKNOWN, /* Don't know what the last operation was*/ - H5F_OP_SEEK, /* Last operation was a seek */ - H5F_OP_WRITE, /* Last operation was a write */ - H5F_OP_READ /* Last operation was a read */ -} H5F_fileop_t; - -/* A free-list entry */ -#define H5MF_NFREE 32 /*size of free block array */ -typedef struct H5MF_free_t { - haddr_t addr; /*file address */ - hsize_t size; /*size of free area */ -} H5MF_free_t; - -/* Dataset transfer property list */ +/* Data transfer property list */ typedef struct H5F_xfer_t { size_t buf_size; /*max temp buffer size */ void *tconv_buf; /*type conversion buffer or null */ @@ -342,125 +268,14 @@ typedef struct H5F_xfer_t { double split_ratios[3];/*B-tree node splitting ratios */ uintn cache_hyper; /*cache hyperslab blocks during I/O? */ uintn block_limit; /*largest hyperslab block to cache */ - H5D_transfer_t xfer_mode; /*independent or collective transfer */ - H5MM_allocate_t vlen_alloc; /* VL datatype allocation function */ - void * alloc_info; /* VL datatype allocation information */ - H5MM_free_t vlen_free; /* VL datatype free function */ - void * free_info; /* VL datatype free information */ + H5MM_allocate_t vlen_alloc; /*VL datatype allocation function */ + void *alloc_info; /*VL datatype allocation information */ + H5MM_free_t vlen_free; /*VL datatype free function */ + void *free_info; /*VL datatype free information */ + hid_t driver_id; /*File driver ID */ + void *driver_info; /*File driver specific information */ } H5F_xfer_t; -/* - * Define the low-level file interface. - */ -typedef struct H5F_low_class_t { - htri_t (*access)(const char *name, const H5F_access_t *access_parms, - int mode, H5F_search_t *key/*out*/); - struct H5F_low_t *(*open)(const char *name, - const H5F_access_t *access_parms, uintn flags, - H5F_search_t *key/*out*/); - herr_t (*close)(struct H5F_low_t *lf, - const H5F_access_t *access_parms); - herr_t (*read)(struct H5F_low_t *lf, const H5F_access_t *access_parms, - const H5F_xfer_t *xfer_parms, haddr_t addr, - size_t size, uint8_t *buf); - herr_t (*write)(struct H5F_low_t *lf, - const H5F_access_t *access_parms, - const H5F_xfer_t *xfer_parms, haddr_t addr, - size_t size, const uint8_t *buf); - herr_t (*flush)(struct H5F_low_t *lf, - const H5F_access_t *access_parms); - herr_t (*extend)(struct H5F_low_t *lf, - const H5F_access_t *access_parms, - intn op, hsize_t size, haddr_t *addr/*out*/); - intn (*alloc)(struct H5F_low_t *lf, intn op, hsize_t alignment, - hsize_t threshold, hsize_t size, H5MF_free_t *blk, - haddr_t *addr/*out*/); -} H5F_low_class_t; - -/* - * One of these H5F_low_t structs is allocated for each H5F_file_t struct. - * This struct describes how to access the storage for the hdf5 address space, - * whether that storage is file, local memory, shared memory, network - * distributed global memory, etc. - */ -typedef struct H5F_low_t { - const H5F_low_class_t *type;/* What type of file is this? */ - haddr_t eof; /* Address of logical end-of-file */ - uintn eof_written; /* whether the last byte is written */ - union { - - /* File families */ - struct { - char *name; /* Family name */ - uintn flags; /* Flags for opening member files */ - intn nmemb; /* Number of family members */ - intn nalloc; /* Size of member table in elements */ - struct H5F_low_t **memb; /* An array of family members */ - haddr_t memb_size; /*Size of each family member */ - } fam; - - /* Split meta/raw data */ - struct { - char *name; /* Base name w/o extension */ - uint64_t mask; /* Bit that determines which file to use*/ - struct H5F_low_t *meta; /* Meta data file */ - struct H5F_low_t *raw; /* Raw data file */ - } split; - - /* Posix section 2 I/O */ - struct { - int fd; /* The unix file descriptor */ - H5F_fileop_t op; /* Previous file operation */ -#ifdef HAVE_LSEEK64 - off64_t cur; /* Current file position */ -#else - off_t cur; /* Current file position */ -#endif - } sec2; - - /* Posix stdio */ - struct { - FILE *f; /* Posix stdio file */ - H5F_fileop_t op; /* Previous file operation */ -#ifdef HAVE_FSEEK64 - int64_t cur; /* Current file position */ -#else - long cur; /* Current file position */ -#endif - } stdio; - - /* In-core temp file */ - struct { - uint8_t *mem; /* Mem image of the file */ - size_t size; /* Current file size */ - size_t alloc; /* Current size of MEM buffer */ - } core; - -#ifdef HAVE_PARALLEL - /* MPI-IO */ - struct { - MPI_File f; /* MPI-IO file handle */ - hbool_t allsame;/* all procs should write same data, * - * so only p0 will do the actual write */ - } mpio; -#endif - - } u; -} H5F_low_t; - -/* What types of low-level files are there? */ -#ifndef H5F_LOW_DFLT -# define H5F_LOW_DFLT H5F_LOW_SEC2 /* The default type */ -#endif -__DLLVAR__ const H5F_low_class_t H5F_LOW_SEC2_g[]; /*Posix section 2 */ -__DLLVAR__ const H5F_low_class_t H5F_LOW_STDIO_g[]; /*Posix stdio */ -__DLLVAR__ const H5F_low_class_t H5F_LOW_CORE_g[]; /*In-core temp file */ -__DLLVAR__ const H5F_low_class_t H5F_LOW_FAMILY_g[];/*File family */ -__DLLVAR__ const H5F_low_class_t H5F_LOW_SPLIT_g[]; /*Split meta/raw data*/ -#ifdef HAVE_PARALLEL -__DLLVAR__ const H5F_low_class_t H5F_LOW_MPIO_g[]; /*MPI-IO */ -#endif - /* The raw data chunk cache */ typedef struct H5F_rdcc_t { uintn ninits; /* Number of chunk creations */ @@ -483,24 +298,20 @@ typedef struct H5F_rdcc_t { * pointing to this struct. */ typedef struct H5F_file_t { - H5F_search_t key; /* The key for looking up files */ uintn flags; /* Access Permissions for file */ - H5F_low_t *lf; /* Lower level file handle for I/O */ + H5FD_t *lf; /* Lower level file handle for I/O */ uintn nrefs; /* Ref count for times file is opened */ uint32_t consist_flags; /* File Consistency Flags */ haddr_t boot_addr; /* Absolute address of boot block */ haddr_t base_addr; /* Absolute base address for rel.addrs. */ haddr_t freespace_addr; /* Relative address of free-space info */ - haddr_t hdf5_eof; /* Relative addr of end of all hdf5 data*/ struct H5AC_t *cache; /* The object cache */ - H5F_create_t *create_parms; /* File-creation property list */ - H5F_access_t *access_parms; /* File-access property list */ + H5F_create_t *fcpl; /* File-creation property list */ + H5F_access_t *fapl; /* File-access property list */ struct H5G_t *root_grp; /* Open root group */ intn ncwfs; /* Num entries on cwfs list */ struct H5HG_heap_t **cwfs; /* Global heap cache */ H5F_rdcc_t rdcc; /* Raw data chunk cache */ - intn fl_nfree; /*number of free blocks in array */ - H5MF_free_t fl_free[H5MF_NFREE]; /*free block array */ } H5F_file_t; /* Mount property list */ @@ -605,9 +416,8 @@ __DLLVAR__ hbool_t H5_mpi_1_metawrite_g; __DLL__ herr_t H5F_init(void); __DLL__ void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l); -__DLL__ H5F_t *H5F_open(const char *name, uintn flags, - const H5F_create_t *create_parms, - const H5F_access_t *access_parms); +__DLL__ H5F_t *H5F_open(const char *name, uintn flags, hid_t fcpl_id, + hid_t fapl_id); __DLL__ herr_t H5F_close(H5F_t *f); __DLL__ herr_t H5F_close_all(void); __DLL__ herr_t H5F_flush_all(hbool_t invalidate); @@ -620,7 +430,7 @@ __DLL__ herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/); /* Functions that operate on array storage */ __DLL__ herr_t H5F_arr_create(H5F_t *f, struct H5O_layout_t *layout /*in,out*/); -__DLL__ herr_t H5F_arr_read (H5F_t *f, const struct H5F_xfer_t *xfer, +__DLL__ herr_t H5F_arr_read (H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_fill_t *fill, @@ -629,7 +439,7 @@ __DLL__ herr_t H5F_arr_read (H5F_t *f, const struct H5F_xfer_t *xfer, const hsize_t mem_size[], const hssize_t mem_offset[], const hssize_t file_offset[], void *_buf/*out*/); -__DLL__ herr_t H5F_arr_write (H5F_t *f, const struct H5F_xfer_t *xfer, +__DLL__ herr_t H5F_arr_write (H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_fill_t *fill, @@ -647,22 +457,21 @@ __DLL__ hsize_t H5F_istore_allocated(H5F_t *f, int ndims, haddr_t addr); __DLL__ herr_t H5F_istore_stats (H5F_t *f, hbool_t headers); __DLL__ herr_t H5F_istore_create(H5F_t *f, struct H5O_layout_t *layout/*in,out*/); -__DLL__ herr_t H5F_istore_read(H5F_t *f, const struct H5F_xfer_t *xfer, +__DLL__ herr_t H5F_istore_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_fill_t *fill, const hssize_t offset[], const hsize_t size[], void *buf/*out*/); -__DLL__ herr_t H5F_istore_write(H5F_t *f, const struct H5F_xfer_t *xfer, +__DLL__ herr_t H5F_istore_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, const struct H5O_pline_t *pline, const struct H5O_fill_t *fill, const hssize_t offset[], const hsize_t size[], const void *buf); -__DLL__ herr_t H5F_istore_allocate (H5F_t *f, +__DLL__ herr_t H5F_istore_allocate (H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, const hsize_t *space_dim, - const double split_ratios[], const struct H5O_pline_t *pline, const struct H5O_fill_t *fill); __DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, @@ -670,54 +479,31 @@ __DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, /* Functions that operate on contiguous storage wrt boot block */ __DLL__ herr_t H5F_block_read(H5F_t *f, haddr_t addr, hsize_t size, - const H5F_xfer_t *xfer_parms, void *buf); + hid_t dxpl_id, void *buf/*out*/); __DLL__ herr_t H5F_block_write(H5F_t *f, haddr_t addr, hsize_t size, - const H5F_xfer_t *xfer_parms, const void *buf); - -/* Functions that operate directly on low-level files */ -__DLL__ const H5F_low_class_t *H5F_low_class (H5F_driver_t driver); -__DLL__ herr_t H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, - intn op, hsize_t size, haddr_t *addr/*out*/); -__DLL__ herr_t H5F_low_seteof(H5F_low_t *lf, haddr_t addr); -__DLL__ intn H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, - hsize_t threshold, hsize_t size, H5MF_free_t *blk, - haddr_t *addr/*out*/); -__DLL__ htri_t H5F_low_access(const H5F_low_class_t *type, const char *name, - const H5F_access_t *access_parms, int mode, - H5F_search_t *key); -__DLL__ H5F_low_t *H5F_low_open(const H5F_low_class_t *type, const char *name, - const H5F_access_t *access_parms, uintn flags, - H5F_search_t *key); -__DLL__ H5F_low_t *H5F_low_close(H5F_low_t *lf, - const H5F_access_t *access_parms); -__DLL__ hsize_t H5F_low_size(H5F_low_t *lf, haddr_t *addr); -__DLL__ herr_t H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms, - const H5F_xfer_t *xfer_parms, haddr_t addr, - size_t size, uint8_t *buf); -__DLL__ herr_t H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, - const H5F_xfer_t *xfer_parms, haddr_t addr, - size_t size, const uint8_t *buf); -__DLL__ herr_t H5F_low_flush(H5F_low_t *lf, const H5F_access_t *access_parms); + hid_t dxpl_id, const void *buf); /* Address-related macros and functions */ -#define H5F_ADDR_UNDEF ((uint64_t)(-1L)) +#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ + HADDR_UNDEF==(X)+(haddr_t)(Z) || \ + (X)+(haddr_t)(Z)<(X)) #define H5F_addr_hash(X,M) ((unsigned)((X)%(M))) -#define H5F_addr_defined(X) (X!=H5F_ADDR_UNDEF) -#define H5F_addr_eq(X,Y) ((X)!=H5F_ADDR_UNDEF && \ - (Y)!=H5F_ADDR_UNDEF && \ +#define H5F_addr_defined(X) (X!=HADDR_UNDEF) +#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)==(Y)) #define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=H5F_ADDR_UNDEF && \ - (Y)!=H5F_ADDR_UNDEF && \ +#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=H5F_ADDR_UNDEF && \ - (Y)!=H5F_ADDR_UNDEF && \ +#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=H5F_ADDR_UNDEF && \ - (Y)!=H5F_ADDR_UNDEF && \ +#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=H5F_ADDR_UNDEF && \ - (Y)!=H5F_ADDR_UNDEF && \ +#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)>=(Y)) #define H5F_addr_cmp(X,Y) (H5F_addr_eq(X,Y)?0: \ (H5F_addr_lt(X, Y)?-1:1)) @@ -729,11 +515,4 @@ __DLL__ void H5F_addr_decode(H5F_t *, const uint8_t**/*in,out*/, __DLL__ herr_t H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/, const unsigned long objno[2]); -/* Functions for MPI-IO */ -#ifdef HAVE_PARALLEL -__DLL__ htri_t H5F_mpio_tas_allsame(H5F_low_t *lf, hbool_t newval); -__DLL__ herr_t H5PC_Wait_for_left_neighbor(MPI_Comm comm); -__DLL__ herr_t H5PC_Signal_right_neighbor(MPI_Comm comm); -#endif /* HAVE_PARALLEL */ - #endif |