dpkg 1.22.7-3-g89f48
Loading...
Searching...
No Matches
triglib.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * triglib.h - declarations for trigger handling
4 *
5 * Copyright © 2007 Canonical, Ltd.
6 * written by Ian Jackson <ijackson@chiark.greenend.org.uk>
7 * Copyright © 2008-2014 Guillem Jover <guillem@debian.org>
8 *
9 * This is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef LIBDPKG_TRIGLIB_H
24#define LIBDPKG_TRIGLIB_H
25
26#include <stdbool.h>
27
28#include <dpkg/macros.h>
29#include <dpkg/dpkg-db.h>
30#include <dpkg/fsys.h>
31
33
40/*
41 * Hooks for more sophisticated processing in dpkg proper.
42 *
43 * We do things like this so we can get most of the trigger tracking
44 * in dpkg-query, dselect, and so on, but avoid the transitional
45 * processing and deferred trigproc queue management other than when
46 * we're actually doing real package management work.
47 */
48
49const char *trig_name_is_illegal(const char *p);
50
55
57 struct pkginfo *pkg;
58 struct pkgbin *pkgbin;
62 struct {
65};
66
72struct trig_hooks {
73 void (*enqueue_deferred)(struct pkginfo *pend);
74 void (*transitional_activate)(enum modstatdb_rw cstatus);
75
76 struct fsys_namenode *(*namenode_find)(const char *filename, bool nonew);
77 struct trigfileint **(*namenode_interested)(struct fsys_namenode *fnn);
78
80 const char *(*namenode_name)(struct fsys_namenode *fnn);
81};
82
83#define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS \
84 static struct fsys_namenode *th_nn_find(const char *name, bool nonew) \
85 { return fsys_hash_find_node(name, nonew ? FHFF_NO_NEW : FHFF_NONE); } \
86 static struct trigfileint **th_nn_interested(struct fsys_namenode *fnn) \
87 { return &fnn->trig_interested; } \
88 static const char *th_nn_name(struct fsys_namenode *fnn) \
89 { return fnn->name; }
90
91void trig_override_hooks(const struct trig_hooks *hooks);
92
93void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
94void trig_file_activate(struct fsys_namenode *trig, struct pkginfo *aw);
95void trig_path_activate(struct fsys_namenode *trig, struct pkginfo *aw);
96
97bool trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/);
98bool trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);
99bool trig_note_aw(struct pkginfo *pend, struct pkginfo *aw);
100void trig_clear_awaiters(struct pkginfo *notpend);
101
102typedef void trig_awaited_pend_foreach_func(struct pkginfo *pkg);
103
104void trig_awaited_pend_enqueue(struct pkginfo *pend);
106void trig_awaited_pend_free(void);
107
108void trig_fixup_awaiters(enum modstatdb_rw cstatus);
109
111void trig_file_interests_save(void);
112
113typedef void trig_parse_cicb(const char *trig, struct pkginfo *pkg,
114 struct pkgbin *pkgbin, enum trig_options to);
115void trig_cicb_interest_delete(const char *trig, struct pkginfo *pkg,
116 struct pkgbin *pkgbin, enum trig_options to);
117void trig_cicb_interest_add(const char *trig, struct pkginfo *pkg,
118 struct pkgbin *pkgbin, enum trig_options to);
119void trig_cicb_statuschange_activate(const char *trig, struct pkginfo *pkg,
120 struct pkgbin *pkgbin, enum trig_options to);
121void trig_parse_ci(const char *file, trig_parse_cicb *interest,
122 trig_parse_cicb *activate, struct pkginfo *pkg,
123 struct pkgbin *pkgbin);
124
125void trig_incorporate(enum modstatdb_rw cstatus);
126
130
131#endif /* LIBDPKG_TRIGLIB_H */
enum DPKG_ATTR_ENUM_FLAGS modstatdb_rw
Definition dpkg-db.h:274
#define DPKG_BEGIN_DECLS
Definition macros.h:164
#define DPKG_END_DECLS
Definition macros.h:165
void trig_fixup_awaiters(enum modstatdb_rw cstatus)
Definition triglib.c:138
void trig_file_activate_byname(const char *trig, struct pkginfo *aw)
Definition triglib.c:573
void trig_cicb_statuschange_activate(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options to)
Definition triglib.c:683
void trig_file_interests_ensure(void)
Definition triglib.c:527
void trig_override_hooks(const struct trig_hooks *hooks)
Definition triglib.c:859
void trig_file_interests_save(void)
Definition triglib.c:511
void trig_cicb_interest_delete(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options to)
Definition triglib.c:669
bool trig_note_pend(struct pkginfo *pend, const char *trig)
Definition trignote.c:64
void trig_awaited_pend_enqueue(struct pkginfo *pend)
Definition trignote.c:107
void trig_parse_cicb(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options to)
Definition triglib.h:113
void trig_awaited_pend_foreach(trig_awaited_pend_foreach_func *func)
Definition trignote.c:119
void trig_clear_awaiters(struct pkginfo *notpend)
Definition triglib.c:101
const char * trig_name_is_illegal(const char *p)
Definition trigname.c:29
bool trig_note_pend_core(struct pkginfo *pend, const char *trig)
Definition trignote.c:41
void trig_path_activate(struct fsys_namenode *trig, struct pkginfo *aw)
Definition triglib.c:609
void trig_file_activate(struct fsys_namenode *trig, struct pkginfo *aw)
Definition triglib.c:582
void trig_awaited_pend_free(void)
Definition trignote.c:129
bool trig_note_aw(struct pkginfo *pend, struct pkginfo *aw)
Definition trignote.c:85
void trig_awaited_pend_foreach_func(struct pkginfo *pkg)
Definition triglib.h:102
void trig_cicb_interest_add(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options to)
Definition triglib.c:676
void trig_parse_ci(const char *file, trig_parse_cicb *interest, trig_parse_cicb *activate, struct pkginfo *pkg, struct pkgbin *pkgbin)
Definition triglib.c:710
trig_options
Definition triglib.h:51
void trig_incorporate(enum modstatdb_rw cstatus)
Definition triglib.c:793
@ TRIG_AWAIT
Definition triglib.h:52
@ TRIG_NOAWAIT
Definition triglib.h:53
Definition main.c:133
Definition fsys.h:98
Node describing a binary package file.
Definition dpkg-db.h:116
Node describing an architecture package instance.
Definition dpkg-db.h:206
The first two hooks are normally NULL.
Definition triglib.h:72
void(* transitional_activate)(enum modstatdb_rw cstatus)
Definition triglib.h:74
void(* enqueue_deferred)(struct pkginfo *pend)
Definition triglib.h:73
Definition triglib.h:56
struct trigfileint * samefile_next
Definition triglib.h:61
struct trigfileint::@11 inoverall
struct trigfileint * next
Definition triglib.h:63
struct pkgbin * pkgbin
Definition triglib.h:58
enum trig_options options
Definition triglib.h:60
struct fsys_namenode * fnn
Definition triglib.h:59
struct pkginfo * pkg
Definition triglib.h:57
struct trigfileint * prev
Definition triglib.h:63