1dirfile_move(3) GETDATA dirfile_move(3)
2
3
4
6 dirfile_move — move a dirfile field between format file fragments
7
9 #include <getdata.h>
10
11 int dirfile_move(DIRFILE *dirfile, const char *field_code, int
12 new_fragment, int move_data);
13
15 The dirfile_move() function transfers the field specified by
16 field_code, which should not have a representation suffix, defined in
17 the dirfile specified by dirfile from it's current format file fragment
18 to the fragment index by new_fragment. If the field is already defined
19 in the fragment index by new_fragment, this function does nothing.
20
21 If the flag move_data is non-zero, and field_code specifies a RAW
22 field, the binary file associated with the field will be translated to
23 account for the possibly different encoding, endianness, and frame off‐
24 set of the new format file fragment. It will also be moved to a new
25 directory, if necessary. If move_data is zero, no changes will be made
26 to the binary file. If field_code specifies a field of type other than
27 RAW, the move_data flag is ignored.
28
29 If the binary file is translated, and the frame offset of the destina‐
30 tion fragment is larger than that of the source fragment, this will re‐
31 sult in permanent deletion of data from the database. If the new frame
32 offset is smaller than the old frame offset, the binary file will be
33 padded at the front with zeroes.
34
35
37 On success, dirfile_move() returns zero. On error, -1 is returned and
38 the dirfile error is set to a non-zero error value. Possible error
39 values are:
40
41 GD_E_ACCMODE
42 The specified dirfile was opened read-only.
43
44 GD_E_ALLOC
45 The library was unable to allocate memory.
46
47 GD_E_BAD_CODE
48 The field specified by field_code was not found.
49
50 GD_E_BAD_DIRFILE
51 The supplied dirfile was invalid.
52
53 GD_E_BAD_FIELD_TYPE
54 An attempt was made to move the immutable INDEX field.
55
56 GD_E_BAD_INDEX
57 The new_fragment argument did not index a valid format file
58 fragment.
59
60 GD_E_PROTECTED
61 The metadata of the source or destination format file fragments
62 was protected from change, or the binary data of the source or
63 destination fragments was protected from change and binary file
64 translation was requested.
65
66 GD_E_RAW_IO
67 An I/O error occurred while attempting to translate a binary
68 file.
69
70 GD_E_UNKNOWN_ENCODING
71 The encoding scheme of the source or destination fragment is
72 unknown.
73
74 GD_E_UNSUPPORTED
75 The encoding scheme of the source or destination fragment does
76 not support binary file translation.
77
78 The dirfile error may be retrieved by calling get_error(3). A descrip‐
79 tive error string for the last error encountered can be obtained from a
80 call to get_error_string(3).
81
83 A binary file translation occurs out-of-place. As a result, sufficient
84 space must be present on the filesystem for both the binary file before
85 translation and the binary file after translation.
86
88 dirfile_metaflush(3), dirfile_open(3), get_error(3), get_er‐
89 ror_string(3), dirfile(5), dirfile-format(5)
90
91
92
93Version 0.6.0 19 October 2009 dirfile_move(3)