1dirfile_protect(3) GETDATA dirfile_protect(3)
2
3
4
6 dirfile_protect — modify the protection level of a dirfile fragment
7
9 #include <getdata.h>
10
11 int dirfile_protect(DIRFILE *dirfile, int protection_level, int
12 fragment_index);
13
15 The dirfile_protect() function sets the advisory protection level of
16 the format file fragment specified by fragment_index to protection_lev‐
17 el in the dirfile(5) database specified by dirfile.
18
19 The protection_level argument should be one of the following:
20
21 GD_PROTECT_NONE
22 Indicating that the fragment should not be protected at all.
23
24 GD_PROTECT_FORMAT
25 Indicating that the fragment's metadata should be protected.
26
27 GD_PROTECT_DATA
28 Indicating that the fragment's binary data should be protected.
29
30 GD_PROTECT_ALL
31 Indicating that both the fragment's metadata and its binary data
32 should be protected. This symbol is equivalent to the bitwise
33 or of GD_PROTECT_FORMAT and GD_PROTECT_DATA.
34
35 In addition to being simply a valid fragment index, fragment_index may
36 also be the special value GD_ALL_FRAGMENTS, which indicates that the
37 protection level of all fragments in the database should be changed.
38
39
41 Upon successful completion, dirfile_protect() returns zero. On error,
42 it returns -1 and sets the dirfile error to a non-zero error value.
43 Possible error values are:
44
45 GD_E_ACCMODE
46 The specified dirfile was opened read-only.
47
48 GD_E_BAD_DIRFILE
49 The supplied dirfile was invalid.
50
51 GD_E_BAD_INDEX
52 The supplied index was out of range.
53
54 GD_E_BAD_PROTECTION
55 The supplied protection level was invalid.
56
57 The dirfile error may be retrieved by calling get_error(3). A descrip‐
58 tive error string for the last error encountered can be obtained from a
59 call to get_error_string(3).
60
62 This is the only GetData function which ignores the (existing) protec‐
63 tion level of a format file fragment.
64
66 dirfile_open(3), getdata(3), get_error(3), get_error_string(3),
67 get_protection(3), dirfile(5), dirfile-format(5)
68
69
70
71Version 0.5.0 15 December 2008 dirfile_protect(3)