dpkg 1.21.11
fsys.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * fsys.h - filesystem nodes hash table
4 *
5 * Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
6 * Copyright © 2008-2014 Guillem Jover <guillem@debian.org>
7 *
8 * This is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef LIBDPKG_FSYS_H
23#define LIBDPKG_FSYS_H
24
25#include <stdio.h>
26
27#include <dpkg/file.h>
28
30
31/*
32 * Data structure here is as follows:
33 *
34 * For each package we have a ‘struct fsys_namenode_list *’, the head of a list of
35 * files in that package. They are in ‘forwards’ order. Each entry has a
36 * pointer to the ‘struct fsys_namenode’.
37 *
38 * The struct fsys_namenodes are in a hash table, indexed by name.
39 * (This hash table is not visible to callers.)
40 *
41 * Each fsys_namenode has a (possibly empty) list of ‘struct filepackage’,
42 * giving a list of the packages listing that filename.
43 *
44 * When we read files contained info about a particular package we set the
45 * ‘files’ member of the clientdata struct to the appropriate thing. When
46 * not yet set the files pointer is made to point to ‘fileslist_uninited’
47 * (this is available only internally, within filesdb.c - the published
48 * interface is ensure_*_available).
49 */
50
51struct pkginfo;
52
61};
62
84};
85
90 dev_t id_dev;
91 ino_t id_ino;
92};
93
96 const char *name;
99
106
108
109 /*
110 * Fields from here on are used by archives.c &c, and cleared by
111 * fsys_hash_init().
112 */
113
116
118 const char *oldhash;
119
121 const char *newhash;
122
124};
125
129};
130
136};
137
158 struct pkgset *pkgset;
159
162};
163
165struct fsys_node_pkgs_iter *
167struct pkginfo *
169void
171
172void
173fsys_hash_init(void);
174void
175fsys_hash_reset(void);
176void
178int
180
181struct fsys_hash_iter;
182struct fsys_hash_iter *
184struct fsys_namenode *
186void
188
189struct fsys_namenode *
190fsys_hash_find_node(const char *filename, enum fsys_hash_find_flags flags);
191
194};
195
196void
198 struct fsys_namenode_list *files);
199struct fsys_namenode *
201void
203
204const char *dpkg_fsys_set_dir(const char *dir);
205const char *dpkg_fsys_get_dir(void);
206char *dpkg_fsys_get_path(const char *pathpart);
207
209
210#endif /* LIBDPKG_FSYS_H */
struct fsys_namenode * fsys_hash_rev_iter_next(struct fsys_hash_rev_iter *iter)
Definition: fsys-iter.c:61
struct fsys_namenode * fsys_hash_iter_next(struct fsys_hash_iter *iter)
Definition: fsys-hash.c:179
struct pkginfo * fsys_node_pkgs_iter_next(struct fsys_node_pkgs_iter *iter)
Definition: fsys-iter.c:109
const char * dpkg_fsys_get_dir(void)
Get current on-disk filesystem root directory.
Definition: fsys-dir.c:95
void fsys_hash_init(void)
Definition: fsys-hash.c:44
void fsys_node_pkgs_iter_free(struct fsys_node_pkgs_iter *iter)
Definition: fsys-iter.c:123
fsys_namenode_flags
Definition: fsys.h:63
@ FNNF_NEW_CONFF
In the newconffiles list.
Definition: fsys.h:65
@ FNNF_ELIDE_OTHER_LISTS
Must remove from other packages' lists.
Definition: fsys.h:73
@ FNNF_FILTERED
Path being filtered.
Definition: fsys.h:81
@ FNNF_DEFERRED_RENAME
Definition: fsys.h:79
@ FNNF_OBS_CONFF
Obsolete conffile.
Definition: fsys.h:71
@ FNNF_RM_CONFF_ON_UPGRADE
Conffile removal requested by upgrade.
Definition: fsys.h:83
@ FNNF_OLD_CONFF
In the old package's conffiles list.
Definition: fsys.h:69
@ FNNF_DEFERRED_FSYNC
Definition: fsys.h:78
@ FNNF_NO_ATOMIC_OVERWRITE
>= 1 instance is a dir, cannot rename over.
Definition: fsys.h:75
@ FNNF_PLACED_ON_DISK
New file has been placed on the disk.
Definition: fsys.h:77
@ FNNF_NEW_INARCHIVE
In the new filesystem archive.
Definition: fsys.h:67
void fsys_hash_rev_iter_init(struct fsys_hash_rev_iter *iter, struct fsys_namenode_list *files)
Definition: fsys-iter.c:45
char * dpkg_fsys_get_path(const char *pathpart)
Get a pathname to the current on-disk filesystem root directory.
Definition: fsys-dir.c:114
void fsys_hash_report(FILE *file)
Definition: fsys-hash.c:119
struct fsys_node_pkgs_iter * fsys_node_pkgs_iter_new(struct fsys_namenode *fnn)
Definition: fsys-iter.c:98
void fsys_hash_reset(void)
Definition: fsys-hash.c:60
void fsys_hash_iter_free(struct fsys_hash_iter *iter)
Definition: fsys-hash.c:195
const char * dpkg_fsys_set_dir(const char *dir)
Set current on-disk filesystem root directory.
Definition: fsys-dir.c:69
void fsys_hash_rev_iter_abort(struct fsys_hash_rev_iter *iter)
Definition: fsys-iter.c:83
int fsys_hash_entries(void)
Definition: fsys-hash.c:67
fsys_hash_find_flags
Flags to fsys_hash_find_node().
Definition: fsys.h:56
@ FHFF_NOCOPY
Do not need to copy filename.
Definition: fsys.h:58
@ FHFF_NONE
The find function might return NULL.
Definition: fsys.h:60
struct fsys_hash_iter * fsys_hash_iter_new(void)
Definition: fsys-hash.c:167
struct fsys_namenode * fsys_hash_find_node(const char *filename, enum fsys_hash_find_flags flags)
Definition: fsys-hash.c:73
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_END_DECLS
Definition: macros.h:87
#define DPKG_BIT(n)
Return the integer value of bit n.
Definition: macros.h:125
Stores information to uniquely identify an on-disk file.
Definition: fsys.h:89
ino_t id_ino
Definition: fsys.h:91
dev_t id_dev
Definition: fsys.h:90
Definition: file.h:40
Definition: main.c:133
When we deal with an ‘overridden’ file, every package except the overriding one is considered to cont...
Definition: fsys.h:155
struct pkgset * pkgset
Definition: fsys.h:158
struct fsys_namenode * camefrom
Definition: fsys.h:157
struct fsys_namenode * useinstead
Definition: fsys.h:156
struct fsys_diversion * next
The ‘contested’ halves are in this list for easy cleanup.
Definition: fsys.h:161
Definition: fsys-hash.c:161
Definition: fsys.h:192
struct fsys_namenode_list * todo
Definition: fsys.h:193
Definition: fsys.h:126
struct fsys_namenode * namenode
Definition: fsys.h:128
struct fsys_namenode_list * next
Definition: fsys.h:127
Queue of fsys_namenode entries.
Definition: fsys.h:134
struct fsys_namenode_list ** tail
Definition: fsys.h:135
struct fsys_namenode_list * head
Definition: fsys.h:135
Definition: fsys.h:94
struct fsys_diversion * divert
Definition: fsys.h:98
struct file_ondisk_id * file_ondisk_id
Definition: fsys.h:123
const char * name
Definition: fsys.h:96
struct pkg_list * packages
Definition: fsys.h:97
struct file_stat * statoverride
We allow the administrator to override the owner, group and mode of a file.
Definition: fsys.h:105
struct trigfileint * trig_interested
Definition: fsys.h:107
const char * newhash
Valid iff the file was unpacked and hashed on this run.
Definition: fsys.h:121
enum fsys_namenode_flags flags
Set to zero when a new node is created.
Definition: fsys.h:115
struct fsys_namenode * next
Definition: fsys.h:95
const char * oldhash
Valid iff this namenode is in the newconffiles list.
Definition: fsys.h:118
Definition: fsys-iter.c:93
Definition: pkg-list.h:34
Node describing an architecture package instance.
Definition: dpkg-db.h:198
Node describing a package set sharing the same package name.
Definition: dpkg-db.h:245
Definition: triglib.h:54