HDF5  1.12.0
H5FDprivate.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF5. The full HDF5 copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15  * Programmer: Robb Matzke <matzke@llnl.gov>
16  * Monday, July 26, 1999
17  */
18 #ifndef _H5FDprivate_H
19 #define _H5FDprivate_H
20 
21 /* Include package's public header */
22 #include "H5FDpublic.h"
23 
24 /* Private headers needed by this file */
25 #include "H5Pprivate.h" /* Property lists */
26 
27 /*
28  * The MPI drivers are needed because there are
29  * places where we check for things that aren't handled by these drivers.
30  */
31 #include "H5FDmpi.h" /* MPI-based file drivers */
32 
33 
34 /**************************/
35 /* Library Private Macros */
36 /**************************/
37 
38 /* Length of filename buffer */
39 #define H5FD_MAX_FILENAME_LEN 1024
40 
41 #ifdef H5_HAVE_PARALLEL
42 /* ======== Temporary data transfer properties ======== */
43 /* Definitions for memory MPI type property */
44 #define H5FD_MPI_XFER_MEM_MPI_TYPE_NAME "H5FD_mpi_mem_mpi_type"
45 /* Definitions for file MPI type property */
46 #define H5FD_MPI_XFER_FILE_MPI_TYPE_NAME "H5FD_mpi_file_mpi_type"
47 
48 /* Sub-class the H5FD_class_t to add more specific functions for MPI-based VFDs */
49 typedef struct H5FD_class_mpi_t {
50  H5FD_class_t super; /* Superclass information & methods */
51  int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */
52  int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */
53  MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */
54  herr_t (*get_mpi_info)(H5FD_t *file, void** mpi_info); /* get MPI_Info for a file */
55 } H5FD_class_mpi_t;
56 #endif
57 
58 /****************************/
59 /* Library Private Typedefs */
60 /****************************/
61 
62 /* File operations */
63 typedef enum {
64  OP_UNKNOWN = 0, /* Unknown last file operation */
65  OP_READ = 1, /* Last file I/O operation was a read */
66  OP_WRITE = 2 /* Last file I/O operation was a write */
68 
69 
70 /* Define structure to hold initial file image and other relevant information */
71 typedef struct {
72  void *buffer;
73  size_t size;
76 
77 /* Define default file image info */
78 #define H5FD_DEFAULT_FILE_IMAGE_INFO { \
79  /* file image buffer */ NULL, \
80  /* buffer size */ 0, \
81  { /* Callbacks */ \
82  /* image_malloc */ NULL, \
83  /* image_memcpy */ NULL, \
84  /* image_realloc */ NULL, \
85  /* image_free */ NULL, \
86  /* udata_copy */ NULL, \
87  /* udata_free */ NULL, \
88  /* udata */ NULL, \
89  } \
90 }
91 
92 /* Define structure to hold driver ID & info for FAPLs */
93 typedef struct {
94  hid_t driver_id; /* Driver's ID */
95  const void *driver_info; /* Driver info, for open callbacks */
97 
98 
99 /*****************************/
100 /* Library Private Variables */
101 /*****************************/
102 
103 
104 /******************************/
105 /* Library Private Prototypes */
106 /******************************/
107 
108 /* Forward declarations for prototype arguments */
109 struct H5F_t;
110 
115 H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf);
116 H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf);
117 H5_DLL void *H5FD_fapl_get(H5FD_t *file);
118 H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl);
119 H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref);
120 H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
121  haddr_t maxaddr);
123 H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2);
124 H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/);
126  struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size);
127 H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f,
128  haddr_t addr, hsize_t size);
129 H5_DLL htri_t H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f,
130  haddr_t blk_end, hsize_t extra_requested);
131 H5_DLL haddr_t H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type);
133 H5_DLL haddr_t H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type);
135 H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags);
136 H5_DLL herr_t H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags);
137 H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map);
138 H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/);
139 H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf);
144 H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum);
145 H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle);
146 H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr);
149 
150 /* Function prototypes for MPI based VFDs*/
151 #ifdef H5_HAVE_PARALLEL
152 /* General routines */
153 H5_DLL haddr_t H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off);
154 H5_DLL herr_t H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/);
155 #ifdef NOT_YET
156 H5_DLL herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file);
157 H5_DLL herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file);
158 #endif /* NOT_YET */
159 H5_DLL herr_t H5FD_set_mpio_atomicity(H5FD_t *file, hbool_t flag);
160 H5_DLL herr_t H5FD_get_mpio_atomicity(H5FD_t *file, hbool_t *flag);
161 
162 /* Driver specific methods */
163 H5_DLL int H5FD_mpi_get_rank(const H5FD_t *file);
164 H5_DLL int H5FD_mpi_get_size(const H5FD_t *file);
165 H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file);
166 H5_DLL herr_t H5FD_get_mpi_info(H5FD_t *file, void** file_info);
167 #endif /* H5_HAVE_PARALLEL */
168 
169 #endif /* !_H5FDprivate_H */
170 
H5FD_write
H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf)
Definition: H5FDint.c:215
H5FD_get_maxaddr
H5_DLL haddr_t H5FD_get_maxaddr(const H5FD_t *file)
Definition: H5FD.c:1275
size
iblock size
Definition: H5EAcache.c:787
f
hdr f
Definition: H5EA.c:755
H5FD_file_image_info_t::size
size_t size
Definition: H5FDprivate.h:73
H5Pprivate.h
H5FD_get_base_addr
H5_DLL haddr_t H5FD_get_base_addr(const H5FD_t *file)
Definition: H5FD.c:1878
H5FD_t
Definition: H5FDpublic.h:317
H5FD_fapl_close
H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl)
Definition: H5FD.c:578
H5FD_get_eoa
H5_DLL haddr_t H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type)
Definition: H5FDint.c:306
H5FD_sb_encode
H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name, uint8_t *buf)
Definition: H5FD.c:441
haddr_t
CATCH haddr_t
Definition: H5EAdblock.c:162
H5FD_sb_size
H5_DLL hsize_t H5FD_sb_size(H5FD_t *file)
Definition: H5FD.c:407
H5FD_driver_prop_t
Definition: H5FDprivate.h:93
H5FD_cmp
H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2)
Definition: H5FD.c:904
H5FD_get_feature_flags
H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags)
Definition: H5FD.c:1302
H5FD_truncate
H5_DLL herr_t H5FD_truncate(H5FD_t *file, hbool_t closing)
Definition: H5FD.c:1601
H5FD_class_t
Definition: H5FDpublic.h:266
H5FD_get_class
H5_DLL H5FD_class_t * H5FD_get_class(hid_t id)
Definition: H5FD.c:362
uint8_t
unsigned char uint8_t
Definition: H5private.h:429
H5FD_close
H5_DLL herr_t H5FD_close(H5FD_t *file)
Definition: H5FD.c:829
H5FD_set_paged_aggr
H5_DLL herr_t H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged)
Definition: H5FD.c:1900
H5FD_unlock
H5_DLL herr_t H5FD_unlock(H5FD_t *file)
Definition: H5FD.c:1724
H5FD_set_eoa
H5_DLL herr_t H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr)
Definition: H5FDint.c:271
H5FD_get_vfd_handle
H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle)
Definition: H5FD.c:1820
htri_t
int htri_t
Definition: H5public.h:160
H5FD_file_image_info_t::buffer
void * buffer
Definition: H5FDprivate.h:72
H5FD_get_fs_type_map
H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map)
Definition: H5FD.c:1351
hid_t
int64_t hid_t
Definition: H5Ipublic.h:55
OP_WRITE
@ OP_WRITE
Definition: H5FDprivate.h:66
H5FD_file_op_t
H5FD_file_op_t
Definition: H5FDprivate.h:63
H5FD_file_image_callbacks_t
Definition: H5FDpublic.h:345
int
CATCH int
Definition: H5EA.c:1002
H5FDmpi.h
OP_READ
@ OP_READ
Definition: H5FDprivate.h:65
H5FD_mem_t
enum H5F_mem_t H5FD_mem_t
Definition: H5FDpublic.h:28
OP_UNKNOWN
@ OP_UNKNOWN
Definition: H5FDprivate.h:64
H5FD_get_fileno
H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum)
Definition: H5FD.c:1755
H5FD_free
H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, haddr_t addr, hsize_t size)
Definition: H5FDspace.c:374
H5FD_file_image_info_t
Definition: H5FDprivate.h:71
H5FD_driver_query
H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags)
Definition: H5FDint.c:380
H5FD_register
H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref)
Definition: H5FD.c:274
H5FD_driver_prop_t::driver_info
const void * driver_info
Definition: H5FDprivate.h:95
H5_DLL
#define H5_DLL
Definition: H5api_adpt.h:234
H5FD_file_image_info_t::callbacks
H5FD_file_image_callbacks_t callbacks
Definition: H5FDprivate.h:74
H5FD_locate_signature
H5_DLL herr_t H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr)
Definition: H5FDint.c:89
H5F_t
Definition: H5Fpkg.h:374
H5FD_flush
H5_DLL herr_t H5FD_flush(H5FD_t *file, hbool_t closing)
Definition: H5FD.c:1532
H5FD_set_base_addr
H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr)
Definition: H5FD.c:1852
H5F_t::closing
hbool_t closing
Definition: H5Fpkg.h:382
herr_t
int herr_t
Definition: H5public.h:128
H5FD_driver_prop_t::driver_id
hid_t driver_id
Definition: H5FDprivate.h:94
H5FD_set_feature_flags
H5_DLL herr_t H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags)
Definition: H5FD.c:1327
H5FD_read
H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf)
Definition: H5FDint.c:155
hbool_t
bool hbool_t
Definition: H5public.h:159
H5FD_lock
H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw)
Definition: H5FD.c:1663
H5FD_get_eof
H5_DLL haddr_t H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type)
Definition: H5FDint.c:343
H5FD_fapl_get
H5_DLL void * H5FD_fapl_get(H5FD_t *file)
Definition: H5FD.c:549
hsize_t
hsize_t
Definition: H5overflow.txt:44
H5FD_term_interface
H5_DLL int H5FD_term_interface(void)
H5FDpublic.h
H5FD_sb_load
H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf)
Definition: H5FD.c:499
H5FD_try_extend
H5_DLL htri_t H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, haddr_t blk_end, hsize_t extra_requested)
Definition: H5FDspace.c:418
H5FD_open
H5_DLL H5FD_t * H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
Definition: H5FD.c:693
H5FD_alloc
H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size)
Definition: H5FDspace.c:249