summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2018-11-20 04:54:31 +0100
committerGuillem Jover <guillem@debian.org>2019-01-22 13:41:54 +0100
commitf7e9dc18083d5677a633db108c209675e7602417 (patch)
tree63c3f7924436a2cb1be2d7f6b950951f99e62ea2 /lib
parent9e5750015bd6187c8612380015924b82ad6739ac (diff)
downloaddpkg-f7e9dc18083d5677a633db108c209675e7602417.tar.gz
libdpkg: Cleanup fsys module symbol names
Diffstat (limited to 'lib')
-rw-r--r--lib/dpkg/db-fsys-digest.c10
-rw-r--r--lib/dpkg/db-fsys-divert.c8
-rw-r--r--lib/dpkg/db-fsys-files.c12
-rw-r--r--lib/dpkg/db-fsys-override.c12
-rw-r--r--lib/dpkg/db-fsys.h12
-rw-r--r--lib/dpkg/dpkg-db.h2
-rw-r--r--lib/dpkg/fsys-hash.c36
-rw-r--r--lib/dpkg/fsys-iter.c36
-rw-r--r--lib/dpkg/fsys.h165
-rw-r--r--lib/dpkg/libdpkg.map24
-rw-r--r--lib/dpkg/pkg-files.c10
-rw-r--r--lib/dpkg/pkg-files.h6
-rw-r--r--lib/dpkg/t/t-fsys-hash.c38
-rw-r--r--lib/dpkg/t/t-pkg-hash.c4
-rw-r--r--lib/dpkg/triglib.c10
-rw-r--r--lib/dpkg/triglib.h20
16 files changed, 204 insertions, 201 deletions
diff --git a/lib/dpkg/db-fsys-digest.c b/lib/dpkg/db-fsys-digest.c
index d5f11ffea..5b32d9179 100644
--- a/lib/dpkg/db-fsys-digest.c
+++ b/lib/dpkg/db-fsys-digest.c
@@ -39,12 +39,12 @@
#include <dpkg/db-fsys.h>
/*
- * If mask is nonzero, will not write any file whose filenamenode
+ * If mask is nonzero, will not write any file whose fsys_namenode
* has any flag bits set in mask.
*/
void
write_filehash_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
- struct fileinlist *list, enum filenamenode_flags mask)
+ struct fsys_namenode_list *list, enum fsys_namenode_flags mask)
{
struct atomic_file *file;
const char *hashfile;
@@ -60,7 +60,7 @@ write_filehash_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
atomic_file_open(file);
for (; list; list = list->next) {
- struct filenamenode *namenode = list->namenode;
+ struct fsys_namenode *namenode = list->namenode;
if (mask && (namenode->flags & mask))
continue;
@@ -88,7 +88,7 @@ parse_filehash_buffer(struct varbuf *buf,
const char *buf_end = buf->buf + buf->used;
for (thisline = buf->buf; thisline < buf_end; thisline = nextline) {
- struct filenamenode *namenode;
+ struct fsys_namenode *namenode;
char *endline, *hash_end, *filename;
endline = memchr(thisline, '\n', buf_end - thisline);
@@ -125,7 +125,7 @@ parse_filehash_buffer(struct varbuf *buf,
thisline, filename);
/* Add the file to the list. */
- namenode = findnamenode(filename, 0);
+ namenode = fsys_hash_find_node(filename, 0);
namenode->newhash = nfstrsave(thisline);
}
}
diff --git a/lib/dpkg/db-fsys-divert.c b/lib/dpkg/db-fsys-divert.c
index b0edd1805..985ed1bbe 100644
--- a/lib/dpkg/db-fsys-divert.c
+++ b/lib/dpkg/db-fsys-divert.c
@@ -39,7 +39,7 @@
#include <dpkg/debug.h>
#include <dpkg/db-fsys.h>
-static struct diversion *diversions = NULL;
+static struct fsys_diversion *diversions = NULL;
static char *diversionsname;
void
@@ -50,7 +50,7 @@ ensure_diversions(void)
char linebuf[MAXDIVERTFILENAME];
static FILE *file_prev;
FILE *file;
- struct diversion *ov, *oicontest, *oialtname;
+ struct fsys_diversion *ov, *oicontest, *oialtname;
if (diversionsname == NULL)
diversionsname = dpkg_db_get_path(DIVERSIONSFILE);
@@ -104,11 +104,11 @@ ensure_diversions(void)
oicontest = nfmalloc(sizeof(*oicontest));
oialtname = nfmalloc(sizeof(*oialtname));
- oialtname->camefrom = findnamenode(linebuf, 0);
+ oialtname->camefrom = fsys_hash_find_node(linebuf, 0);
oialtname->useinstead = NULL;
fgets_must(linebuf, sizeof(linebuf), file, diversionsname);
- oicontest->useinstead = findnamenode(linebuf, 0);
+ oicontest->useinstead = fsys_hash_find_node(linebuf, 0);
oicontest->camefrom = NULL;
fgets_must(linebuf, sizeof(linebuf), file, diversionsname);
diff --git a/lib/dpkg/db-fsys-files.c b/lib/dpkg/db-fsys-files.c
index 534109329..c944d5339 100644
--- a/lib/dpkg/db-fsys-files.c
+++ b/lib/dpkg/db-fsys-files.c
@@ -78,7 +78,7 @@ void
ensure_packagefiles_available(struct pkginfo *pkg)
{
const char *filelistfile;
- struct fileinlist **lendp;
+ struct fsys_namenode_list **lendp;
char *loaded_list_end, *thisline, *nextline, *ptr;
struct varbuf buf = VARBUF_INIT;
struct dpkg_error err = DPKG_ERROR_INIT;
@@ -122,7 +122,7 @@ ensure_packagefiles_available(struct pkginfo *pkg)
lendp = &pkg->files;
thisline = buf.buf;
while (thisline < loaded_list_end) {
- struct filenamenode *namenode;
+ struct fsys_namenode *namenode;
ptr = memchr(thisline, '\n', loaded_list_end - thisline);
if (ptr == NULL)
@@ -138,7 +138,7 @@ ensure_packagefiles_available(struct pkginfo *pkg)
pkg_name(pkg, pnaw_nonambig));
*ptr = '\0';
- namenode = findnamenode(thisline, 0);
+ namenode = fsys_hash_find_node(thisline, 0);
lendp = pkg_files_add_file(pkg, namenode, lendp);
thisline = nextline;
}
@@ -290,15 +290,15 @@ void ensure_allinstfiles_available_quiet(void) {
}
/*
- * If mask is nonzero, will not write any file whose filenamenode
+ * If mask is nonzero, will not write any file whose fsys_namenode
* has any flag bits set in mask.
*/
void
write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
- struct fileinlist *list, enum filenamenode_flags mask)
+ struct fsys_namenode_list *list, enum fsys_namenode_flags mask)
{
struct atomic_file *file;
- struct fileinlist *node;
+ struct fsys_namenode_list *node;
const char *listfile;
listfile = pkg_infodb_get_file(pkg, pkgbin, LISTFILE);
diff --git a/lib/dpkg/db-fsys-override.c b/lib/dpkg/db-fsys-override.c
index 8da3afc29..981bd1891 100644
--- a/lib/dpkg/db-fsys-override.c
+++ b/lib/dpkg/db-fsys-override.c
@@ -117,8 +117,8 @@ ensure_statoverrides(enum statdb_parse_flags flags)
FILE *file;
char *loaded_list, *loaded_list_end, *thisline, *nextline, *ptr;
struct file_stat *fso;
- struct filenamenode *fnn;
- struct fileiterator *iter;
+ struct fsys_namenode *fnn;
+ struct fsys_hash_iter *iter;
if (statoverridename == NULL)
statoverridename = dpkg_db_get_path(STATOVERRIDEFILE);
@@ -157,10 +157,10 @@ ensure_statoverrides(enum statdb_parse_flags flags)
file_prev = file;
/* Reset statoverride information. */
- iter = files_db_iter_new();
- while ((fnn = files_db_iter_next(iter)))
+ iter = fsys_hash_iter_new();
+ while ((fnn = fsys_hash_iter_next(iter)))
fnn->statoverride = NULL;
- files_db_iter_free(iter);
+ fsys_hash_iter_free(iter);
if (!file) {
onerr_abort--;
@@ -250,7 +250,7 @@ ensure_statoverrides(enum statdb_parse_flags flags)
if (thisline >= loaded_list_end)
ohshit(_("unexpected end of line in statoverride file"));
- fnn = findnamenode(thisline, 0);
+ fnn = fsys_hash_find_node(thisline, 0);
if (fnn->statoverride)
ohshit(_("multiple statoverrides present for file '%.250s'"),
thisline);
diff --git a/lib/dpkg/db-fsys.h b/lib/dpkg/db-fsys.h
index 35c971552..339a0fb45 100644
--- a/lib/dpkg/db-fsys.h
+++ b/lib/dpkg/db-fsys.h
@@ -28,14 +28,14 @@
/*
* Data structure here is as follows:
*
- * For each package we have a ‘struct fileinlist *’, the head of a list of
+ * For each package we have a ‘struct fsys_namenode_list *’, the head of a list of
* files in that package. They are in ‘forwards’ order. Each entry has a
- * pointer to the ‘struct filenamenode’.
+ * pointer to the ‘struct fsys_namenode’.
*
- * The struct filenamenodes are in a hash table, indexed by name.
+ * The struct fsys_namenodes are in a hash table, indexed by name.
* (This hash table is not visible to callers.)
*
- * Each filenamenode has a (possibly empty) list of ‘struct filepackage’,
+ * Each fsys_namenode has a (possibly empty) list of ‘struct filepackage’,
* giving a list of the packages listing that filename.
*
* When we read files contained info about a particular package we set the
@@ -68,8 +68,8 @@ void ensure_allinstfiles_available_quiet(void);
void note_must_reread_files_inpackage(struct pkginfo *pkg);
void parse_filehash(struct pkginfo *pkg, struct pkgbin *pkgbin);
void write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
- struct fileinlist *list, enum filenamenode_flags mask);
+ struct fsys_namenode_list *list, enum fsys_namenode_flags mask);
void write_filehash_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
- struct fileinlist *list, enum filenamenode_flags mask);
+ struct fsys_namenode_list *list, enum fsys_namenode_flags mask);
#endif /* LIBDPKG_DB_FSYS_H */
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index 8f34d6682..6ea525657 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -228,7 +228,7 @@ struct pkginfo {
* true !NULL Read, all is OK.
* true NULL Read OK, but, there were no files.
*/
- struct fileinlist *files;
+ struct fsys_namenode_list *files;
off_t files_list_phys_offs;
bool files_list_valid;
diff --git a/lib/dpkg/fsys-hash.c b/lib/dpkg/fsys-hash.c
index 9648d5bb1..cb173bb9a 100644
--- a/lib/dpkg/fsys-hash.c
+++ b/lib/dpkg/fsys-hash.c
@@ -37,13 +37,13 @@
* This is the closest one to 2^18 (262144). */
#define BINS 262139
-static struct filenamenode *bins[BINS];
+static struct fsys_namenode *bins[BINS];
static int nfiles = 0;
void
-filesdbinit(void)
+fsys_hash_init(void)
{
- struct filenamenode *fnn;
+ struct fsys_namenode *fnn;
int i;
for (i = 0; i < BINS; i++) {
@@ -57,7 +57,7 @@ filesdbinit(void)
}
void
-files_db_reset(void)
+fsys_hash_reset(void)
{
int i;
@@ -73,10 +73,10 @@ fsys_hash_entries(void)
return nfiles;
}
-struct filenamenode *
-findnamenode(const char *name, enum fnnflags flags)
+struct fsys_namenode *
+fsys_hash_find_node(const char *name, enum fsys_hash_find_flags flags)
{
- struct filenamenode **pointerp, *newnode;
+ struct fsys_namenode **pointerp, *newnode;
const char *orig_name = name;
/* We skip initial slashes and ‘./’ pairs, and add our own single
@@ -99,12 +99,12 @@ findnamenode(const char *name, enum fnnflags flags)
if (*pointerp)
return *pointerp;
- if (flags & fnn_nonew)
+ if (flags & FHFF_NONE)
return NULL;
newnode = nfmalloc(sizeof(*newnode));
newnode->packages = NULL;
- if ((flags & fnn_nocopy) && name > orig_name && name[-1] == '/') {
+ if ((flags & FHFF_NOCOPY) && name > orig_name && name[-1] == '/') {
newnode->name = name - 1;
} else {
char *newname = nfmalloc(strlen(name) + 2);
@@ -131,15 +131,15 @@ findnamenode(const char *name, enum fnnflags flags)
* Forward iterator.
*/
-struct fileiterator {
- struct filenamenode *namenode;
+struct fsys_hash_iter {
+ struct fsys_namenode *namenode;
int nbinn;
};
-struct fileiterator *
-files_db_iter_new(void)
+struct fsys_hash_iter *
+fsys_hash_iter_new(void)
{
- struct fileiterator *iter;
+ struct fsys_hash_iter *iter;
iter = m_malloc(sizeof(*iter));
iter->namenode = NULL;
@@ -148,10 +148,10 @@ files_db_iter_new(void)
return iter;
}
-struct filenamenode *
-files_db_iter_next(struct fileiterator *iter)
+struct fsys_namenode *
+fsys_hash_iter_next(struct fsys_hash_iter *iter)
{
- struct filenamenode *fnn = NULL;
+ struct fsys_namenode *fnn = NULL;
while (!iter->namenode) {
if (iter->nbinn >= BINS)
@@ -165,7 +165,7 @@ files_db_iter_next(struct fileiterator *iter)
}
void
-files_db_iter_free(struct fileiterator *iter)
+fsys_hash_iter_free(struct fsys_hash_iter *iter)
{
free(iter);
}
diff --git a/lib/dpkg/fsys-iter.c b/lib/dpkg/fsys-iter.c
index a5aa48be5..807aabbb0 100644
--- a/lib/dpkg/fsys-iter.c
+++ b/lib/dpkg/fsys-iter.c
@@ -32,7 +32,7 @@
#include "fsys.h"
/*
- * Reverse fileinlist iterator.
+ * Reverse iterator.
*/
/*
@@ -42,10 +42,10 @@
* it apart one entry at a time.
*/
void
-reversefilelist_init(struct reversefilelistiter *iter,
- struct fileinlist *files)
+fsys_hash_rev_iter_init(struct fsys_hash_rev_iter *iter,
+ struct fsys_namenode_list *files)
{
- struct fileinlist *newent;
+ struct fsys_namenode_list *newent;
iter->todo = NULL;
while (files) {
@@ -57,11 +57,11 @@ reversefilelist_init(struct reversefilelistiter *iter,
}
}
-struct filenamenode *
-reversefilelist_next(struct reversefilelistiter *iter)
+struct fsys_namenode *
+fsys_hash_rev_iter_next(struct fsys_hash_rev_iter *iter)
{
- struct filenamenode *next;
- struct fileinlist *todo;
+ struct fsys_namenode *next;
+ struct fsys_namenode_list *todo;
todo = iter->todo;
if (!todo)
@@ -74,15 +74,15 @@ reversefilelist_next(struct reversefilelistiter *iter)
}
/*
- * Clients must call this function to clean up the reversefilelistiter
+ * Clients must call this function to clean up the fsys_hash_rev_iter
* if they wish to break out of the iteration before it is all done.
- * Calling this function is not necessary if reversefilelist_next() has
+ * Calling this function is not necessary if fsys_hash_rev_iter_next() has
* been called until it returned 0.
*/
void
-reversefilelist_abort(struct reversefilelistiter *iter)
+fsys_hash_rev_iter_abort(struct fsys_hash_rev_iter *iter)
{
- while (reversefilelist_next(iter))
+ while (fsys_hash_rev_iter_next(iter))
;
}
@@ -90,14 +90,14 @@ reversefilelist_abort(struct reversefilelistiter *iter)
* Iterator for packages owning a file.
*/
-struct filepackages_iterator {
+struct fsys_node_pkgs_iter {
struct pkg_list *pkg_node;
};
-struct filepackages_iterator *
-filepackages_iter_new(struct filenamenode *fnn)
+struct fsys_node_pkgs_iter *
+fsys_node_pkgs_iter_new(struct fsys_namenode *fnn)
{
- struct filepackages_iterator *iter;
+ struct fsys_node_pkgs_iter *iter;
iter = m_malloc(sizeof(*iter));
iter->pkg_node = fnn->packages;
@@ -106,7 +106,7 @@ filepackages_iter_new(struct filenamenode *fnn)
}
struct pkginfo *
-filepackages_iter_next(struct filepackages_iterator *iter)
+fsys_node_pkgs_iter_next(struct fsys_node_pkgs_iter *iter)
{
struct pkg_list *pkg_node;
@@ -120,7 +120,7 @@ filepackages_iter_next(struct filepackages_iterator *iter)
}
void
-filepackages_iter_free(struct filepackages_iterator *iter)
+fsys_node_pkgs_iter_free(struct fsys_node_pkgs_iter *iter)
{
free(iter);
}
diff --git a/lib/dpkg/fsys.h b/lib/dpkg/fsys.h
index 72d76f715..67fce2ad2 100644
--- a/lib/dpkg/fsys.h
+++ b/lib/dpkg/fsys.h
@@ -27,14 +27,14 @@
/*
* Data structure here is as follows:
*
- * For each package we have a ‘struct fileinlist *’, the head of a list
- * of files in that package. They are in ‘forwards’ order. Each entry has
- * a pointer to the ‘struct filenamenode’.
+ * For each package we have a ‘struct fsys_namenode_list *’, the head of a list of
+ * files in that package. They are in ‘forwards’ order. Each entry has a
+ * pointer to the ‘struct fsys_namenode’.
*
- * The struct filenamenodes are in a hash table, indexed by name.
+ * The struct fsys_namenodes are in a hash table, indexed by name.
* (This hash table is not visible to callers.)
*
- * Each filenamenode has a (possibly empty) list of ‘struct filepackage’,
+ * Each fsys_namenode has a (possibly empty) list of ‘struct filepackage’,
* giving a list of the packages listing that filename.
*
* When we read files contained info about a particular package we set the
@@ -47,34 +47,34 @@
struct pkginfo;
/**
- * Flags to findnamenode().
+ * Flags to fsys_hash_find_node().
*/
-enum fnnflags {
+enum fsys_hash_find_flags {
/** Do not need to copy filename. */
- fnn_nocopy = DPKG_BIT(0),
- /** findnamenode may return NULL. */
- fnn_nonew = DPKG_BIT(1),
+ FHFF_NOCOPY = DPKG_BIT(0),
+ /** The find function might return NULL. */
+ FHFF_NONE = DPKG_BIT(1),
};
-enum filenamenode_flags {
+enum fsys_namenode_flags {
/** In the newconffiles list. */
- fnnf_new_conff = DPKG_BIT(0),
+ FNNF_NEW_CONFF = DPKG_BIT(0),
/** In the new filesystem archive. */
- fnnf_new_inarchive = DPKG_BIT(1),
+ FNNF_NEW_INARCHIVE = DPKG_BIT(1),
/** In the old package's conffiles list. */
- fnnf_old_conff = DPKG_BIT(2),
+ FNNF_OLD_CONFF = DPKG_BIT(2),
/** Obsolete conffile. */
- fnnf_obs_conff = DPKG_BIT(3),
+ FNNF_OBS_CONFF = DPKG_BIT(3),
/** Must remove from other packages' lists. */
- fnnf_elide_other_lists = DPKG_BIT(4),
+ FNNF_ELIDE_OTHER_LISTS = DPKG_BIT(4),
/** >= 1 instance is a dir, cannot rename over. */
- fnnf_no_atomic_overwrite = DPKG_BIT(5),
+ FNNF_NO_ATOMIC_OVERWRITE = DPKG_BIT(5),
/** New file has been placed on the disk. */
- fnnf_placed_on_disk = DPKG_BIT(6),
- fnnf_deferred_fsync = DPKG_BIT(7),
- fnnf_deferred_rename = DPKG_BIT(8),
+ FNNF_PLACED_ON_DISK = DPKG_BIT(6),
+ FNNF_DEFERRED_FSYNC = DPKG_BIT(7),
+ FNNF_DEFERRED_RENAME = DPKG_BIT(8),
/** Path being filtered. */
- fnnf_filtered = DPKG_BIT(9),
+ FNNF_FILTERED = DPKG_BIT(9),
};
/**
@@ -85,12 +85,11 @@ struct file_ondisk_id {
ino_t id_ino;
};
-struct filenamenode {
- struct filenamenode *next;
+struct fsys_namenode {
+ struct fsys_namenode *next;
const char *name;
-
struct pkg_list *packages;
- struct diversion *divert;
+ struct fsys_diversion *divert;
/** We allow the administrator to override the owner, group and mode
* of a file. If such an override is present we use that instead of
@@ -102,93 +101,97 @@ struct filenamenode {
struct trigfileint *trig_interested;
/*
- * Fields from here on are cleared by filesdbinit().
+ * Fields from here on are used by archives.c &c, and cleared by
+ * fsys_hash_init().
*/
/** Set to zero when a new node is created. */
- enum filenamenode_flags flags;
+ enum fsys_namenode_flags flags;
/** Valid iff this namenode is in the newconffiles list. */
const char *oldhash;
+
/** Valid iff the file was unpacked and hashed on this run. */
const char *newhash;
struct file_ondisk_id *file_ondisk_id;
};
+struct fsys_namenode_list {
+ struct fsys_namenode_list *next;
+ struct fsys_namenode *namenode;
+};
+
+/**
+ * Queue of fsys_namenode entries.
+ */
+struct fsys_namenode_queue {
+ struct fsys_namenode_list *head, **tail;
+};
+
/**
* When we deal with an ‘overridden’ file, every package except the
* overriding one is considered to contain the other file instead. Both
* files have entries in the filesdb database, and they refer to each other
* via these diversion structures.
*
- * The contested filename's filenamenode has an diversion entry with
- * useinstead set to point to the redirected filename's filenamenode; the
- * redirected filenamenode has camefrom set to the contested filenamenode.
+ * The contested filename's fsys_namenode has an diversion entry with
+ * useinstead set to point to the redirected filename's fsys_namenode; the
+ * redirected fsys_namenode has camefrom set to the contested fsys_namenode.
* Both sides' diversion entries will have pkg set to the package (if any)
* which is allowed to use the contended filename.
*
* Packages that contain either version of the file will all refer to the
- * contested filenamenode in their per-file package lists (both in core and
- * on disk). References are redirected to the other filenamenode's filename
+ * contested fsys_namenode in their per-file package lists (both in core and
+ * on disk). References are redirected to the other fsys_namenode's filename
* where appropriate.
*/
-struct diversion {
- struct filenamenode *useinstead;
- struct filenamenode *camefrom;
+struct fsys_diversion {
+ struct fsys_namenode *useinstead;
+ struct fsys_namenode *camefrom;
struct pkgset *pkgset;
/** The ‘contested’ halves are in this list for easy cleanup. */
- struct diversion *next;
+ struct fsys_diversion *next;
};
-struct fileinlist {
- struct fileinlist *next;
- struct filenamenode *namenode;
+struct fsys_node_pkgs_iter;
+struct fsys_node_pkgs_iter *
+fsys_node_pkgs_iter_new(struct fsys_namenode *fnn);
+struct pkginfo *
+fsys_node_pkgs_iter_next(struct fsys_node_pkgs_iter *iter);
+void
+fsys_node_pkgs_iter_free(struct fsys_node_pkgs_iter *iter);
+
+void
+fsys_hash_init(void);
+void
+fsys_hash_reset(void);
+int
+fsys_hash_entries(void);
+
+struct fsys_hash_iter;
+struct fsys_hash_iter *
+fsys_hash_iter_new(void);
+struct fsys_namenode *
+fsys_hash_iter_next(struct fsys_hash_iter *iter);
+void
+fsys_hash_iter_free(struct fsys_hash_iter *iter);
+
+struct fsys_namenode *
+fsys_hash_find_node(const char *filename, enum fsys_hash_find_flags flags);
+
+struct fsys_hash_rev_iter {
+ struct fsys_namenode_list *todo;
};
-/**
- * Queue of filenamenode entries.
- */
-struct filenamenode_queue {
- struct fileinlist *head, **tail;
-};
-
-/**
- * Forward filesystem node iterator.
- */
-struct fileiterator;
-
-/**
- * Reverse filesystem node iterator.
- */
-struct reversefilelistiter {
- struct fileinlist *todo;
-};
-
-/**
- * Forward filesystem node package owners iterator.
- */
-struct filepackages_iterator;
-
-
-void filesdbinit(void);
-void files_db_reset(void);
-int fsys_hash_entries(void);
-
-struct filenamenode *findnamenode(const char *filename, enum fnnflags flags);
-
-struct fileiterator *files_db_iter_new(void);
-struct filenamenode *files_db_iter_next(struct fileiterator *iter);
-void files_db_iter_free(struct fileiterator *iter);
-
-void reversefilelist_init(struct reversefilelistiter *iterptr, struct fileinlist *files);
-struct filenamenode *reversefilelist_next(struct reversefilelistiter *iterptr);
-void reversefilelist_abort(struct reversefilelistiter *iterptr);
-
-struct filepackages_iterator *filepackages_iter_new(struct filenamenode *fnn);
-struct pkginfo *filepackages_iter_next(struct filepackages_iterator *iter);
-void filepackages_iter_free(struct filepackages_iterator *iter);
+void
+fsys_hash_rev_iter_init(struct fsys_hash_rev_iter *iter,
+ struct fsys_namenode_list *files);
+struct fsys_namenode *
+fsys_hash_rev_iter_next(struct fsys_hash_rev_iter *iter);
+void
+fsys_hash_rev_iter_abort(struct fsys_hash_rev_iter *iter);
const char *dpkg_fsys_set_dir(const char *dir);
const char *dpkg_fsys_get_dir(void);
diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map
index 082732405..c337ee662 100644
--- a/lib/dpkg/libdpkg.map
+++ b/lib/dpkg/libdpkg.map
@@ -402,22 +402,22 @@ LIBDPKG_PRIVATE {
ensure_diversions;
# Filesystem node hash support
- filesdbinit;
- files_db_reset;
+ fsys_hash_init;
+ fsys_hash_reset;
fsys_hash_entries;
- findnamenode;
+ fsys_hash_find_node;
- files_db_iter_new;
- files_db_iter_next;
- files_db_iter_free;
+ fsys_hash_iter_new;
+ fsys_hash_iter_next;
+ fsys_hash_iter_free;
- reversefilelist_init;
- reversefilelist_next;
- reversefilelist_abort;
+ fsys_hash_rev_iter_init;
+ fsys_hash_rev_iter_next;
+ fsys_hash_rev_iter_abort;
- filepackages_iter_new;
- filepackages_iter_next;
- filepackages_iter_free;
+ fsys_node_pkgs_iter_new;
+ fsys_node_pkgs_iter_next;
+ fsys_node_pkgs_iter_free;
dpkg_fsys_set_dir;
dpkg_fsys_get_dir;
diff --git a/lib/dpkg/pkg-files.c b/lib/dpkg/pkg-files.c
index 349e63d4f..f02213270 100644
--- a/lib/dpkg/pkg-files.c
+++ b/lib/dpkg/pkg-files.c
@@ -35,7 +35,7 @@
void
pkg_files_blank(struct pkginfo *pkg)
{
- struct fileinlist *current;
+ struct fsys_namenode_list *current;
for (current = pkg->files;
current;
@@ -63,11 +63,11 @@ pkg_files_blank(struct pkginfo *pkg)
pkg->files = NULL;
}
-struct fileinlist **
-pkg_files_add_file(struct pkginfo *pkg, struct filenamenode *namenode,
- struct fileinlist **file_tail)
+struct fsys_namenode_list **
+pkg_files_add_file(struct pkginfo *pkg, struct fsys_namenode *namenode,
+ struct fsys_namenode_list **file_tail)
{
- struct fileinlist *newent;
+ struct fsys_namenode_list *newent;
struct pkg_list *pkg_node;
if (file_tail == NULL)
diff --git a/lib/dpkg/pkg-files.h b/lib/dpkg/pkg-files.h
index 73770b7dc..bee137a16 100644
--- a/lib/dpkg/pkg-files.h
+++ b/lib/dpkg/pkg-files.h
@@ -35,9 +35,9 @@ DPKG_BEGIN_DECLS
void
pkg_files_blank(struct pkginfo *pkg);
-struct fileinlist **
-pkg_files_add_file(struct pkginfo *pkg, struct filenamenode *namenode,
- struct fileinlist **file_tail);
+struct fsys_namenode_list **
+pkg_files_add_file(struct pkginfo *pkg, struct fsys_namenode *namenode,
+ struct fsys_namenode_list **file_tail);
/** @} */
diff --git a/lib/dpkg/t/t-fsys-hash.c b/lib/dpkg/t/t-fsys-hash.c
index 8d34d4807..d80dbe899 100644
--- a/lib/dpkg/t/t-fsys-hash.c
+++ b/lib/dpkg/t/t-fsys-hash.c
@@ -28,20 +28,20 @@
static void
test_fsys_nodes(void)
{
- struct filenamenode *fnn;
- struct fileiterator *iter;
+ struct fsys_namenode *fnn;
+ struct fsys_hash_iter *iter;
const char *name;
test_pass(fsys_hash_entries() == 0);
- filesdbinit();
+ fsys_hash_init();
- fnn = findnamenode("/nonexistent", fnn_nonew);
+ fnn = fsys_hash_find_node("/nonexistent", FHFF_NONE);
test_pass(fnn == NULL);
test_pass(fsys_hash_entries() == 0);
name = "/test/path/aa";
- fnn = findnamenode(name, fnn_nocopy);
+ fnn = fsys_hash_find_node(name, FHFF_NOCOPY);
test_pass(fnn != NULL);
test_pass(fsys_hash_entries() == 1);
test_pass(fnn->name == name);
@@ -50,7 +50,7 @@ test_fsys_nodes(void)
test_pass(fnn->oldhash == NULL);
test_str(fnn->newhash, ==, EMPTYHASHFLAG);
- fnn = findnamenode("//./test/path/bb", 0);
+ fnn = fsys_hash_find_node("//./test/path/bb", 0);
test_pass(fnn != NULL);
test_pass(fsys_hash_entries() == 2);
test_str(fnn->name, ==, "/test/path/bb");
@@ -58,7 +58,7 @@ test_fsys_nodes(void)
test_pass(fnn->oldhash == NULL);
test_str(fnn->newhash, ==, EMPTYHASHFLAG);
- fnn = findnamenode("/test/path/cc", 0);
+ fnn = fsys_hash_find_node("/test/path/cc", 0);
test_pass(fnn != NULL);
test_pass(fsys_hash_entries() == 3);
test_str(fnn->name, ==, "/test/path/cc");
@@ -66,8 +66,8 @@ test_fsys_nodes(void)
test_pass(fnn->oldhash == NULL);
test_str(fnn->newhash, ==, EMPTYHASHFLAG);
- iter = files_db_iter_new();
- while ((fnn = files_db_iter_next(iter))) {
+ iter = fsys_hash_iter_new();
+ while ((fnn = fsys_hash_iter_next(iter))) {
if (strcmp(fnn->name, "/test/path/aa") == 0)
test_str(fnn->name, ==, "/test/path/aa");
else if (strcmp(fnn->name, "/test/path/bb") == 0)
@@ -75,27 +75,27 @@ test_fsys_nodes(void)
else if (strcmp(fnn->name, "/test/path/cc") == 0)
test_str(fnn->name, ==, "/test/path/cc");
else
- test_fail("unknown filenamenode");
+ test_fail("unknown fsys_namenode");
}
- files_db_iter_free(iter);
+ fsys_hash_iter_free(iter);
- filesdbinit();
+ fsys_hash_init();
test_pass(fsys_hash_entries() == 3);
- fnn = findnamenode("/test/path/aa", fnn_nonew);
+ fnn = fsys_hash_find_node("/test/path/aa", FHFF_NONE);
test_pass(fnn != NULL);
- fnn = findnamenode("/test/path/bb", fnn_nonew);
+ fnn = fsys_hash_find_node("/test/path/bb", FHFF_NONE);
test_pass(fnn != NULL);
- fnn = findnamenode("/test/path/cc", fnn_nonew);
+ fnn = fsys_hash_find_node("/test/path/cc", FHFF_NONE);
test_pass(fnn != NULL);
test_pass(fsys_hash_entries() == 3);
- files_db_reset();
+ fsys_hash_reset();
test_pass(fsys_hash_entries() == 0);
- fnn = findnamenode("/test/path/aa", fnn_nonew);
+ fnn = fsys_hash_find_node("/test/path/aa", FHFF_NONE);
test_pass(fnn == NULL);
- fnn = findnamenode("/test/path/bb", fnn_nonew);
+ fnn = fsys_hash_find_node("/test/path/bb", FHFF_NONE);
test_pass(fnn == NULL);
- fnn = findnamenode("/test/path/cc", fnn_nonew);
+ fnn = fsys_hash_find_node("/test/path/cc", FHFF_NONE);
test_pass(fnn == NULL);
test_pass(fsys_hash_entries() == 0);
}
diff --git a/lib/dpkg/t/t-pkg-hash.c b/lib/dpkg/t/t-pkg-hash.c
index f45594f15..c6ab20e28 100644
--- a/lib/dpkg/t/t-pkg-hash.c
+++ b/lib/dpkg/t/t-pkg-hash.c
@@ -135,7 +135,7 @@ test_pkg_hash(void)
else if (strcmp(set->name, "pkg-cc") == 0)
test_str(set->name, ==, "pkg-cc");
else
- test_fail("unknown filenamenode");
+ test_fail("unknown fsys_namenode");
}
pkg_db_iter_free(iter);
@@ -160,7 +160,7 @@ test_pkg_hash(void)
} else if (strcmp(pkg->set->name, "pkg-cc") == 0) {
test_str(pkg->set->name, ==, "pkg-cc");
} else {
- test_fail("unknown filenamenode");
+ test_fail("unknown fsys_namenode");
}
}
pkg_db_iter_free(iter);
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index f7488ee61..ab9060f66 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -396,7 +396,7 @@ trk_file_interest_change(const char *trig, struct pkginfo *pkg,
struct pkgbin *pkgbin, int signum,
enum trig_options opts)
{
- struct filenamenode *fnn;
+ struct fsys_namenode *fnn;
struct trigfileint **search, *tfi;
fnn = trigh.namenode_find(trig, signum <= 0);
@@ -545,14 +545,14 @@ ok:
void
trig_file_activate_byname(const char *trig, struct pkginfo *aw)
{
- struct filenamenode *fnn = trigh.namenode_find(trig, 1);
+ struct fsys_namenode *fnn = trigh.namenode_find(trig, 1);
if (fnn)
trig_file_activate(fnn, aw);
}
void
-trig_file_activate(struct filenamenode *trig, struct pkginfo *aw)
+trig_file_activate(struct fsys_namenode *trig, struct pkginfo *aw)
{
struct trigfileint *tfi;
@@ -579,7 +579,7 @@ trig_file_activate_parents(const char *trig, struct pkginfo *aw)
}
void
-trig_path_activate(struct filenamenode *trig, struct pkginfo *aw)
+trig_path_activate(struct fsys_namenode *trig, struct pkginfo *aw)
{
trig_file_activate(trig, aw);
trig_file_activate_parents(trigh.namenode_name(trig), aw);
@@ -588,7 +588,7 @@ trig_path_activate(struct filenamenode *trig, struct pkginfo *aw)
static void
trig_path_activate_byname(const char *trig, struct pkginfo *aw)
{
- struct filenamenode *fnn = trigh.namenode_find(trig, 1);
+ struct fsys_namenode *fnn = trigh.namenode_find(trig, 1);
if (fnn)
trig_file_activate(fnn, aw);
diff --git a/lib/dpkg/triglib.h b/lib/dpkg/triglib.h
index 74b33ccb2..b4c772516 100644
--- a/lib/dpkg/triglib.h
+++ b/lib/dpkg/triglib.h
@@ -54,7 +54,7 @@ enum trig_options {
struct trigfileint {
struct pkginfo *pkg;
struct pkgbin *pkgbin;
- struct filenamenode *fnn;
+ struct fsys_namenode *fnn;
enum trig_options options;
struct trigfileint *samefile_next;
struct {
@@ -71,26 +71,26 @@ struct trig_hooks {
void (*enqueue_deferred)(struct pkginfo *pend);
void (*transitional_activate)(enum modstatdb_rw cstatus);
- struct filenamenode *(*namenode_find)(const char *filename, bool nonew);
- struct trigfileint **(*namenode_interested)(struct filenamenode *fnn);
+ struct fsys_namenode *(*namenode_find)(const char *filename, bool nonew);
+ struct trigfileint **(*namenode_interested)(struct fsys_namenode *fnn);
/** Returns a pointer from nfmalloc. */
- const char *(*namenode_name)(struct filenamenode *fnn);
+ const char *(*namenode_name)(struct fsys_namenode *fnn);
};
#define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS \
- static struct filenamenode *th_nn_find(const char *name, bool nonew) \
- { return findnamenode(name, nonew ? fnn_nonew : 0); } \
- static struct trigfileint **th_nn_interested(struct filenamenode *fnn) \
+ static struct fsys_namenode *th_nn_find(const char *name, bool nonew) \
+ { return fsys_hash_find_node(name, nonew ? FHFF_NONE : 0); } \
+ static struct trigfileint **th_nn_interested(struct fsys_namenode *fnn) \
{ return &fnn->trig_interested; } \
- static const char *th_nn_name(struct filenamenode *fnn) \
+ static const char *th_nn_name(struct fsys_namenode *fnn) \
{ return fnn->name; }
void trig_override_hooks(const struct trig_hooks *hooks);
void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
-void trig_file_activate(struct filenamenode *trig, struct pkginfo *aw);
-void trig_path_activate(struct filenamenode *trig, struct pkginfo *aw);
+void trig_file_activate(struct fsys_namenode *trig, struct pkginfo *aw);
+void trig_path_activate(struct fsys_namenode *trig, struct pkginfo *aw);
bool trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/);
bool trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);