1
2
3
4
5
6
7
8
9gd_flush(3) GETDATA gd_flush(3)
10
11
12
14 gd_flush gd_raw_close gd_sync — write all pending Dirfile changes to
15 disk or close open raw fields
16
17
19 #include <getdata.h>
20
21
22
23 int gd_flush(DIRFILE *dirfile, const char *field_code);
24
25 int gd_raw_close(DIRFILE *dirfile, const char *field_code);
26
27 int gd_sync(DIRFILE *dirfile, const char *field_code);
28
29
31 The gd_sync() function flushes all pending writes to disk of raw data
32 files associated with field_code, or its input(s), in the dirfile spec‐
33 ified by dirfile. If the field_code contains a valid representation
34 suffix, it will be ignored.
35
36 As a special case, if NULL is passed to gd_sync() as field_code, all
37 fields in dirfile will be flushed. In this special case, modified
38 metadata will also be flushed to disk as if gd_metaflush(3) had been
39 called. If the dirfile has been opened read-only, this function does
40 nothing. Additionally, some encoding schemes may implement this as a
41 NOP.
42
43 The gd_raw_close() function closes any raw data files which GetData has
44 opened associated with field_code, or its input(s). Again, if
45 field_code is NULL, all open data files are closed. The I/O pointer of
46 any RAW field which is closed is reset to the beginning-of-field.
47
48 Calling gd_flush() is essentially equivalent to calling first gd_sync()
49 and then gd_raw_close() (ie. it does both tasks), although, if
50 field_code is NULL, the order of operations if may be different than
51 making the two explicit calls.
52
53
55 On success, these functions return zero. On error, a negative-valued
56 error code is returned. Possible error codes are:
57
58 GD_E_ALLOC
59 The library was unable to allocate memory.
60
61 GD_E_BAD_CODE
62 The field specified by field_code was not found in the data‐
63 base.
64
65 GD_E_BAD_DIRFILE
66 The supplied dirfile was invalid.
67
68 GD_E_IO An I/O error occurred while trying to write modified data or
69 metadata to disk.
70
71 GD_E_LINE_TOO_LONG
72 While attempting to flush modified metadata to disk, a field
73 specification line exceeded the maximum allowed length. On
74 most platforms, the maximum length is at least 2**31 bytes, so
75 this typically indicates something pathological happening.
76
77 GD_E_RECURSE_LEVEL
78 Too many levels of recursion were encountered while trying to
79 resolve field_code. This usually indicates a circular depen‐
80 dency in field specification in the dirfile.
81
82 The error code is also stored in the DIRFILE object and may be re‐
83 trieved after this function returns by calling gd_error(3). A descrip‐
84 tive error string for the error may be obtained by calling
85 gd_error_string(3).
86
87
89 The dirfile_flush() function appeared in GetData-0.3.0.
90
91 In GetData-0.7.0, this function was renamed to gd_flush().
92
93 The gd_raw_close() and gd_sync() functions appeared in GetData-0.8.0.
94
95 In GetData-0.10.0, the error return from these functions changed from
96 -1 to a negative-valued error code.
97
98
100 gd_close(3), gd_dirfile_standards(3), gd_error(3), gd_error_string(3),
101 gd_metaflush(3), gd_open(3)
102
103
104
105Version 0.10.0 25 December 2016 gd_flush(3)