dpkg (1.18.25) stretch; urgency=medium
[dpkg] / lib / dpkg / trigdeferred.h
CommitLineData
1479465f
GJ
1/*
2 * libdpkg - Debian packaging suite library routines
3 * trigdeferred.h - parsing of triggers/Deferred
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_TRIGDEFERRED_H
24#define LIBDPKG_TRIGDEFERRED_H
25
26#include <dpkg/macros.h>
27
28DPKG_BEGIN_DECLS
29
30/**
31 * @defgroup trigdeferred Trigger deferred file handling
32 * @ingroup dpkg-internal
33 * @{
34 */
35
36enum trigdef_update_flags {
37 TDUF_NO_LOCK_OK = DPKG_BIT(0),
38 TDUF_WRITE = DPKG_BIT(1),
39 TDUF_NO_LOCK = TDUF_NO_LOCK_OK | TDUF_WRITE,
40 /** Should not be set unless TDUF_WRITE is. */
41 TDUF_WRITE_IF_EMPTY = DPKG_BIT(3),
42 TDUF_WRITE_IF_ENOENT = DPKG_BIT(4),
43};
44
45enum trigdef_update_status {
46 TDUS_ERROR_NO_DIR = -1,
47 TDUS_ERROR_EMPTY_DEFERRED = -2,
48 TDUS_ERROR_NO_DEFERRED = -3,
49 TDUS_NO_DEFERRED = 1,
50 TDUS_OK = 2,
51};
52
53struct trigdefmeths {
54 void (*trig_begin)(const char *trig);
55 void (*package)(const char *awname);
56 void (*trig_end)(void);
57};
58
59void trigdef_set_methods(const struct trigdefmeths *methods);
60
61enum trigdef_update_status trigdef_update_start(enum trigdef_update_flags uf);
62void trigdef_update_printf(const char *format, ...) DPKG_ATTR_PRINTF(1);
63int trigdef_parse(void);
64void trigdef_process_done(void);
65
66/** @} */
67
68DPKG_END_DECLS
69
70#endif /* LIBDPKG_TRIGDEFERRED_H */