1dirfile_close(3) GETDATA dirfile_close(3)
2
3
4
6 dirfile_close, dirfile_discard — close a dirfile and free associated
7 memory.
8
10 #include <getdata.h>
11
12 int dirfile_close(DIRFILE *dirfile);
13
14 int dirfile_discard(DIRFILE *dirfile);
15
17 The dirfile_close() function first calls dirfile_flush(3) to flush all
18 metadata changes to disk and to close all file handles associated with
19 dirfile. It then frees memory associated with the DIRFILE object. If
20 dirfile is NULL, nothing happens, and the call succeeds.
21
22 The dirfile_discard() function behaves similarly, except modified meta‐
23 data is not written to disk, but simply discarded. In order to ensure
24 that modified data files associated with RAW fields are properly termi‐
25 nated, changes to RAW data files are still flushed to disk by this
26 function. If dirfile was opened in read-only mode, dirfile_discard()
27 and dirfile_close() behave identically.
28
29 One of these functions should be called on all pointers returned by
30 dirfile_cbopen(3) and dirfile_open(3), even if the call to those func‐
31 tion failed. After dirfile_close() or dirfile_discard() returns suc‐
32 cessfully, the pointer dirfile should be considered invalid.
33
35 dirfile_close() and dirfile_discard() return zero on success. On er‐
36 ror, they do not deallocate dirfile and set the dirfile error to a non-
37 zero error value. Possible error values are:
38
39 GD_E_RAW_IO
40 An error occurred while trying to flush or close one or more
41 open raw files. In this case, another call to dirfile_close()
42 or dirfile_discard() may be attempted.
43
44 The dirfile error may be retrieved by calling get_error(3). A descrip‐
45 tive error string for the last error encountered can be obtained from a
46 call to get_error_string(3).
47
49 dirfile_open(3), dirfile_flush(3), get_error(3), get_error_string(3)
50
51
52
53Version 0.6.0 6 October 2009 dirfile_close(3)