H5VLconnector.h 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * All rights reserved. *
  4. * *
  5. * This file is part of HDF5. The full HDF5 copyright notice, including *
  6. * terms governing use, modification, and redistribution, is contained in *
  7. * the COPYING file, which can be found at the root of the source code *
  8. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  9. * If you do not have access to either file, you may request a copy from *
  10. * help@hdfgroup.org. *
  11. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  12. /*
  13. * This file contains public declarations for authoring VOL connectors.
  14. */
  15. #ifndef H5VLconnector_H
  16. #define H5VLconnector_H
  17. /* Public headers needed by this file */
  18. #include "H5public.h" /* Generic Functions */
  19. #include "H5Apublic.h" /* Attributes */
  20. #include "H5Dpublic.h" /* Datasets */
  21. #include "H5ESpublic.h" /* Event Stack */
  22. #include "H5Fpublic.h" /* Files */
  23. #include "H5Ipublic.h" /* IDs */
  24. #include "H5Lpublic.h" /* Links */
  25. #include "H5Opublic.h" /* Objects */
  26. #include "H5Rpublic.h" /* References */
  27. #include "H5VLpublic.h" /* Virtual Object Layer */
  28. /*****************/
  29. /* Public Macros */
  30. /*****************/
  31. /* Capability flags for connector */
  32. #define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
  33. #define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
  34. #define H5VL_CAP_FLAG_ASYNC 0x02 /* Connector performs operations asynchronously*/
  35. #define H5VL_CAP_FLAG_NATIVE_FILES 0x04 /* Connector produces native file format */
  36. /* Container info version */
  37. #define H5VL_CONTAINER_INFO_VERSION 0x01 /* Container info struct version */
  38. /* The maximum size allowed for blobs */
  39. #define H5VL_MAX_BLOB_ID_SIZE (16) /* Allow for 128-bits blob IDs */
  40. /* # of optional operations reserved for the native VOL connector */
  41. #define H5VL_RESERVED_NATIVE_OPTIONAL 1024
  42. /*******************/
  43. /* Public Typedefs */
  44. /*******************/
  45. /* Types for different ways that objects are located in an HDF5 container */
  46. typedef enum H5VL_loc_type_t {
  47. H5VL_OBJECT_BY_SELF,
  48. H5VL_OBJECT_BY_NAME,
  49. H5VL_OBJECT_BY_IDX,
  50. H5VL_OBJECT_BY_TOKEN
  51. } H5VL_loc_type_t;
  52. typedef struct H5VL_loc_by_name {
  53. const char *name;
  54. hid_t lapl_id;
  55. } H5VL_loc_by_name_t;
  56. typedef struct H5VL_loc_by_idx {
  57. const char * name;
  58. H5_index_t idx_type;
  59. H5_iter_order_t order;
  60. hsize_t n;
  61. hid_t lapl_id;
  62. } H5VL_loc_by_idx_t;
  63. typedef struct H5VL_loc_by_token {
  64. H5O_token_t *token;
  65. } H5VL_loc_by_token_t;
  66. /* Structure to hold parameters for object locations.
  67. * Either: BY_SELF, BY_NAME, BY_IDX, BY_TOKEN
  68. *
  69. * Note: Leave loc_by_token as the first union member so we
  70. * can perform the simplest initialization of the struct
  71. * without raising warnings.
  72. *
  73. * Note: BY_SELF requires no union members.
  74. */
  75. typedef struct H5VL_loc_params_t {
  76. H5I_type_t obj_type;
  77. H5VL_loc_type_t type;
  78. union {
  79. H5VL_loc_by_token_t loc_by_token;
  80. H5VL_loc_by_name_t loc_by_name;
  81. H5VL_loc_by_idx_t loc_by_idx;
  82. } loc_data;
  83. } H5VL_loc_params_t;
  84. /* Struct for all 'optional' callbacks */
  85. typedef struct H5VL_optional_args_t {
  86. int op_type; /* Operation to perform */
  87. void *args; /* Pointer to operation's argument struct */
  88. } H5VL_optional_args_t;
  89. /* Values for attribute 'get' operations */
  90. typedef enum H5VL_attr_get_t {
  91. H5VL_ATTR_GET_ACPL, /* creation property list */
  92. H5VL_ATTR_GET_INFO, /* info */
  93. H5VL_ATTR_GET_NAME, /* access property list */
  94. H5VL_ATTR_GET_SPACE, /* dataspace */
  95. H5VL_ATTR_GET_STORAGE_SIZE, /* storage size */
  96. H5VL_ATTR_GET_TYPE /* datatype */
  97. } H5VL_attr_get_t;
  98. /* Parameters for attribute 'get_name' operation */
  99. typedef struct H5VL_attr_get_name_args_t {
  100. H5VL_loc_params_t loc_params; /* Location parameters for object access */
  101. size_t buf_size; /* Size of attribute name buffer */
  102. char * buf; /* Buffer for attribute name (OUT) */
  103. size_t * attr_name_len; /* Actual length of attribute name (OUT) */
  104. } H5VL_attr_get_name_args_t;
  105. /* Parameters for attribute 'get_info' operation */
  106. typedef struct H5VL_attr_get_info_args_t {
  107. H5VL_loc_params_t loc_params; /* Location parameters for object access */
  108. const char * attr_name; /* Attribute name (for get_info_by_name) */
  109. H5A_info_t * ainfo; /* Attribute info (OUT) */
  110. } H5VL_attr_get_info_args_t;
  111. /* Parameters for attribute 'get' operations */
  112. typedef struct H5VL_attr_get_args_t {
  113. H5VL_attr_get_t op_type; /* Operation to perform */
  114. /* Parameters for each operation */
  115. union {
  116. /* H5VL_ATTR_GET_ACPL */
  117. struct {
  118. hid_t acpl_id; /* Attribute creation property list ID (OUT) */
  119. } get_acpl;
  120. /* H5VL_ATTR_GET_INFO */
  121. H5VL_attr_get_info_args_t get_info; /* Attribute info */
  122. /* H5VL_ATTR_GET_NAME */
  123. H5VL_attr_get_name_args_t get_name; /* Attribute name */
  124. /* H5VL_ATTR_GET_SPACE */
  125. struct {
  126. hid_t space_id; /* Dataspace ID (OUT) */
  127. } get_space;
  128. /* H5VL_ATTR_GET_STORAGE_SIZE */
  129. struct {
  130. hsize_t *data_size; /* Size of attribute in file (OUT) */
  131. } get_storage_size;
  132. /* H5VL_ATTR_GET_TYPE */
  133. struct {
  134. hid_t type_id; /* Datatype ID (OUT) */
  135. } get_type;
  136. } args;
  137. } H5VL_attr_get_args_t;
  138. /* Values for attribute 'specific' operation */
  139. typedef enum H5VL_attr_specific_t {
  140. H5VL_ATTR_DELETE, /* H5Adelete(_by_name) */
  141. H5VL_ATTR_DELETE_BY_IDX, /* H5Adelete_by_idx */
  142. H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */
  143. H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */
  144. H5VL_ATTR_RENAME /* H5Arename(_by_name) */
  145. } H5VL_attr_specific_t;
  146. /* Parameters for attribute 'iterate' operation */
  147. typedef struct H5VL_attr_iterate_args_t {
  148. H5_index_t idx_type; /* Type of index to iterate over */
  149. H5_iter_order_t order; /* Order of index iteration */
  150. hsize_t * idx; /* Start/stop iteration index (IN/OUT) */
  151. H5A_operator2_t op; /* Iteration callback function */
  152. void * op_data; /* Iteration callback context */
  153. } H5VL_attr_iterate_args_t;
  154. /* Parameters for attribute 'delete_by_idx' operation */
  155. typedef struct H5VL_attr_delete_by_idx_args_t {
  156. H5_index_t idx_type; /* Type of index to iterate over */
  157. H5_iter_order_t order; /* Order of index iteration */
  158. hsize_t n; /* Iteration index */
  159. } H5VL_attr_delete_by_idx_args_t;
  160. /* Parameters for attribute 'specific' operations */
  161. typedef struct H5VL_attr_specific_args_t {
  162. H5VL_attr_specific_t op_type; /* Operation to perform */
  163. /* Parameters for each operation */
  164. union {
  165. /* H5VL_ATTR_DELETE */
  166. struct {
  167. const char *name; /* Name of attribute to delete */
  168. } del;
  169. /* H5VL_ATTR_DELETE_BY_IDX */
  170. H5VL_attr_delete_by_idx_args_t delete_by_idx;
  171. /* H5VL_ATTR_EXISTS */
  172. struct {
  173. const char *name; /* Name of attribute to check */
  174. hbool_t * exists; /* Whether attribute exists (OUT) */
  175. } exists;
  176. /* H5VL_ATTR_ITER */
  177. H5VL_attr_iterate_args_t iterate;
  178. /* H5VL_ATTR_RENAME */
  179. struct {
  180. const char *old_name; /* Name of attribute to rename */
  181. const char *new_name; /* New attribute name */
  182. } rename;
  183. } args;
  184. } H5VL_attr_specific_args_t;
  185. /* Typedef for VOL connector attribute optional VOL operations */
  186. typedef int H5VL_attr_optional_t;
  187. /* Values for dataset 'get' operation */
  188. typedef enum H5VL_dataset_get_t {
  189. H5VL_DATASET_GET_DAPL, /* access property list */
  190. H5VL_DATASET_GET_DCPL, /* creation property list */
  191. H5VL_DATASET_GET_SPACE, /* dataspace */
  192. H5VL_DATASET_GET_SPACE_STATUS, /* space status */
  193. H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */
  194. H5VL_DATASET_GET_TYPE /* datatype */
  195. } H5VL_dataset_get_t;
  196. /* Parameters for dataset 'get' operations */
  197. typedef struct H5VL_dataset_get_args_t {
  198. H5VL_dataset_get_t op_type; /* Operation to perform */
  199. /* Parameters for each operation */
  200. union {
  201. /* H5VL_DATASET_GET_DAPL */
  202. struct {
  203. hid_t dapl_id; /* Dataset access property list ID (OUT) */
  204. } get_dapl;
  205. /* H5VL_DATASET_GET_DCPL */
  206. struct {
  207. hid_t dcpl_id; /* Dataset creation property list ID (OUT) */
  208. } get_dcpl;
  209. /* H5VL_DATASET_GET_SPACE */
  210. struct {
  211. hid_t space_id; /* Dataspace ID (OUT) */
  212. } get_space;
  213. /* H5VL_DATASET_GET_SPACE_STATUS */
  214. struct {
  215. H5D_space_status_t *status; /* Storage space allocation status (OUT) */
  216. } get_space_status;
  217. /* H5VL_DATASET_GET_STORAGE_SIZE */
  218. struct {
  219. hsize_t *storage_size; /* Size of dataset's storage (OUT) */
  220. } get_storage_size;
  221. /* H5VL_DATASET_GET_TYPE */
  222. struct {
  223. hid_t type_id; /* Datatype ID (OUT) */
  224. } get_type;
  225. } args;
  226. } H5VL_dataset_get_args_t;
  227. /* Values for dataset 'specific' operation */
  228. typedef enum H5VL_dataset_specific_t {
  229. H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */
  230. H5VL_DATASET_FLUSH, /* H5Dflush */
  231. H5VL_DATASET_REFRESH /* H5Drefresh */
  232. } H5VL_dataset_specific_t;
  233. /* Parameters for dataset 'specific' operations */
  234. typedef struct H5VL_dataset_specific_args_t {
  235. H5VL_dataset_specific_t op_type; /* Operation to perform */
  236. /* Parameters for each operation */
  237. union {
  238. /* H5VL_DATASET_SET_EXTENT */
  239. struct {
  240. const hsize_t *size; /* New dataspace extent */
  241. } set_extent;
  242. /* H5VL_DATASET_FLUSH */
  243. struct {
  244. hid_t dset_id; /* Dataset ID (IN) */
  245. } flush;
  246. /* H5VL_DATASET_REFRESH */
  247. struct {
  248. hid_t dset_id; /* Dataset ID (IN) */
  249. } refresh;
  250. } args;
  251. } H5VL_dataset_specific_args_t;
  252. /* Typedef for VOL connector dataset optional VOL operations */
  253. typedef int H5VL_dataset_optional_t;
  254. /* Values for datatype 'get' operation */
  255. typedef enum H5VL_datatype_get_t {
  256. H5VL_DATATYPE_GET_BINARY_SIZE, /* Get size of serialized form of transient type */
  257. H5VL_DATATYPE_GET_BINARY, /* Get serialized form of transient type */
  258. H5VL_DATATYPE_GET_TCPL /* Datatype creation property list */
  259. } H5VL_datatype_get_t;
  260. /* Parameters for datatype 'get' operations */
  261. typedef struct H5VL_datatype_get_args_t {
  262. H5VL_datatype_get_t op_type; /* Operation to perform */
  263. /* Parameters for each operation */
  264. union {
  265. /* H5VL_DATATYPE_GET_BINARY_SIZE */
  266. struct {
  267. size_t *size; /* Size of serialized form of datatype (OUT) */
  268. } get_binary_size;
  269. /* H5VL_DATATYPE_GET_BINARY */
  270. struct {
  271. void * buf; /* Buffer to store serialized form of datatype (OUT) */
  272. size_t buf_size; /* Size of serialized datatype buffer */
  273. } get_binary;
  274. /* H5VL_DATATYPE_GET_TCPL */
  275. struct {
  276. hid_t tcpl_id; /* Named datatype creation property list ID (OUT) */
  277. } get_tcpl;
  278. } args;
  279. } H5VL_datatype_get_args_t;
  280. /* Values for datatype 'specific' operation */
  281. typedef enum H5VL_datatype_specific_t {
  282. H5VL_DATATYPE_FLUSH, /* H5Tflush */
  283. H5VL_DATATYPE_REFRESH /* H5Trefresh */
  284. } H5VL_datatype_specific_t;
  285. /* Parameters for datatype 'specific' operations */
  286. typedef struct H5VL_datatype_specific_args_t {
  287. H5VL_datatype_specific_t op_type; /* Operation to perform */
  288. /* Parameters for each operation */
  289. union {
  290. /* H5VL_DATATYPE_FLUSH */
  291. struct {
  292. hid_t type_id; /* Named datatype ID (IN) */
  293. } flush;
  294. /* H5VL_DATATYPE_REFRESH */
  295. struct {
  296. hid_t type_id; /* Named datatype ID (IN) */
  297. } refresh;
  298. } args;
  299. } H5VL_datatype_specific_args_t;
  300. /* Typedef and values for native VOL connector named datatype optional VOL operations */
  301. typedef int H5VL_datatype_optional_t;
  302. /* (No optional named datatype VOL operations currently) */
  303. /* Info for H5VL_FILE_GET_CONT_INFO */
  304. typedef struct H5VL_file_cont_info_t {
  305. unsigned version; /* version information (keep first) */
  306. uint64_t feature_flags; /* Container feature flags */
  307. /* (none currently defined) */
  308. size_t token_size; /* Size of tokens */
  309. size_t blob_id_size; /* Size of blob IDs */
  310. } H5VL_file_cont_info_t;
  311. /* Values for file 'get' operation */
  312. typedef enum H5VL_file_get_t {
  313. H5VL_FILE_GET_CONT_INFO, /* file get container info */
  314. H5VL_FILE_GET_FAPL, /* file access property list */
  315. H5VL_FILE_GET_FCPL, /* file creation property list */
  316. H5VL_FILE_GET_FILENO, /* file number */
  317. H5VL_FILE_GET_INTENT, /* file intent */
  318. H5VL_FILE_GET_NAME, /* file name */
  319. H5VL_FILE_GET_OBJ_COUNT, /* object count in file */
  320. H5VL_FILE_GET_OBJ_IDS /* object ids in file */
  321. } H5VL_file_get_t;
  322. /* Parameters for file 'get_name' operation */
  323. typedef struct H5VL_file_get_name_args_t {
  324. H5I_type_t type; /* ID type of object pointer */
  325. size_t buf_size; /* Size of file name buffer (IN) */
  326. char * buf; /* Buffer for file name (OUT) */
  327. size_t * file_name_len; /* Actual length of file name (OUT) */
  328. } H5VL_file_get_name_args_t;
  329. /* Parameters for file 'get_obj_ids' operation */
  330. typedef struct H5VL_file_get_obj_ids_args_t {
  331. unsigned types; /* Type of objects to count */
  332. size_t max_objs; /* Size of array of object IDs */
  333. hid_t * oid_list; /* Array of object IDs (OUT) */
  334. size_t * count; /* # of objects (OUT) */
  335. } H5VL_file_get_obj_ids_args_t;
  336. /* Parameters for file 'get' operations */
  337. typedef struct H5VL_file_get_args_t {
  338. H5VL_file_get_t op_type; /* Operation to perform */
  339. /* Parameters for each operation */
  340. union {
  341. /* H5VL_FILE_GET_CONT_INFO */
  342. struct {
  343. H5VL_file_cont_info_t *info; /* Container info (OUT) */
  344. } get_cont_info;
  345. /* H5VL_FILE_GET_FAPL */
  346. struct {
  347. hid_t fapl_id; /* File access property list (OUT) */
  348. } get_fapl;
  349. /* H5VL_FILE_GET_FCPL */
  350. struct {
  351. hid_t fcpl_id; /* File creation property list (OUT) */
  352. } get_fcpl;
  353. /* H5VL_FILE_GET_FILENO */
  354. struct {
  355. unsigned long *fileno; /* File "number" (OUT) */
  356. } get_fileno;
  357. /* H5VL_FILE_GET_INTENT */
  358. struct {
  359. unsigned *flags; /* File open/create intent flags (OUT) */
  360. } get_intent;
  361. /* H5VL_FILE_GET_NAME */
  362. H5VL_file_get_name_args_t get_name;
  363. /* H5VL_FILE_GET_OBJ_COUNT */
  364. struct {
  365. unsigned types; /* Type of objects to count */
  366. size_t * count; /* # of objects (OUT) */
  367. } get_obj_count;
  368. /* H5VL_FILE_GET_OBJ_IDS */
  369. H5VL_file_get_obj_ids_args_t get_obj_ids;
  370. } args;
  371. } H5VL_file_get_args_t;
  372. /* Values for file 'specific' operation */
  373. typedef enum H5VL_file_specific_t {
  374. H5VL_FILE_FLUSH, /* Flush file */
  375. H5VL_FILE_REOPEN, /* Reopen the file */
  376. H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
  377. H5VL_FILE_DELETE, /* Delete a file */
  378. H5VL_FILE_IS_EQUAL /* Check if two files are the same */
  379. } H5VL_file_specific_t;
  380. /* Parameters for file 'specific' operations */
  381. typedef struct H5VL_file_specific_args_t {
  382. H5VL_file_specific_t op_type; /* Operation to perform */
  383. /* Parameters for each operation */
  384. union {
  385. /* H5VL_FILE_FLUSH */
  386. struct {
  387. H5I_type_t obj_type; /* Type of object to use */
  388. H5F_scope_t scope; /* Scope of flush operation */
  389. } flush;
  390. /* H5VL_FILE_REOPEN */
  391. struct {
  392. void **file; /* File object for new file (OUT) */
  393. } reopen;
  394. /* H5VL_FILE_IS_ACCESSIBLE */
  395. struct {
  396. const char *filename; /* Name of file to check */
  397. hid_t fapl_id; /* File access property list to use */
  398. hbool_t * accessible; /* Whether file is accessible with FAPL settings (OUT) */
  399. } is_accessible;
  400. /* H5VL_FILE_DELETE */
  401. struct {
  402. const char *filename; /* Name of file to delete */
  403. hid_t fapl_id; /* File access property list to use */
  404. } del;
  405. /* H5VL_FILE_IS_EQUAL */
  406. struct {
  407. void * obj2; /* Second file object to compare against */
  408. hbool_t *same_file; /* Whether files are the same (OUT) */
  409. } is_equal;
  410. } args;
  411. } H5VL_file_specific_args_t;
  412. /* Typedef for VOL connector file optional VOL operations */
  413. typedef int H5VL_file_optional_t;
  414. /* Values for group 'get' operation */
  415. typedef enum H5VL_group_get_t {
  416. H5VL_GROUP_GET_GCPL, /* group creation property list */
  417. H5VL_GROUP_GET_INFO /* group info */
  418. } H5VL_group_get_t;
  419. /* Parameters for group 'get_info' operation */
  420. typedef struct H5VL_group_get_info_args_t {
  421. H5VL_loc_params_t loc_params; /* Location parameters for object access */
  422. H5G_info_t * ginfo; /* Group info (OUT) */
  423. } H5VL_group_get_info_args_t;
  424. /* Parameters for group 'get' operations */
  425. typedef struct H5VL_group_get_args_t {
  426. H5VL_group_get_t op_type; /* Operation to perform */
  427. /* Parameters for each operation */
  428. union {
  429. /* H5VL_GROUP_GET_GCPL */
  430. struct {
  431. hid_t gcpl_id; /* Group creation property list (OUT) */
  432. } get_gcpl;
  433. /* H5VL_GROUP_GET_INFO */
  434. H5VL_group_get_info_args_t get_info; /* Group info */
  435. } args;
  436. } H5VL_group_get_args_t;
  437. /* Values for group 'specific' operation */
  438. typedef enum H5VL_group_specific_t {
  439. H5VL_GROUP_MOUNT, /* Mount a file on a group */
  440. H5VL_GROUP_UNMOUNT, /* Unmount a file on a group */
  441. H5VL_GROUP_FLUSH, /* H5Gflush */
  442. H5VL_GROUP_REFRESH /* H5Grefresh */
  443. } H5VL_group_specific_t;
  444. /* Parameters for group 'mount' operation */
  445. typedef struct H5VL_group_spec_mount_args_t {
  446. const char *name; /* Name of location to mount child file */
  447. void * child_file; /* Pointer to child file object */
  448. hid_t fmpl_id; /* File mount property list to use */
  449. } H5VL_group_spec_mount_args_t;
  450. /* Parameters for group 'specific' operations */
  451. typedef struct H5VL_group_specific_args_t {
  452. H5VL_group_specific_t op_type; /* Operation to perform */
  453. /* Parameters for each operation */
  454. union {
  455. /* H5VL_GROUP_MOUNT */
  456. H5VL_group_spec_mount_args_t mount;
  457. /* H5VL_GROUP_UNMOUNT */
  458. struct {
  459. const char *name; /* Name of location to unmount child file */
  460. } unmount;
  461. /* H5VL_GROUP_FLUSH */
  462. struct {
  463. hid_t grp_id; /* Group ID (IN) */
  464. } flush;
  465. /* H5VL_GROUP_REFRESH */
  466. struct {
  467. hid_t grp_id; /* Group ID (IN) */
  468. } refresh;
  469. } args;
  470. } H5VL_group_specific_args_t;
  471. /* Typedef for VOL connector group optional VOL operations */
  472. typedef int H5VL_group_optional_t;
  473. /* Link create types for VOL */
  474. typedef enum H5VL_link_create_t {
  475. H5VL_LINK_CREATE_HARD,
  476. H5VL_LINK_CREATE_SOFT,
  477. H5VL_LINK_CREATE_UD
  478. } H5VL_link_create_t;
  479. /* Parameters for link 'create' operations */
  480. typedef struct H5VL_link_create_args_t {
  481. H5VL_link_create_t op_type; /* Operation to perform */
  482. /* Parameters for each operation */
  483. union {
  484. /* H5VL_LINK_CREATE_HARD */
  485. struct {
  486. void * curr_obj; /* Current object */
  487. H5VL_loc_params_t curr_loc_params; /* Location parameters for current object */
  488. } hard;
  489. /* H5VL_LINK_CREATE_SOFT */
  490. struct {
  491. const char *target; /* Target of soft link */
  492. } soft;
  493. /* H5VL_LINK_CREATE_UD */
  494. struct {
  495. H5L_type_t type; /* Type of link to create */
  496. const void *buf; /* Buffer that contains link info */
  497. size_t buf_size; /* Size of link info buffer */
  498. } ud;
  499. } args;
  500. } H5VL_link_create_args_t;
  501. /* Values for link 'get' operation */
  502. typedef enum H5VL_link_get_t {
  503. H5VL_LINK_GET_INFO, /* link info */
  504. H5VL_LINK_GET_NAME, /* link name */
  505. H5VL_LINK_GET_VAL /* link value */
  506. } H5VL_link_get_t;
  507. /* Parameters for link 'get' operations */
  508. typedef struct H5VL_link_get_args_t {
  509. H5VL_link_get_t op_type; /* Operation to perform */
  510. /* Parameters for each operation */
  511. union {
  512. /* H5VL_LINK_GET_INFO */
  513. struct {
  514. H5L_info2_t *linfo; /* Pointer to link's info (OUT) */
  515. } get_info;
  516. /* H5VL_LINK_GET_NAME */
  517. struct {
  518. size_t name_size; /* Size of link name buffer (IN) */
  519. char * name; /* Buffer for link name (OUT) */
  520. size_t *name_len; /* Actual length of link name (OUT) */
  521. } get_name;
  522. /* H5VL_LINK_GET_VAL */
  523. struct {
  524. size_t buf_size; /* Size of link value buffer (IN) */
  525. void * buf; /* Buffer for link value (OUT) */
  526. } get_val;
  527. } args;
  528. } H5VL_link_get_args_t;
  529. /* Values for link 'specific' operation */
  530. typedef enum H5VL_link_specific_t {
  531. H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */
  532. H5VL_LINK_EXISTS, /* link existence */
  533. H5VL_LINK_ITER /* H5Literate/visit(_by_name) */
  534. } H5VL_link_specific_t;
  535. /* Parameters for link 'iterate' operation */
  536. typedef struct H5VL_link_iterate_args_t {
  537. hbool_t recursive; /* Whether iteration is recursive */
  538. H5_index_t idx_type; /* Type of index to iterate over */
  539. H5_iter_order_t order; /* Order of index iteration */
  540. hsize_t * idx_p; /* Start/stop iteration index (OUT) */
  541. H5L_iterate2_t op; /* Iteration callback function */
  542. void * op_data; /* Iteration callback context */
  543. } H5VL_link_iterate_args_t;
  544. /* Parameters for link 'specific' operations */
  545. typedef struct H5VL_link_specific_args_t {
  546. H5VL_link_specific_t op_type; /* Operation to perform */
  547. /* Parameters for each operation */
  548. union {
  549. /* H5VL_LINK_DELETE */
  550. /* No args */
  551. /* H5VL_LINK_EXISTS */
  552. struct {
  553. hbool_t *exists; /* Whether link exists (OUT) */
  554. } exists;
  555. /* H5VL_LINK_ITER */
  556. H5VL_link_iterate_args_t iterate;
  557. } args;
  558. } H5VL_link_specific_args_t;
  559. /* Typedef and values for native VOL connector link optional VOL operations */
  560. typedef int H5VL_link_optional_t;
  561. /* (No optional link VOL operations currently) */
  562. /* Values for object 'get' operation */
  563. typedef enum H5VL_object_get_t {
  564. H5VL_OBJECT_GET_FILE, /* object file */
  565. H5VL_OBJECT_GET_NAME, /* object name */
  566. H5VL_OBJECT_GET_TYPE, /* object type */
  567. H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name) */
  568. } H5VL_object_get_t;
  569. /* Parameters for object 'get' operations */
  570. typedef struct H5VL_object_get_args_t {
  571. H5VL_object_get_t op_type; /* Operation to perform */
  572. /* Parameters for each operation */
  573. union {
  574. /* H5VL_OBJECT_GET_FILE */
  575. struct {
  576. void **file; /* File object (OUT) */
  577. } get_file;
  578. /* H5VL_OBJECT_GET_NAME */
  579. struct {
  580. size_t buf_size; /* Size of name buffer (IN) */
  581. char * buf; /* Buffer for name (OUT) */
  582. size_t *name_len; /* Actual length of name (OUT) */
  583. } get_name;
  584. /* H5VL_OBJECT_GET_TYPE */
  585. struct {
  586. H5O_type_t *obj_type; /* Type of object (OUT) */
  587. } get_type;
  588. /* H5VL_OBJECT_GET_INFO */
  589. struct {
  590. unsigned fields; /* Flags for fields to retrieve */
  591. H5O_info2_t *oinfo; /* Pointer to object info (OUT) */
  592. } get_info;
  593. } args;
  594. } H5VL_object_get_args_t;
  595. /* Values for object 'specific' operation */
  596. typedef enum H5VL_object_specific_t {
  597. H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
  598. H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
  599. H5VL_OBJECT_LOOKUP, /* Lookup object */
  600. H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */
  601. H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */
  602. H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
  603. } H5VL_object_specific_t;
  604. /* Parameters for object 'visit' operation */
  605. typedef struct H5VL_object_visit_args_t {
  606. H5_index_t idx_type; /* Type of index to iterate over */
  607. H5_iter_order_t order; /* Order of index iteration */
  608. unsigned fields; /* Flags for fields to provide in 'info' object for 'op' callback */
  609. H5O_iterate2_t op; /* Iteration callback function */
  610. void * op_data; /* Iteration callback context */
  611. } H5VL_object_visit_args_t;
  612. /* Parameters for object 'specific' operations */
  613. typedef struct H5VL_object_specific_args_t {
  614. H5VL_object_specific_t op_type; /* Operation to perform */
  615. /* Parameters for each operation */
  616. union {
  617. /* H5VL_OBJECT_CHANGE_REF_COUNT */
  618. struct {
  619. int delta; /* Amount to modify object's refcount */
  620. } change_rc;
  621. /* H5VL_OBJECT_EXISTS */
  622. struct {
  623. hbool_t *exists; /* Whether object exists (OUT) */
  624. } exists;
  625. /* H5VL_OBJECT_LOOKUP */
  626. struct {
  627. H5O_token_t *token_ptr; /* Pointer to token for lookup (OUT) */
  628. } lookup;
  629. /* H5VL_OBJECT_VISIT */
  630. H5VL_object_visit_args_t visit;
  631. /* H5VL_OBJECT_FLUSH */
  632. struct {
  633. hid_t obj_id; /* Object ID (IN) */
  634. } flush;
  635. /* H5VL_OBJECT_REFRESH */
  636. struct {
  637. hid_t obj_id; /* Object ID (IN) */
  638. } refresh;
  639. } args;
  640. } H5VL_object_specific_args_t;
  641. /* Typedef for VOL connector object optional VOL operations */
  642. typedef int H5VL_object_optional_t;
  643. /* Status values for async request operations */
  644. typedef enum H5VL_request_status_t {
  645. H5VL_REQUEST_STATUS_IN_PROGRESS, /* Operation has not yet completed */
  646. H5VL_REQUEST_STATUS_SUCCEED, /* Operation has completed, successfully */
  647. H5VL_REQUEST_STATUS_FAIL, /* Operation has completed, but failed */
  648. H5VL_REQUEST_STATUS_CANT_CANCEL, /* An attempt to cancel this operation was made, but it */
  649. /* can't be canceled immediately. The operation has */
  650. /* not completed successfully or failed, and is not yet */
  651. /* in progress. Another attempt to cancel it may be */
  652. /* attempted and may (or may not) succeed. */
  653. H5VL_REQUEST_STATUS_CANCELED /* Operation has not completed and was canceled */
  654. } H5VL_request_status_t;
  655. /* Values for async request 'specific' operation */
  656. typedef enum H5VL_request_specific_t {
  657. H5VL_REQUEST_GET_ERR_STACK, /* Retrieve error stack for failed operation */
  658. H5VL_REQUEST_GET_EXEC_TIME /* Retrieve execution time for operation */
  659. } H5VL_request_specific_t;
  660. /* Parameters for request 'specific' operations */
  661. typedef struct H5VL_request_specific_args_t {
  662. H5VL_request_specific_t op_type; /* Operation to perform */
  663. /* Parameters for each operation */
  664. union {
  665. /* H5VL_REQUEST_GET_ERR_STACK */
  666. struct {
  667. hid_t err_stack_id; /* Error stack ID for operation (OUT) */
  668. } get_err_stack;
  669. /* H5VL_REQUEST_GET_EXEC_TIME */
  670. struct {
  671. uint64_t *exec_ts; /* Timestamp for start of task execution (OUT) */
  672. uint64_t *exec_time; /* Duration of task execution (in ns) (OUT) */
  673. } get_exec_time;
  674. } args;
  675. } H5VL_request_specific_args_t;
  676. /* Typedef and values for native VOL connector request optional VOL operations */
  677. typedef int H5VL_request_optional_t;
  678. /* (No optional request VOL operations currently) */
  679. /* Values for 'blob' 'specific' operation */
  680. typedef enum H5VL_blob_specific_t {
  681. H5VL_BLOB_DELETE, /* Delete a blob (by ID) */
  682. H5VL_BLOB_ISNULL, /* Check if a blob ID is "null" */
  683. H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */
  684. } H5VL_blob_specific_t;
  685. /* Parameters for blob 'specific' operations */
  686. typedef struct H5VL_blob_specific_args_t {
  687. H5VL_blob_specific_t op_type; /* Operation to perform */
  688. /* Parameters for each operation */
  689. union {
  690. /* H5VL_BLOB_DELETE */
  691. /* No args */
  692. /* H5VL_BLOB_ISNULL */
  693. struct {
  694. hbool_t *isnull; /* Whether blob ID is "null" (OUT) */
  695. } is_null;
  696. /* H5VL_BLOB_SETNULL */
  697. /* No args */
  698. } args;
  699. } H5VL_blob_specific_args_t;
  700. /* Typedef and values for native VOL connector blob optional VOL operations */
  701. typedef int H5VL_blob_optional_t;
  702. /* (No optional blob VOL operations currently) */
  703. /* VOL connector info fields & callbacks */
  704. typedef struct H5VL_info_class_t {
  705. size_t size; /* Size of the VOL info */
  706. void *(*copy)(const void *info); /* Callback to create a copy of the VOL info */
  707. herr_t (*cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare VOL info */
  708. herr_t (*free)(void *info); /* Callback to release a VOL info */
  709. herr_t (*to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */
  710. herr_t (*from_str)(const char *str,
  711. void ** info); /* Callback to deserialize a string into connector's info */
  712. } H5VL_info_class_t;
  713. /* VOL object wrap / retrieval callbacks */
  714. /* (These only need to be implemented by "pass through" VOL connectors) */
  715. typedef struct H5VL_wrap_class_t {
  716. void *(*get_object)(const void *obj); /* Callback to retrieve underlying object */
  717. herr_t (*get_wrap_ctx)(
  718. const void *obj,
  719. void ** wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */
  720. void *(*wrap_object)(void *obj, H5I_type_t obj_type,
  721. void *wrap_ctx); /* Callback to wrap a library object */
  722. void *(*unwrap_object)(void *obj); /* Callback to unwrap a library object */
  723. herr_t (*free_wrap_ctx)(
  724. void *wrap_ctx); /* Callback to release the object wrapping context for the connector */
  725. } H5VL_wrap_class_t;
  726. /* H5A routines */
  727. typedef struct H5VL_attr_class_t {
  728. void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id,
  729. hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
  730. void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id,
  731. hid_t dxpl_id, void **req);
  732. herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
  733. herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
  734. herr_t (*get)(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
  735. herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_args_t *args,
  736. hid_t dxpl_id, void **req);
  737. herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
  738. herr_t (*close)(void *attr, hid_t dxpl_id, void **req);
  739. } H5VL_attr_class_t;
  740. /* H5D routines */
  741. typedef struct H5VL_dataset_class_t {
  742. void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id,
  743. hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
  744. void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id,
  745. hid_t dxpl_id, void **req);
  746. herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
  747. void *buf, void **req);
  748. herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
  749. const void *buf, void **req);
  750. herr_t (*get)(void *obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req);
  751. herr_t (*specific)(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req);
  752. herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
  753. herr_t (*close)(void *dset, hid_t dxpl_id, void **req);
  754. } H5VL_dataset_class_t;
  755. /* H5T routines*/
  756. typedef struct H5VL_datatype_class_t {
  757. void *(*commit)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id,
  758. hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
  759. void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id,
  760. hid_t dxpl_id, void **req);
  761. herr_t (*get)(void *obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req);
  762. herr_t (*specific)(void *obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req);
  763. herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
  764. herr_t (*close)(void *dt, hid_t dxpl_id, void **req);
  765. } H5VL_datatype_class_t;
  766. /* H5F routines */
  767. typedef struct H5VL_file_class_t {
  768. void *(*create)(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id,
  769. void **req);
  770. void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
  771. herr_t (*get)(void *obj, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
  772. herr_t (*specific)(void *obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req);
  773. herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
  774. herr_t (*close)(void *file, hid_t dxpl_id, void **req);
  775. } H5VL_file_class_t;
  776. /* H5G routines */
  777. typedef struct H5VL_group_class_t {
  778. void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id,
  779. hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
  780. void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id,
  781. hid_t dxpl_id, void **req);
  782. herr_t (*get)(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
  783. herr_t (*specific)(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req);
  784. herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
  785. herr_t (*close)(void *grp, hid_t dxpl_id, void **req);
  786. } H5VL_group_class_t;
  787. /* H5L routines */
  788. typedef struct H5VL_link_class_t {
  789. herr_t (*create)(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
  790. hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
  791. herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
  792. const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
  793. void **req);
  794. herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
  795. const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
  796. void **req);
  797. herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args, hid_t dxpl_id,
  798. void **req);
  799. herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_args_t *args,
  800. hid_t dxpl_id, void **req);
  801. herr_t (*optional)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
  802. hid_t dxpl_id, void **req);
  803. } H5VL_link_class_t;
  804. /* H5O routines */
  805. typedef struct H5VL_object_class_t {
  806. void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id,
  807. void **req);
  808. herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, void *dst_obj,
  809. const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id,
  810. hid_t dxpl_id, void **req);
  811. herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args, hid_t dxpl_id,
  812. void **req);
  813. herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_args_t *args,
  814. hid_t dxpl_id, void **req);
  815. herr_t (*optional)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
  816. hid_t dxpl_id, void **req);
  817. } H5VL_object_class_t;
  818. /* Asynchronous request 'notify' callback */
  819. typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5VL_request_status_t status);
  820. /* "Levels" for 'get connector class' introspection callback */
  821. typedef enum H5VL_get_conn_lvl_t {
  822. H5VL_GET_CONN_LVL_CURR, /* Get "current" connector (for this object) */
  823. H5VL_GET_CONN_LVL_TERM /* Get "terminal" connector (for this object) */
  824. /* (Recursively called, for pass-through connectors) */
  825. /* (Connectors that "split" must choose which connector to return) */
  826. } H5VL_get_conn_lvl_t;
  827. /* Forward declaration of H5VL_class_t, defined later in this file */
  828. struct H5VL_class_t;
  829. /* Container/connector introspection routines */
  830. typedef struct H5VL_introspect_class_t {
  831. herr_t (*get_conn_cls)(void *obj, H5VL_get_conn_lvl_t lvl, const struct H5VL_class_t **conn_cls);
  832. herr_t (*get_cap_flags)(const void *info, unsigned *cap_flags);
  833. herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags);
  834. } H5VL_introspect_class_t;
  835. /* Async request operation routines */
  836. typedef struct H5VL_request_class_t {
  837. herr_t (*wait)(void *req, uint64_t timeout, H5VL_request_status_t *status);
  838. herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx);
  839. herr_t (*cancel)(void *req, H5VL_request_status_t *status);
  840. herr_t (*specific)(void *req, H5VL_request_specific_args_t *args);
  841. herr_t (*optional)(void *req, H5VL_optional_args_t *args);
  842. herr_t (*free)(void *req);
  843. } H5VL_request_class_t;
  844. /* 'blob' routines */
  845. typedef struct H5VL_blob_class_t {
  846. herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
  847. herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
  848. herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
  849. herr_t (*optional)(void *obj, void *blob_id, H5VL_optional_args_t *args);
  850. } H5VL_blob_class_t;
  851. /* Object token routines */
  852. typedef struct H5VL_token_class_t {
  853. herr_t (*cmp)(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value);
  854. herr_t (*to_str)(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str);
  855. herr_t (*from_str)(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token);
  856. } H5VL_token_class_t;
  857. /**
  858. * \ingroup H5VLDEV
  859. * Class information for each VOL connector
  860. */
  861. //! <!-- [H5VL_class_t_snip] -->
  862. typedef struct H5VL_class_t {
  863. /* Overall connector fields & callbacks */
  864. unsigned version; /**< VOL connector class struct version # */
  865. H5VL_class_value_t value; /**< Value to identify connector */
  866. const char * name; /**< Connector name (MUST be unique!) */
  867. unsigned conn_version; /**< Version # of connector */
  868. unsigned cap_flags; /**< Capability flags for connector */
  869. herr_t (*initialize)(hid_t vipl_id); /**< Connector initialization callback */
  870. herr_t (*terminate)(void); /**< Connector termination callback */
  871. /* VOL framework */
  872. H5VL_info_class_t info_cls; /**< VOL info fields & callbacks */
  873. H5VL_wrap_class_t wrap_cls; /**< VOL object wrap / retrieval callbacks */
  874. /* Data Model */
  875. H5VL_attr_class_t attr_cls; /**< Attribute (H5A*) class callbacks */
  876. H5VL_dataset_class_t dataset_cls; /**< Dataset (H5D*) class callbacks */
  877. H5VL_datatype_class_t datatype_cls; /**< Datatype (H5T*) class callbacks */
  878. H5VL_file_class_t file_cls; /**< File (H5F*) class callbacks */
  879. H5VL_group_class_t group_cls; /**< Group (H5G*) class callbacks */
  880. H5VL_link_class_t link_cls; /**< Link (H5L*) class callbacks */
  881. H5VL_object_class_t object_cls; /**< Object (H5O*) class callbacks */
  882. /* Infrastructure / Services */
  883. H5VL_introspect_class_t introspect_cls; /**< Container/connector introspection class callbacks */
  884. H5VL_request_class_t request_cls; /**< Asynchronous request class callbacks */
  885. H5VL_blob_class_t blob_cls; /**< 'Blob' class callbacks */
  886. H5VL_token_class_t token_cls; /**< VOL connector object token class callbacks */
  887. /* Catch-all */
  888. herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
  889. void **req); /**< Optional callback */
  890. } H5VL_class_t;
  891. //! <!-- [H5VL_class_t_snip] -->
  892. /********************/
  893. /* Public Variables */
  894. /********************/
  895. /*********************/
  896. /* Public Prototypes */
  897. /*********************/
  898. #ifdef __cplusplus
  899. extern "C" {
  900. #endif
  901. /* Helper routines for VOL connector authors */
  902. /**
  903. * \ingroup H5VLDEV
  904. * \brief Registers a new VOL connector
  905. *
  906. * \param[in] cls A pointer to the plugin structure to register
  907. * \vipl_id
  908. * \return \hid_t{VOL connector}
  909. *
  910. * \details H5VLregister_connector() registers a new VOL connector as a member
  911. * of the virtual object layer class. This VOL connector identifier is
  912. * good until the library is closed or the connector is unregistered.
  913. *
  914. * \p vipl_id is either #H5P_DEFAULT or the identifier of a VOL
  915. * initialization property list of class #H5P_VOL_INITIALIZE created
  916. * with H5Pcreate(). When created, this property list contains no
  917. * library properties. If a VOL connector author decides that
  918. * initialization-specific data are needed, they can be added to the
  919. * empty list and retrieved by the connector in the VOL connector's
  920. * initialize callback. Use of the VOL initialization property list is
  921. * uncommon, as most VOL-specific properties are added to the file
  922. * access property list via the connector's API calls which set the
  923. * VOL connector for the file open/create. For more information, see
  924. * the \ref_vol_doc.
  925. *
  926. * H5VL_class_t is defined in H5VLconnector.h in the source code. It
  927. * contains class information for each VOL connector:
  928. * \snippet this H5VL_class_t_snip
  929. *
  930. * \since 1.12.0
  931. *
  932. */
  933. H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
  934. /**
  935. * \ingroup H5VLDEV
  936. */
  937. H5_DLL void *H5VLobject(hid_t obj_id);
  938. /**
  939. * \ingroup H5VLDEV
  940. */
  941. H5_DLL hid_t H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id);
  942. /**
  943. * \ingroup H5VLDEV
  944. */
  945. H5_DLL hid_t H5VLpeek_connector_id_by_name(const char *name);
  946. /**
  947. * \ingroup H5VLDEV
  948. */
  949. H5_DLL hid_t H5VLpeek_connector_id_by_value(H5VL_class_value_t value);
  950. /* User-defined optional operations */
  951. H5_DLL herr_t H5VLregister_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
  952. H5_DLL herr_t H5VLfind_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
  953. H5_DLL herr_t H5VLunregister_opt_operation(H5VL_subclass_t subcls, const char *op_name);
  954. H5_DLL herr_t H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_line,
  955. hid_t attr_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
  956. H5_DLL herr_t H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app_line,
  957. hid_t dset_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
  958. H5_DLL herr_t H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned app_line,
  959. hid_t type_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
  960. H5_DLL herr_t H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_line,
  961. hid_t file_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
  962. H5_DLL herr_t H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_line,
  963. hid_t group_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
  964. H5_DLL herr_t H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_line,
  965. hid_t loc_id, const char *name, hid_t lapl_id, H5VL_optional_args_t *args,
  966. hid_t dxpl_id, hid_t es_id);
  967. H5_DLL herr_t H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_line,
  968. hid_t loc_id, const char *name, hid_t lapl_id,
  969. H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
  970. H5_DLL herr_t H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *args);
  971. /* API Wrappers for "optional_op" routines */
  972. /* (Must be defined _after_ the function prototype) */
  973. /* (And must only defined when included in application code, not the library) */
  974. #ifndef H5VL_MODULE
  975. /* Inject application compile-time macros into function calls */
  976. #define H5VLattr_optional_op(...) H5VLattr_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
  977. #define H5VLdataset_optional_op(...) H5VLdataset_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
  978. #define H5VLdatatype_optional_op(...) H5VLdatatype_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
  979. #define H5VLfile_optional_op(...) H5VLfile_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
  980. #define H5VLgroup_optional_op(...) H5VLgroup_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
  981. #define H5VLlink_optional_op(...) H5VLlink_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
  982. #define H5VLobject_optional_op(...) H5VLobject_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
  983. /* Define "wrapper" versions of function calls, to allow compile-time values to
  984. * be passed in by language wrapper or library layer on top of HDF5.
  985. */
  986. #define H5VLattr_optional_op_wrap H5_NO_EXPAND(H5VLattr_optional_op)
  987. #define H5VLdataset_optional_op_wrap H5_NO_EXPAND(H5VLdataset_optional_op)
  988. #define H5VLdatatype_optional_op_wrap H5_NO_EXPAND(H5VLdatatype_optional_op)
  989. #define H5VLfile_optional_op_wrap H5_NO_EXPAND(H5VLfile_optional_op)
  990. #define H5VLgroup_optional_op_wrap H5_NO_EXPAND(H5VLgroup_optional_op)
  991. #define H5VLlink_optional_op_wrap H5_NO_EXPAND(H5VLlink_optional_op)
  992. #define H5VLobject_optional_op_wrap H5_NO_EXPAND(H5VLobject_optional_op)
  993. #endif /* H5VL_MODULE */
  994. #ifdef __cplusplus
  995. }
  996. #endif
  997. #endif /* H5VLconnector_H */