source: bootcd/isolinux/syslinux-6.03/core/elflink/common.h

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 * common.h - Common internal operations performed by the module subsystem
3 *
4 *  Created on: Aug 11, 2008
5 *      Author: Stefan Bucur <stefanb@zytor.com>
6 */
7
8#ifndef COMMON_H_
9#define COMMON_H_
10
11#include <stdio.h>
12
13#include <sys/module.h>
14#include <linux/list.h>
15
16#include "elfutils.h"
17
18// Performs an operation and jumps to a given label if an error occurs
19#define CHECKED(res, expr, error)               \
20        do {                                                            \
21                (res) = (expr);                                 \
22                if ((res) < 0)                                  \
23                        goto error;                                     \
24        } while (0)
25
26#define MIN(x,y)        (((x) < (y)) ? (x) : (y))
27#define MAX(x,y)        (((x) > (y)) ? (x) : (y))
28
29//#define ELF_DEBUG
30
31#ifdef ELF_DEBUG
32#define DBG_PRINT(fmt, args...) fprintf(stderr, "[ELF] " fmt, ##args)
33#else
34#define DBG_PRINT(fmt, args...) // Expand to nothing
35#endif
36
37// User-space debugging routines
38#ifdef ELF_DEBUG
39extern void print_elf_ehdr(Elf32_Ehdr * ehdr);
40extern void print_elf_symbols(struct elf_module *module);
41#endif //ELF_DEBUG
42
43/*
44 * Image files manipulation routines
45 */
46
47extern int image_load(struct elf_module *module);
48extern int image_unload(struct elf_module *module);
49extern int image_read(void *buff, size_t size, struct elf_module *module);
50extern int image_skip(size_t size, struct elf_module *module);
51extern int image_seek(Elf32_Off offset, struct elf_module *module);
52
53extern struct module_dep *module_dep_alloc(struct elf_module *module);
54
55extern int check_header_common(Elf32_Ehdr * elf_hdr);
56
57extern int enforce_dependency(struct elf_module *req, struct elf_module *dep);
58extern int clear_dependency(struct elf_module *req, struct elf_module *dep);
59
60extern int check_symbols(struct elf_module *module);
61
62#endif /* COMMON_H_ */
Note: See TracBrowser for help on using the repository browser.