dpkg 1.22.7-3-g89f48
Loading...
Searching...
No Matches
db-fsys.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * db-fsys.h - management of database of files installed on system
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_DB_FSYS_H
23#define LIBDPKG_DB_FSYS_H
24
25#include <sys/stat.h>
26
27#include <stdio.h>
28
29#include <dpkg/file.h>
30#include <dpkg/fsys.h>
31
33
34/*
35 * Data structure here is as follows:
36 *
37 * For each package we have a ‘struct fsys_namenode_list *’, the head of a list of
38 * files in that package. They are in ‘forwards’ order. Each entry has a
39 * pointer to the ‘struct fsys_namenode’.
40 *
41 * The struct fsys_namenodes are in a hash table, indexed by name.
42 * (This hash table is not visible to callers.)
43 *
44 * Each fsys_namenode has a (possibly empty) list of ‘struct filepackage’,
45 * giving a list of the packages listing that filename.
46 *
47 * When we read files contained info about a particular package we set the
48 * ‘files’ member of the clientdata struct to the appropriate thing. When
49 * not yet set the files pointer is made to point to ‘fileslist_uninited’
50 * (this is available only internally, within filesdb.c - the published
51 * interface is ensure_*_available).
52 */
53
54struct pkginfo;
55struct pkgbin;
56
65
66struct dpkg_db {
68 const char *name;
69
70 /* Database state members. */
71 char *pathname;
72 FILE *file;
73 struct stat st;
74};
75
77dpkg_db_reopen(struct dpkg_db *db);
78
79void ensure_diversions(void);
80
85
86uid_t statdb_parse_uid(const char *str);
87gid_t statdb_parse_gid(const char *str);
88mode_t statdb_parse_mode(const char *str);
90
91#define LISTFILE "list"
92#define HASHFILE "md5sums"
93
98void parse_filehash(struct pkginfo *pkg, struct pkgbin *pkgbin);
99void write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
100 struct fsys_namenode_list *list, enum fsys_namenode_flags mask);
101void write_filehash_except(struct pkginfo *pkg, struct pkgbin *pkgbin,
102 struct fsys_namenode_list *list, enum fsys_namenode_flags mask);
103
105
106#endif /* LIBDPKG_DB_FSYS_H */
void write_filelist_except(struct pkginfo *pkg, struct pkgbin *pkgbin, struct fsys_namenode_list *list, enum fsys_namenode_flags mask)
Definition db-fsys-files.c:313
void ensure_statoverrides(enum statdb_parse_flags flags)
Definition db-fsys-override.c:109
void ensure_packagefiles_available(struct pkginfo *pkg)
Load the list of files in this package into memory, or update the list if it is there but stale.
Definition db-fsys-files.c:118
void note_must_reread_files_inpackage(struct pkginfo *pkg)
Definition db-fsys-files.c:60
statdb_parse_flags
Definition db-fsys.h:81
@ STATDB_PARSE_NORMAL
Definition db-fsys.h:82
@ STATDB_PARSE_LAX
Definition db-fsys.h:83
void ensure_allinstfiles_available(void)
Definition db-fsys-files.c:263
void ensure_diversions(void)
Definition db-fsys-divert.c:44
void ensure_allinstfiles_available_quiet(void)
Definition db-fsys-files.c:303
void write_filehash_except(struct pkginfo *pkg, struct pkgbin *pkgbin, struct fsys_namenode_list *list, enum fsys_namenode_flags mask)
Definition db-fsys-digest.c:46
dpkg_db_error
Definition db-fsys.h:57
@ DPKG_DB_NONE
No database file found.
Definition db-fsys.h:61
@ DPKG_DB_SAME
The database is already loaded and has not changed.
Definition db-fsys.h:63
@ DPKG_DB_LOAD
The database is new or has changed, should be loaded.
Definition db-fsys.h:59
uid_t statdb_parse_uid(const char *str)
Definition db-fsys-override.c:44
enum dpkg_db_error dpkg_db_reopen(struct dpkg_db *db)
Definition db-fsys-load.c:37
gid_t statdb_parse_gid(const char *str)
Definition db-fsys-override.c:70
mode_t statdb_parse_mode(const char *str)
Definition db-fsys-override.c:96
void parse_filehash(struct pkginfo *pkg, struct pkgbin *pkgbin)
Definition db-fsys-digest.c:134
enum DPKG_ATTR_ENUM_FLAGS fsys_namenode_flags
Definition fsys.h:65
#define DPKG_BEGIN_DECLS
Definition macros.h:164
#define DPKG_END_DECLS
Definition macros.h:165
Definition db-fsys.h:66
char * pathname
Definition db-fsys.h:71
struct stat st
Definition db-fsys.h:73
FILE * file
Definition db-fsys.h:72
const char * name
Name of the database.
Definition db-fsys.h:68
Definition fsys.h:130
Node describing a binary package file.
Definition dpkg-db.h:116
Node describing an architecture package instance.
Definition dpkg-db.h:206