rpm  4.14.0
rpmfiles.h
Go to the documentation of this file.
1 #ifndef _RPMFILES_H
2 #define _RPMFILES_H
3 
8 #include <sys/types.h>
9 #include <sys/stat.h>
10 #include <unistd.h>
11 
12 #include <rpm/rpmtypes.h>
13 #include <rpm/rpmvf.h>
14 #include <rpm/rpmpgp.h>
15 
23 typedef enum rpmFileTypes_e {
24  PIPE = 1,
25  CDEV = 2,
26  XDIR = 4,
27  BDEV = 6,
28  REG = 8,
29  LINK = 10,
30  SOCK = 12
31 } rpmFileTypes;
32 
36 typedef enum rpmfileState_e {
37  RPMFILE_STATE_MISSING = -1, /* used for unavailable data */
43 } rpmfileState;
44 
45 #define RPMFILE_IS_INSTALLED(_x) ((_x) == RPMFILE_STATE_NORMAL || (_x) == RPMFILE_STATE_NETSHARED)
46 
52  RPMFILE_CONFIG = (1 << 0),
53  RPMFILE_DOC = (1 << 1),
54  RPMFILE_ICON = (1 << 2),
55  RPMFILE_MISSINGOK = (1 << 3),
56  RPMFILE_NOREPLACE = (1 << 4),
57  RPMFILE_SPECFILE = (1 << 5),
58  RPMFILE_GHOST = (1 << 6),
59  RPMFILE_LICENSE = (1 << 7),
60  RPMFILE_README = (1 << 8),
61  /* bits 9-10 unused */
62  RPMFILE_PUBKEY = (1 << 11),
63 };
64 
66 
67 #define RPMFILE_ALL ~(RPMFILE_NONE)
68 
72 typedef enum rpmFileAction_e {
73  FA_UNKNOWN = 0,
74  FA_CREATE = 1,
75  FA_COPYIN = 2,
76  FA_COPYOUT = 3,
77  FA_BACKUP = 4,
78  FA_SAVE = 5,
79  FA_SKIP = 6,
80  FA_ALTNAME = 7,
81  FA_ERASE = 8,
84  FA_SKIPCOLOR = 11,
85  FA_TOUCH = 12,
86  /* bits 16-31 reserved */
88 
89 #define XFA_SKIPPING(_a) \
90  ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
91 
96  char * oldPath;
97  char * newPath;
98 };
99 
102  RPMFI_KEEPHEADER = (1 << 0),
103  RPMFI_NOFILECLASS = (1 << 1),
104  RPMFI_NOFILEDEPS = (1 << 2),
105  RPMFI_NOFILELANGS = (1 << 3),
106  RPMFI_NOFILEUSER = (1 << 4),
107  RPMFI_NOFILEGROUP = (1 << 5),
108  RPMFI_NOFILEMODES = (1 << 6),
109  RPMFI_NOFILESIZES = (1 << 7),
110  RPMFI_NOFILECAPS = (1 << 8),
112  RPMFI_NOFILEDIGESTS = (1 << 10),
113  RPMFI_NOFILEMTIMES = (1 << 11),
114  RPMFI_NOFILERDEVS = (1 << 12),
115  RPMFI_NOFILEINODES = (1 << 13),
116  RPMFI_NOFILESTATES = (1 << 14),
117  RPMFI_NOFILECOLORS = (1 << 15),
119  RPMFI_NOFILEFLAGS = (1 << 17),
121 };
122 
124 
125 #define RPMFI_FLAGS_ERASE \
126  (RPMFI_NOFILECLASS | RPMFI_NOFILELANGS | \
127  RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | RPMFI_NOFILEINODES | \
128  RPMFI_NOFILEVERIFYFLAGS)
129 
130 #define RPMFI_FLAGS_INSTALL \
131  (RPMFI_NOFILECLASS | RPMFI_NOFILEVERIFYFLAGS)
132 
133 #define RPMFI_FLAGS_VERIFY \
134  (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
135  RPMFI_NOFILECOLORS)
136 
137 #define RPMFI_FLAGS_QUERY \
138  (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
139  RPMFI_NOFILECOLORS | RPMFI_NOFILEVERIFYFLAGS)
140 
141 #define RPMFI_FLAGS_ONLY_FILENAMES \
142  (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
143  RPMFI_NOFILEUSER | RPMFI_NOFILEGROUP | RPMFI_NOFILEMODES | \
144  RPMFI_NOFILESIZES | RPMFI_NOFILECAPS | RPMFI_NOFILELINKTOS | \
145  RPMFI_NOFILEDIGESTS | RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | \
146  RPMFI_NOFILEINODES | RPMFI_NOFILESTATES | RPMFI_NOFILECOLORS | \
147  RPMFI_NOFILEVERIFYFLAGS | RPMFI_NOFILEFLAGS)
148 
149 typedef enum rpmFileIter_e {
157 } rpmFileIter;
158 
159 #define RPMFILEITERMAX 6
160 
161 #ifdef __cplusplus
162 extern "C" {
163 #endif
164 
173 rpmfiles rpmfilesNew(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags);
174 
181 
188 
195 
202 
211 int rpmfilesFindFN(rpmfiles files, const char * fn);
212 
221 int rpmfilesFindOFN(rpmfiles files, const char * fn);
222 
223 rpmfi rpmfilesIter(rpmfiles files, int itype);
224 
231 
238 
247 int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix);
248 
255 const char * rpmfilesBN(rpmfiles fi, int ix);
256 
268 const char * rpmfilesDN(rpmfiles fi, int jx);
269 
276 int rpmfilesDI(rpmfiles fi, int ix);
277 
284 char * rpmfilesFN(rpmfiles fi, int ix);
285 
292 int rpmfilesODI(rpmfiles fi, int ix);
293 
300 const char * rpmfilesOBN(rpmfiles fi, int ix);
301 
313 const char * rpmfilesODN(rpmfiles fi, int jx);
314 
321 char * rpmfilesOFN(rpmfiles fi, int ix);
322 
330 
338 
345 const char * rpmfilesFLink(rpmfiles fi, int ix);
346 
353 rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix);
354 
362 
369 const char * rpmfilesFClass(rpmfiles fi, int ix);
370 
378 uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t ** fddictp);
379 
386 uint32_t rpmfilesFNlink(rpmfiles fi, int ix);
387 
396 uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int ** files);
397 
404 const char * rpmfilesFLangs(rpmfiles fi, int ix);
405 
412 rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix);
413 
420 rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix);
421 
430 const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len);
431 
439 const unsigned char * rpmfilesFSignature(rpmfiles fi, int ix, size_t *len);
440 
447 rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix);
448 
455 rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix);
456 
464 
471 const char * rpmfilesFUser(rpmfiles fi, int ix);
472 
479 const char * rpmfilesFGroup(rpmfiles fi, int ix);
480 
489 const char * rpmfilesFCaps(rpmfiles fi, int ix);
490 
499 int rpmfilesStat(rpmfiles fi, int ix, int flags, struct stat *sb);
500 
509 
510 #ifdef __cplusplus
511 }
512 #endif
513 
514 #endif /* _RPMFILES_H */
Definition: rpmfiles.h:24
rpm_color_t rpmfilesFColor(rpmfiles fi, int ix)
Return file color bits from file info set.
const char * rpmfilesFGroup(rpmfiles fi, int ix)
Return file group from file info set.
rpmFlags rpmVerifyAttrs
Definition: rpmvf.h:41
rpm_count_t rpmfilesDC(rpmfiles fi)
Return directory count from file info set.
const char * rpmfilesODN(rpmfiles fi, int jx)
Return original directory name from file info set.
char * oldPath
Definition: rpmfiles.h:96
rpm_time_t rpmfilesFMtime(rpmfiles fi, int ix)
Return file modify time from file info set.
uint16_t rpm_rdev_t
Definition: rpmtypes.h:54
rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix)
Return file inode from file info set.
Definition: rpmfiles.h:27
uint32_t rpm_time_t
Definition: rpmtypes.h:52
const char * rpmfilesFCaps(rpmfiles fi, int ix)
Return textual representation of file capabilities from file info set.
rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix)
Return file rdev from file info set.
rpmfi rpmfilesIter(rpmfiles files, int itype)
enum rpmFileAction_e rpmFileAction
File disposition(s) during package install/erase transaction.
char * newPath
Definition: rpmfiles.h:97
Definition: rpmfiles.h:26
Definition: rpmfiles.h:28
enum rpmFileTypes_e rpmFileTypes
File types.
enum rpmFileIter_e rpmFileIter
rpmFileTypes_e
File types.
Definition: rpmfiles.h:23
Definition: rpmfiles.h:30
const char * rpmfilesFLink(rpmfiles fi, int ix)
Return file linkto (i.e.
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:95
Definition: rpmfiles.h:29
rpmfileState rpmfilesFState(rpmfiles fi, int ix)
Return file state from file info set.
int rpmfilesODI(rpmfiles fi, int ix)
Return original directory index from file info set.
int rpmfilesDI(rpmfiles fi, int ix)
Return directory index from file info set.
struct rpmfi_s * rpmfi
Definition: rpmtypes.h:66
uint32_t rpmFlags
Definition: rpmtypes.h:42
struct rpmstrPool_s * rpmstrPool
Definition: rpmtypes.h:83
rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix)
Return file mode from file info set.
uint32_t rpm_color_t
Definition: rpmtypes.h:38
uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int **files)
Return (calculated) file nlink count from file info set.
int rpmfilesStat(rpmfiles fi, int ix, int flags, struct stat *sb)
Map file stat(2) info.
rpmFlags rpmfiFlags
Definition: rpmfiles.h:123
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
enum rpmfileState_e rpmfileState
File States (when installed).
int rpmfilesDigestAlgo(rpmfiles fi)
Return digest algorithm of a file info set.
rpmfileAttrs_e
Exported File Attributes (ie RPMTAG_FILEFLAGS)
Definition: rpmfiles.h:50
uint32_t rpm_count_t
Definition: rpmtypes.h:29
int rpmfilesFindFN(rpmfiles files, const char *fn)
Return file index of the given file name or -1 if file is not in the rpmfi.
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
const char * rpmfilesDN(rpmfiles fi, int jx)
Return directory name from file info set.
const unsigned char * rpmfilesFSignature(rpmfiles fi, int ix, size_t *len)
Return file (binary) digest of file info set.
rpmfiles rpmfilesFree(rpmfiles fi)
Destroy a file info set.
const char * rpmfilesFUser(rpmfiles fi, int ix)
Return file owner from file info set.
char * rpmfilesFN(rpmfiles fi, int ix)
Return file name from file info set.
const char * rpmfilesBN(rpmfiles fi, int ix)
Return base name from file info set.
rpmFileAction_e
File disposition(s) during package install/erase transaction.
Definition: rpmfiles.h:72
rpmfileState_e
File States (when installed).
Definition: rpmfiles.h:36
const char * rpmfilesFLangs(rpmfiles fi, int ix)
Return file language(s) from file info set.
rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix)
Return file flags from file info set.
rpmVerifyAttrs rpmfilesVFlags(rpmfiles fi, int ix)
Return file verify flags from file info set.
uint32_t rpmfilesFNlink(rpmfiles fi, int ix)
Return (calculated) file nlink count from file info set.
const char * rpmfilesOBN(rpmfiles fi, int ix)
Return original base name from file info set.
int rpmfilesFindOFN(rpmfiles files, const char *fn)
Return file index of the given original file name or -1 if file is not in the rpmfi.
rpmfiles rpmfilesNew(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags)
Create and load a file info set.
rpmVerifyAttrs rpmfilesVerify(rpmfiles fi, int ix, rpmVerifyAttrs omitMask)
Verify file attributes (including digest).
Definition: rpmfiles.h:25
rpmFileIter_e
Definition: rpmfiles.h:149
rpm_color_t rpmfilesColor(rpmfiles files)
Return union of all file color bits from file info set.
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:65
uint16_t rpm_mode_t
Definition: rpmtypes.h:53
uint32_t rpm_ino_t
Definition: rpmtypes.h:56
rpm_count_t rpmfilesFC(rpmfiles fi)
Return file count from file info set.
rpmfiFlags_e
Definition: rpmfiles.h:100
uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t **fddictp)
Return file depends dictionary from file info set.
char * rpmfilesOFN(rpmfiles fi, int ix)
Return original file name from file info set.
const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len)
Return file (binary) digest of file info set.
struct rpmfiles_s * rpmfiles
Definition: rpmtypes.h:67
rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix)
Return file size from file info set.
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
rpmfiles rpmfilesLink(rpmfiles fi)
Reference a file info set instance.
int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix)
Return file info comparison.
const char * rpmfilesFClass(rpmfiles fi, int ix)
Return file class from file info set.