dpkg 1.21.11
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 <dpkg/macros.h>
27#include <dpkg/dpkg-db.h>
28#include <dpkg/fsys.h>
29
31
38/*
39 * Hooks for more sophisticated processing in dpkg proper.
40 *
41 * We do things like this so we can get most of the trigger tracking
42 * in dpkg-query, dselect, and so on, but avoid the transitional
43 * processing and deferred trigproc queue management other than when
44 * we're actually doing real package management work.
45 */
46
47const char *trig_name_is_illegal(const char *p);
48
52};
53
55 struct pkginfo *pkg;
56 struct pkgbin *pkgbin;
60 struct {
63};
64
70struct trig_hooks {
71 void (*enqueue_deferred)(struct pkginfo *pend);
72 void (*transitional_activate)(enum modstatdb_rw cstatus);
73
74 struct fsys_namenode *(*namenode_find)(const char *filename, bool nonew);
75 struct trigfileint **(*namenode_interested)(struct fsys_namenode *fnn);
76
78 const char *(*namenode_name)(struct fsys_namenode *fnn);
79};
80
81#define TRIGHOOKS_DEFINE_NAMENODE_ACCESSORS \
82 static struct fsys_namenode *th_nn_find(const char *name, bool nonew) \
83 { return fsys_hash_find_node(name, nonew ? FHFF_NONE : 0); } \
84 static struct trigfileint **th_nn_interested(struct fsys_namenode *fnn) \
85 { return &fnn->trig_interested; } \
86 static const char *th_nn_name(struct fsys_namenode *fnn) \
87 { return fnn->name; }
88
89void trig_override_hooks(const struct trig_hooks *hooks);
90
91void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
92void trig_file_activate(struct fsys_namenode *trig, struct pkginfo *aw);
93void trig_path_activate(struct fsys_namenode *trig, struct pkginfo *aw);
94
95bool trig_note_pend_core(struct pkginfo *pend, const char *trig /*not copied!*/);
96bool trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);
97bool trig_note_aw(struct pkginfo *pend, struct pkginfo *aw);
98void trig_clear_awaiters(struct pkginfo *notpend);
99
100typedef void trig_awaited_pend_foreach_func(struct pkginfo *pkg);
101
102void trig_awaited_pend_enqueue(struct pkginfo *pend);
104void trig_awaited_pend_free(void);
105
106void trig_fixup_awaiters(enum modstatdb_rw cstatus);
107
109void trig_file_interests_save(void);
110
111typedef void trig_parse_cicb(const char *trig, struct pkginfo *pkg,
112 struct pkgbin *pkgbin, enum trig_options to);
113void trig_cicb_interest_delete(const char *trig, struct pkginfo *pkg,
114 struct pkgbin *pkgbin, enum trig_options to);
115void trig_cicb_interest_add(const char *trig, struct pkginfo *pkg,
116 struct pkgbin *pkgbin, enum trig_options to);
117void trig_cicb_statuschange_activate(const char *trig, struct pkginfo *pkg,
118 struct pkgbin *pkgbin, enum trig_options to);
119void trig_parse_ci(const char *file, trig_parse_cicb *interest,
120 trig_parse_cicb *activate, struct pkginfo *pkg,
121 struct pkgbin *pkgbin);
122
123void trig_incorporate(enum modstatdb_rw cstatus);
124
128
129#endif /* LIBDPKG_TRIGLIB_H */
modstatdb_rw
Definition: dpkg-db.h:266
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_END_DECLS
Definition: macros.h:87
void trig_fixup_awaiters(enum modstatdb_rw cstatus)
Definition: triglib.c:137
void trig_file_activate_byname(const char *trig, struct pkginfo *aw)
Definition: triglib.c:575
void trig_cicb_statuschange_activate(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options to)
Definition: triglib.c:685
void trig_file_interests_ensure(void)
Definition: triglib.c:529
void trig_override_hooks(const struct trig_hooks *hooks)
Definition: triglib.c:861
void trig_file_interests_save(void)
Definition: triglib.c:513
void trig_cicb_interest_delete(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options to)
Definition: triglib.c:671
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:111
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:611
void trig_file_activate(struct fsys_namenode *trig, struct pkginfo *aw)
Definition: triglib.c:584
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:100
void trig_cicb_interest_add(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options to)
Definition: triglib.c:678
void trig_parse_ci(const char *file, trig_parse_cicb *interest, trig_parse_cicb *activate, struct pkginfo *pkg, struct pkgbin *pkgbin)
Definition: triglib.c:712
trig_options
Definition: triglib.h:49
void trig_incorporate(enum modstatdb_rw cstatus)
Definition: triglib.c:795
@ TRIG_AWAIT
Definition: triglib.h:50
@ TRIG_NOAWAIT
Definition: triglib.h:51
Definition: main.c:133
Definition: fsys.h:94
Node describing a binary package file.
Definition: dpkg-db.h:108
Node describing an architecture package instance.
Definition: dpkg-db.h:198
The first two hooks are normally NULL.
Definition: triglib.h:70
void(* transitional_activate)(enum modstatdb_rw cstatus)
Definition: triglib.h:72
void(* enqueue_deferred)(struct pkginfo *pend)
Definition: triglib.h:71
Definition: triglib.h:54
struct trigfileint * samefile_next
Definition: triglib.h:59
struct trigfileint::@11 inoverall
struct trigfileint * next
Definition: triglib.h:61
struct pkgbin * pkgbin
Definition: triglib.h:56
enum trig_options options
Definition: triglib.h:58
struct fsys_namenode * fnn
Definition: triglib.h:57
struct pkginfo * pkg
Definition: triglib.h:55
struct trigfileint * prev
Definition: triglib.h:61