Define different modules so that the functions are correctly grouped and shown in the documentation.
@@ -30,6 +30,12 @@
DPKG_BEGIN_DECLS
+/**
+ * @defgroup ar Ar archive handling
+ * @ingroup dpkg-public
+ * @{
+ */
+
#define DPKG_AR_MAGIC "!<arch>\n"
void dpkg_ar_normalize_name(struct ar_hdr *arh);
@@ -44,6 +50,8 @@ void dpkg_ar_member_put_mem(const char *ar_name, int ar_fd, const char *name,
const void *data, size_t size);
off_t dpkg_ar_member_get_size(const char *ar_name, struct ar_hdr *arh);
+/** @} */
DPKG_END_DECLS
#endif /* LIBDPKG_AR_H */
@@ -28,6 +28,12 @@
+ * @defgroup arch Architecture database
enum dpkg_arch_type {
arch_none,
arch_empty,
@@ -58,6 +64,8 @@ void dpkg_arch_save_list(void);
void varbuf_add_archqual(struct varbuf *vb, const struct dpkg_arch *arch);
#endif /* LIBDPKG_ARCH_H */
@@ -27,6 +27,12 @@
+ * @defgroup atomic-file Atomic file operations
+ * @ingroup dpkg-internal
enum atomic_file_flags {
aff_backup = 01,
};
@@ -47,6 +53,8 @@ void atomic_file_commit(struct atomic_file *file);
void atomic_file_remove(struct atomic_file *file);
void atomic_file_free(struct atomic_file *file);
#endif /* LIBDPKG_ATOMIC_FILE_H */
+ * @defgroup buffer Buffer I/O
#define DPKG_BUFFER_SIZE 4096
#define BUFFER_WRITE_VBUF 1
@@ -90,6 +96,8 @@ off_t buffer_skip_Int(int I, int T, off_t limit, const char *desc_fmt, ...)
DPKG_ATTR_PRINTF(4);
off_t buffer_filter(const void *buf, void *hash, int typeFilter, off_t length);
#endif /* LIBDPKG_BUFFER_H */
@@ -25,6 +25,12 @@
+ * @defgroup command Command execution
/**
* Describe a command to execute.
*/
@@ -50,6 +56,8 @@ void command_exec(struct command *cmd) DPKG_ATTR_NORET;
void command_shell(const char *cmd, const char *name);
#endif /* LIBDPKG_COMMAND_H */
@@ -29,6 +29,12 @@
+ * @defgroup compress Compression
enum compressor_type {
compressor_type_unknown = -1,
compressor_type_none,
@@ -59,6 +65,8 @@ void compress_filter(struct compress_params *params, int fd_in, int fd_out,
const char *desc, ...)
#endif /* LIBDPKG_COMPRESS_H */
+ * @defgroup debug Debugging
enum debugflags {
dbg_general = 01,
dbg_scripts = 02,
@@ -49,6 +55,8 @@ void debug_set_mask(int mask);
bool debug_has_flag(int flag);
void debug(int flag, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
#endif /* LIBDPKG_DEBUG_H */
@@ -27,10 +27,18 @@
+ * @defgroup dir Directory handling
void dir_sync_path(const char *path);
void dir_sync_path_parent(const char *path);
void dir_sync_contents(const char *path);
#endif /* LIBDPKG_DIR_H */
@@ -35,6 +35,12 @@
+ * @defgroup dpkg-db In-core package database management
enum deptype {
dep_suggests,
dep_recommends,
@@ -401,6 +407,8 @@ char *nfstrsave(const char*);
char *nfstrnsave(const char*, size_t);
void nffreeall(void);
#endif /* LIBDPKG_DPKG_DB_H */
@@ -32,6 +32,23 @@
+ * @mainpage libdpkg C API
+ *
+ * This is the documentation for the libdpkg C API. It is divided in an
+ * @ref dpkg-internal "internal API" and a @ref dpkg-public "public API".
+ * Applications closely tied to dpkg can make use of the internal API, the
+ * rest should only assume the availability of the public API.
+ * Applications need to define the LIBDPKG_VOLATILE_API macro to acknowledge
+ * that the API is to be considered volatile, please read doc/README.api for
+ * more information.
+ * @defgroup dpkg-internal Internal libdpkg C API
+ * @defgroup dpkg-public Public libdpkg C API
#define MAXCONFFILENAME 1000
#define MAXDIVERTFILENAME 1024
#define MAXCONTROLFILENAME 100
+ * @defgroup ehandle Error context handling
extern volatile int onerr_abort;
enum {
@@ -70,6 +76,8 @@ void do_internerr(const char *file, int line, const char *fmt, ...)
DPKG_ATTR_NORET DPKG_ATTR_PRINTF(3);
#define internerr(...) do_internerr(__FILE__, __LINE__, __VA_ARGS__)
#endif /* LIBDPKG_EHANDLE_H */
+ * @defgroup dpkg_error Error message reporting
struct dpkg_error {
enum dpkg_msg_type {
DPKG_MSG_NONE,
@@ -46,6 +52,8 @@ int dpkg_put_errno(struct dpkg_error *err, const char *fmt, ...)
void dpkg_error_destroy(struct dpkg_error *err);
#endif /* LIBDPKG_ERROR_H */
@@ -27,9 +27,17 @@
+ * @defgroup fdio File descriptor I/O
ssize_t fd_read(int fd, void *buf, size_t len);
ssize_t fd_write(int fd, const void *buf, size_t len);
#endif /* LIBDPKG_FDIO_H */
+ * @defgroup file File handling
struct file_stat {
uid_t uid;
gid_t gid;
@@ -47,6 +53,8 @@ void file_lock(int *lockfd, enum file_lock_flags flags, const char *filename,
const char *desc);
void file_unlock(int fd, const char *desc);
#endif /* LIBDPKG_FILE_H */
+ * @defgroup glob File globbing
struct glob_node {
struct glob_node *next;
char *pattern;
@@ -33,6 +39,8 @@ struct glob_node {
void glob_list_prepend(struct glob_node **list, char *pattern);
void glob_list_free(struct glob_node *head);
#endif /* LIBDPKG_GLOB_H */
+ * @defgroup i18n Internationalization support
#include <gettext.h>
/* We need to include this because pgettext() uses LC_MESSAGES, but libintl.h
@@ -36,6 +42,8 @@ DPKG_BEGIN_DECLS
#define N_(str) gettext_noop(str)
#define C_(ctxt, str) pgettext(ctxt, str)
#endif /* LIBDPKG_I18N_H */
@@ -21,6 +21,12 @@
#ifndef LIBDPKG_MACROS_H
#define LIBDPKG_MACROS_H
+ * @defgroup macros C language support macros
#ifndef LIBDPKG_VOLATILE_API
#error "The libdpkg API is to be considered volatile, please read 'README.api'."
#endif
@@ -73,6 +79,11 @@
#define DPKG_END_DECLS
+ * @def array_count
+ * Returns the amount of items in an array.
#ifndef array_count
#define array_count(a) (sizeof(a) / sizeof((a)[0]))
@@ -88,4 +99,6 @@
#endif /* LIBDPKG_MACROS_H */
@@ -26,6 +26,12 @@
+ * @defgroup namevalue Name/Value data
struct namevalue {
const char *name;
int value;
@@ -40,6 +46,8 @@ struct namevalue {
const struct namevalue *namevalue_find_by_name(const struct namevalue *head,
const char *str);
#endif /* LIBDPKG_NAMEVALUE_H */
+ * @defgroup options Option parsing
typedef int action_func(const char *const *argv);
struct cmdinfo {
@@ -70,6 +76,8 @@ void setobsolete(const struct cmdinfo *cip, const char *value);
#define OBSOLETE(longopt, shortopt) \
{ longopt, shortopt, 0, NULL, NULL, setobsolete, 0, NULL, NULL }
#endif /* LIBDPKG_OPTIONS_H */
@@ -23,6 +23,12 @@
#ifndef LIBDPKG_PARSEDUMP_H
#define LIBDPKG_PARSEDUMP_H
+ * @defgroup parsedump In-core package database parsing and reading
struct fieldinfo;
@@ -130,4 +136,6 @@ struct nickname {
extern const struct fieldinfo fieldinfos[];
#endif /* LIBDPKG_PARSEDUMP_H */
+ * @defgroup path Path handling
size_t path_trim_slash_slashdot(char *path);
const char *path_skip_slash_dotslash(const char *path);
const char *path_basename(const char *path);
@@ -34,6 +40,8 @@ char *path_quote_filename(char *dst, const char *src, size_t size);
char *path_make_temp_template(const char *suffix);
#endif /* LIBDPKG_PATH_H */
+ * @defgroup pkg-array Package array primitives
* Holds an array of pointers to package data.
@@ -38,6 +44,8 @@ void pkg_array_init_from_db(struct pkg_array *a);
void pkg_array_sort(struct pkg_array *a, pkg_sorter_func *pkg_sort);
void pkg_array_destroy(struct pkg_array *a);
#endif /* LIBDPKG_PKG_ARRAY_H */
+ * @defgroup pkg-format Package information formatting
struct pkg_format_node;
struct pkg_format_node *pkg_format_parse(const char *fmt);
@@ -33,6 +39,8 @@ void pkg_format_free(struct pkg_format_node *head);
void pkg_format_show(const struct pkg_format_node *head,
struct pkginfo *pkg, struct pkgbin *pkgbin);
#endif /* LIBDPKG_PKG_FORMAT_H */
+ * @defgroup pkg-list Package linked lists
struct pkg_list {
struct pkg_list *next;
struct pkginfo *pkg;
@@ -34,6 +40,8 @@ struct pkg_list *pkg_list_new(struct pkginfo *pkg, struct pkg_list *next);
void pkg_list_free(struct pkg_list *head);
void pkg_list_prepend(struct pkg_list **head, struct pkginfo *pkg);
#endif /* LIBDPKG_PKG_LIST_H */
+ * @defgroup pkg-queue Package queues
struct pkg_queue {
struct pkg_list *head, *tail;
int length;
@@ -45,6 +51,8 @@ int pkg_queue_is_empty(struct pkg_queue *queue);
struct pkg_list *pkg_queue_push(struct pkg_queue *queue, struct pkginfo *pkg);
struct pkginfo *pkg_queue_pop(struct pkg_queue *queue);
#endif /* DPKG_PKG_QUEUE_H */
+ * @defgroup pkg-show Package information display
int pkg_sorter_by_nonambig_name_arch(const void *a, const void *b);
const char *pkg_summary(const struct pkginfo *pkg, const struct pkgbin *pkgbin,
@@ -34,6 +40,8 @@ int pkg_abbrev_want(const struct pkginfo *pkg);
int pkg_abbrev_status(const struct pkginfo *pkg);
int pkg_abbrev_eflag(const struct pkginfo *pkg);
#endif /* DPKG_PKG_SHOW_H */
@@ -32,6 +32,12 @@
+ * @defgroup pkg-spec Package specifiers
struct pkg_spec {
char *name;
const struct dpkg_arch *arch;
@@ -76,6 +82,8 @@ void pkg_spec_iter_init(struct pkg_spec *ps);
struct pkginfo *pkg_spec_iter_next_pkg(struct pkg_spec *ps);
void pkg_spec_iter_destroy(struct pkg_spec *ps);
+ * @defgroup pkg Package handling primitives
typedef int pkg_sorter_func(const void *a, const void *b);
void pkgset_link_pkg(struct pkgset *set, struct pkginfo *pkg);
@@ -37,6 +43,8 @@ void pkg_reset_eflags(struct pkginfo *pkg);
void pkg_copy_eflags(struct pkginfo *pkg_dst, struct pkginfo *pkg_src);
void pkg_set_want(struct pkginfo *pkg, enum pkgwant want);
#endif /* LIBDPKG_PKG_H */
@@ -25,9 +25,17 @@
+ * @defgroup progname Program name handling
void dpkg_set_progname(const char *name);
const char *dpkg_get_progname(void);
+ * @defgroup progress Progress reporting
struct progress {
const char *text;
@@ -41,6 +47,8 @@ void progress_init(struct progress *progress, const char *text, int max);
void progress_step(struct progress *progress);
void progress_done(struct progress *progress);
@@ -25,10 +25,18 @@
+ * @defgroup string String handling
char *str_escape_fmt(char *dest, const char *src, size_t n);
char *str_quote_meta(const char *src);
char *str_strip_quotes(char *str);
#endif /* LIBDPKG_STRING_H */
+ * @defgroup subproc Sub-process handling
void subproc_signals_setup(const char *name);
void subproc_signals_cleanup(int argc, void **argv);
@@ -39,6 +45,8 @@ int subproc_wait(pid_t pid, const char *desc);
int subproc_check(int status, const char *desc, int flags);
int subproc_wait_check(pid_t pid, const char *desc, int flags);
#endif /* LIBDPKG_SUBPROC_H */
#include <dpkg/file.h>
+ * @defgroup tar Tar archive handling
#define TARBLKSZ 512
enum tar_format {
@@ -86,4 +92,6 @@ struct tar_operations {
int tar_extractor(void *ctx, const struct tar_operations *ops);
@@ -31,11 +31,19 @@
/* Make sure NDEBUG is never defined, as we rely on the assert() macro. */
#undef NDEBUG
+ * @defgroup dpkg_test Test suite support
#define test_pass(a) assert((a))
#define test_fail(a) assert(!(a))
#define test_str(a, op, b) assert(strcmp((a), (b)) op 0)
#define test_mem(a, op, b, size) assert(memcmp((a), (b), (size)) op 0)
#ifndef TEST_MAIN_PROVIDED
static void test(void);
+ * @defgroup trigdeferred Trigger deferred file handling
enum trigdef_updateflags {
tduf_nolockok = 001,
tduf_write = 002,
@@ -56,6 +62,8 @@ void trigdef_update_printf(const char *format, ...) DPKG_ATTR_PRINTF(1);
int trigdef_parse(void);
void trigdef_process_done(void);
#endif /* LIBDPKG_TRIGDEFERRED_H */
+ * @defgroup triglib Trigger handling
/*
* Hooks for more sophisticated processing in dpkg proper.
*
@@ -111,6 +117,8 @@ void trig_parse_ci(const char *file, trig_parse_cicb *interest,
void trig_incorporate(enum modstatdb_rw cstatus);
#endif /* LIBDPKG_TRIGLIB_H */
+ * @defgroup varbuf Variable length buffers
* varbuf_init must be called exactly once before the use of each varbuf
* (including before any call to varbuf_destroy), or the variable must be
@@ -82,6 +88,8 @@ int varbuf_printf(struct varbuf *v, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
int varbuf_vprintf(struct varbuf *v, const char *fmt, va_list va)
DPKG_ATTR_VPRINTF(2);
#ifdef __cplusplus
+ * @defgroup version Version handling
struct versionrevision {
unsigned long epoch;
const char *version;
@@ -36,6 +42,8 @@ struct versionrevision {
void dpkg_version_blank(struct versionrevision *version);
bool dpkg_version_is_informative(const struct versionrevision *version);
#endif /* LIBDPKG_VERSION_H */