aboutsummaryrefslogtreecommitdiff
path: root/include/relocation.h
blob: 01a7c6d5fd951c4ec63c2dc952bd1faf25cf9c6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * @file relocation.h
 */
#ifndef SPM_RELOCATION_H
#define SPM_RELOCATION_H

#define PREFIX_WRITE_BIN 0
#define PREFIX_WRITE_TEXT 1

typedef struct {
    char *prefix;
    char *path;
} RelocationEntry;

int relocate(const char *filename, const char *_oldstr, const char *_newstr);
void relocate_root(const char *destroot, const char *baseroot);
ssize_t replace_text(char *data, const char *_spattern, const char *_sreplacement);
int file_replace_text(char *filename, const char *spattern, const char *sreplacement);
RelocationEntry **prefixes_read(const char *filename);
void prefixes_free(RelocationEntry **entry);
int prefixes_write(const char *output_file, int mode, char **prefix, const char *tree);
int file_is_metadata(const char *path);

#endif //SPM_RELOCATION_H