1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
* June, 2014
*
* Purpose: The IOD VOL plugin property list functions.
*/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FDprivate.h" /* file drivers */
#include "H5FFprivate.h" /* Fast Forward */
#include "H5Iprivate.h" /* IDs */
#include "H5Pprivate.h" /* Property lists */
#include "H5VLiod.h" /* Iod VOL plugin */
#ifdef H5_HAVE_EFF
/*-------------------------------------------------------------------------
* Function: H5Pset_ocpl_enable_checksum
*
* Purpose: Set a boolean flag on the object creation property list
* to indicate to the VOL plugin to enable checksum on the
* object to be created.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* January, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_ocpl_enable_checksum(hid_t ocpl_id, hbool_t flag)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", ocpl_id, flag);
if(ocpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl")
/* Set the transfer mode */
if(H5P_set(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, &flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_ocpl_enable_checksum() */
/*-------------------------------------------------------------------------
* Function: H5Pget_ocpl_enable_checksum
*
* Purpose: Retrieve a boolean flag on the object creation property
* list that indicates whether checksuming on this object
* is enabled or not.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* January, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_ocpl_enable_checksum(hid_t ocpl_id, hbool_t *flag/*out*/)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", ocpl_id, flag);
if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl")
/* Get the transfer mode */
if(flag)
if(H5P_get(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_ocpl_enable_checksum() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_replica
*
* Purpose: Set the replica ID to be used when accessing an object
* using this transfer plist.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* February, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_replica(hid_t dxpl_id, hrpl_t replica_id)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iRp", dxpl_id, replica_id);
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
if(H5P_set(plist, H5O_XFER_REPLICA_ID_NAME, &replica_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_replica() */
/*-------------------------------------------------------------------------
* Function: H5Pget_dxpl_replica
*
* Purpose: Retrieve the replica ID from this access plist.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* February, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_dxpl_replica(hid_t dxpl_id, hrpl_t *replica_id/*out*/)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, replica_id);
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Get the transfer mode */
if(replica_id)
if(H5P_get(plist, H5O_XFER_REPLICA_ID_NAME, replica_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dxpl_replica() */
/*-------------------------------------------------------------------------
* Function: H5Pset_prefetch_layout
*
* Purpose: Set the prefetch layout to be used when accessing an object
* using this transfer plist.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* May, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_prefetch_layout(hid_t dxpl_id, H5FF_layout_t layout)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
if(H5P_set(plist, H5O_XFER_LAYOUT_TYPE_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_prefetch_layout() */
/*-------------------------------------------------------------------------
* Function: H5Pget_prefetch_layout
*
* Purpose: Retrieve the prefetch layout from this access plist.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* May, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_prefetch_layout(hid_t dxpl_id, H5FF_layout_t *layout/*out*/)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, layout);
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Get the transfer mode */
if(layout)
if(H5P_get(plist, H5O_XFER_LAYOUT_TYPE_NAME, layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_prefetch_layout() */
/*-------------------------------------------------------------------------
* Function: H5Pset_prefetch_selection
*
* Purpose: Set the prefetch selection to be used when accessing an object
* using this transfer plist.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* May, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_prefetch_selection(hid_t dxpl_id, hid_t selection)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ii", dxpl_id, selection);
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
if(H5P_set(plist, H5O_XFER_SELECTION_NAME, &selection) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_prefetch_selection() */
/*-------------------------------------------------------------------------
* Function: H5Pset_prefetch_range
*
* Purpose: Set the prefetch range to be used when accessing an object
* using this transfer plist.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* May, 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_prefetch_range(hid_t dxpl_id, hid_t keymem_type, const void *low_key, const void *high_key)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "ii*x*x", dxpl_id, keymem_type, low_key, high_key);
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
if(H5P_set(plist, H5O_XFER_KEY_TYPE_NAME, &keymem_type) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
if(H5P_set(plist, H5O_XFER_LOW_KEY_BUF_NAME, &low_key) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
if(H5P_set(plist, H5O_XFER_HIGH_KEY_BUF_NAME, &high_key) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_prefetch_range() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_checksum
*
* Purpose: Modify the dataset transfer property list to set a
* checksum value for the data to be transfered.
* This is used with write operations.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_checksum(hid_t dxpl_id, uint64_t cs)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIl", dxpl_id, cs);
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
if(H5P_set(plist, H5D_XFER_CHECKSUM_NAME, &cs) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set checksum value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_checksum() */
/*-------------------------------------------------------------------------
* Function: H5Pget_dxpl_checksum
*
* Purpose: Retrieve the checksum value that was set using
* H5Pset_dxpl_checksum.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_dxpl_checksum(hid_t dxpl_id, uint64_t *cs/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, cs);
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Get the transfer mode */
if(cs)
if(H5P_get(plist, H5D_XFER_CHECKSUM_NAME, cs) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get checksum value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dxpl_checksum() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_checksum_ptr
*
* Purpose: Set a pointer to tell the library where to insert the
* checksum that is received from a remote location.
* This is used with read operations.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_checksum_ptr(hid_t dxpl_id, uint64_t *cs)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Il", dxpl_id, cs);
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
if(H5P_set(plist, H5D_XFER_CHECKSUM_PTR_NAME, &cs) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set checksum_ptr value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_checksum_ptr() */
/*-------------------------------------------------------------------------
* Function: H5Pget_dxpl_checksum_ptr
*
* Purpose: Retrieve the checksum pointer value that was set using
* H5Pset_dxpl_checksum_ptr.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_dxpl_checksum_ptr(hid_t dxpl_id, uint64_t **cs/*out*/)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, cs);
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Get the transfer mode */
if(cs)
if(H5P_get(plist, H5D_XFER_CHECKSUM_PTR_NAME, *cs) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get checksum_ptr value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dxpl_checksum_ptr() */
/*-------------------------------------------------------------------------
* Function: H5Pset_metadata_integrity_scope
*
* Purpose: Set the scope of checksum generation and verification for
* metadata in the FF stack. This is a file access property so the
* property is set on a particular container. Changing the property
* would require closing the file and reopening it. Possible values
* for this property are:
* H5_CHECKSUM_NONE = No metadata checksuming and verification
is done at any part of the stack.
* H5_CHECKSUM_TRANSFER = Metadata is verified after being transfered
through Mercury.
* H5_CHECKSUM_IOD = Metadata is checksumed and the checksum is
given to IOD when written, and verified when read.
* H5_CHECKSUM_MEMORY = Metadata is verified when moved in memory
(Not currently supported).
* H5_CHECKSUM_ALL = Metadata is checksumed and verified on all levels.
*
* Note that the property value is a bitflag so any combination can be
* set for individual values using OR operation.
*
* Return: Non-negative
* on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* September 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_metadata_integrity_scope(hid_t fapl_id, uint32_t scope)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", fapl_id, scope);
if(scope > H5_CHECKSUM_ALL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid scope for Data Integrity");
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Set property */
if(H5P_set(plist, H5VL_CS_BITFLAG_NAME, &scope) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data integrity scope");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_metadata_integrity_scope() */
/*-------------------------------------------------------------------------
* Function: H5Pget_metadata_integrity_scope
*
* Purpose: Get the current bit flag indicating the data integrity scope.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* September 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_metadata_integrity_scope(hid_t fapl_id, uint32_t *scope)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Iu", fapl_id, scope);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
if(scope) {
/* Get property */
if(H5P_get(plist, H5VL_CS_BITFLAG_NAME, scope) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks");
}
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_metadata_integrity_scope() */
/*-------------------------------------------------------------------------
* Function: H5Pset_rawdata_integrity_scope
*
* Purpose: Set the scope of checksum generation and verification for
* rawdata in the FF stack. This is a data transfer property so the
* property is set on a particular I/O operation (H5Dread/write,
* H5Mset/get, etc ...). Possible values for this property are:
* H5_CHECKSUM_NONE = No checksuming and verification
is done at any part of the stack.
* H5_CHECKSUM_TRANSFER = Data is verified after being transfered
through Mercury.
* H5_CHECKSUM_IOD = Data is checksumed and the checksum is
given to IOD when written, and verified when read.
* H5_CHECKSUM_MEMORY = Data is verified when moved in memory
* H5_CHECKSUM_ALL = Data is checksumed and verified on all levels.
*
* Note that the property value is a bitflag so any combination can be
* set for individual values using OR operation.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* September 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_rawdata_integrity_scope(hid_t dxpl_id, uint32_t scope)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", dxpl_id, scope);
if(scope > H5_CHECKSUM_ALL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid scope for Data Integrity");
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
/* Set property */
if(H5P_set(plist, H5VL_CS_BITFLAG_NAME, &scope) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data integrity scope");
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_rawdata_integrity_scope() */
/*-------------------------------------------------------------------------
* Function: H5Pget_rawdata_integrity_scope
*
* Purpose: Get the current bit flag indicating the data integrity scope.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* September 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_rawdata_integrity_scope(hid_t dxpl_id, uint32_t *scope)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Iu", dxpl_id, scope);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
if(scope) {
/* Get property */
if(H5P_get(plist, H5VL_CS_BITFLAG_NAME, scope) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks");
}
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_rawdata_integrity_scope() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_inject_corruption
*
* Purpose: Temporary routine to set a boolean flag that tells the
* library to inject corruption in the stack.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_inject_corruption(hid_t dxpl_id, hbool_t flag)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", dxpl_id, flag);
if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
if(H5P_set(plist, H5D_XFER_INJECT_CORRUPTION_NAME, &flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_inject_corruption() */
/*-------------------------------------------------------------------------
* Function: H5Pget_dxpl_inject_corruption
*
* Purpose: Temporary routine to retrieve the boolean flag that tells the
* library to inject corruption in the stack.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_dxpl_inject_corruption(hid_t dxpl_id, hbool_t *flag/*out*/)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, flag);
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Get the transfer mode */
if(flag)
if(H5P_get(plist, H5D_XFER_INJECT_CORRUPTION_NAME, flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dxpl_inject_corruption() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dcpl_append_only
*
* Purpose: Set a boolean flag on the dataset creation property list
* to indicate to the VOL plugin that access to this dataset
* will always be in an append/sequence only manner.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dcpl_append_only(hid_t dcpl_id, hbool_t flag)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", dcpl_id, flag);
if(dcpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
/* Set the transfer mode */
if(H5P_set(plist, H5D_CRT_APPEND_ONLY_NAME, &flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dcpl_append_only() */
/*-------------------------------------------------------------------------
* Function: H5Pget_dcpl_append_only
*
* Purpose: Retrieve a boolean flag on the dataset creation property list
* that indicates whether access to this dataset
* will always be in an append/sequence only manner.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Mohamad Chaarawi
* June, 2013
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_dcpl_append_only(hid_t dcpl_id, hbool_t *flag/*out*/)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dcpl_id, flag);
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
/* Get the transfer mode */
if(flag)
if(H5P_get(plist, H5D_CRT_APPEND_ONLY_NAME, flag) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dcpl_append_only() */
herr_t
H5Pset_dcpl_dim_layout(hid_t dcpl_id, H5FF_dset_dim_layout_t layout)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
if(H5P_set(plist, H5D_CRT_DIMS_ORDER_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
}
herr_t
H5Pget_dcpl_dim_layout(hid_t dcpl_id, H5FF_dset_dim_layout_t *layout)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
if(layout)
if(H5P_get(plist, H5D_CRT_DIMS_ORDER_NAME, layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
}
herr_t
H5Pset_dcpl_stripe_count(hid_t dcpl_id, size_t stripe_count)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iz", dcpl_id, stripe_count);
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
if(H5P_set(plist, H5D_CRT_STRIPE_COUNT_NAME, &stripe_count) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
}
herr_t
H5Pget_dcpl_stripe_count(hid_t dcpl_id, size_t *stripe_count)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*z", dcpl_id, stripe_count);
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
if(stripe_count)
if(H5P_get(plist, H5D_CRT_STRIPE_COUNT_NAME, stripe_count) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
}
herr_t
H5Pset_dcpl_stripe_size(hid_t dcpl_id, size_t stripe_size)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iz", dcpl_id, stripe_size);
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
if(H5P_set(plist, H5D_CRT_STRIPE_SIZE_NAME, &stripe_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
}
herr_t
H5Pget_dcpl_stripe_size(hid_t dcpl_id, size_t *stripe_size)
{
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*z", dcpl_id, stripe_size);
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl")
if(stripe_size)
if(H5P_get(plist, H5D_CRT_STRIPE_SIZE_NAME, stripe_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
}
#endif /* H5_HAVE_EFF */
|