]> wimlib.net Git - wimlib/blob - include/wimlib/reparse.h
Refactor headers
[wimlib] / include / wimlib / reparse.h
1 #ifndef _WIMLIB_REPARSE_H
2 #define _WIMLIB_REPARSE_H
3
4 #include "wimlib/types.h"
5
6 struct wim_inode;
7 struct wim_lookup_table;
8
9 #define REPARSE_POINT_MAX_SIZE (16 * 1024)
10
11 /* Structured format for symbolic link, junction point, or mount point reparse
12  * data. */
13 struct reparse_data {
14         /* Reparse point tag (see WIM_IO_REPARSE_TAG_* values) */
15         u32 rptag;
16
17         /* Length of reparse data, not including the 8-byte header (ReparseTag,
18          * ReparseDataLength, ReparseReserved) */
19         u16 rpdatalen;
20
21         /* ReparseReserved */
22         u16 rpreserved;
23
24         /* Flags (only for WIM_IO_REPARSE_TAG_SYMLINK reparse points).
25          * SYMBOLIC_LINK_RELATIVE means this is a relative symbolic link;
26          * otherwise should be set to 0. */
27 #define SYMBOLIC_LINK_RELATIVE 0x00000001
28         u32 rpflags;
29
30         /* Pointer to the substitute name of the link (UTF-16LE). */
31         utf16lechar *substitute_name;
32
33         /* Pointer to the print name of the link (UTF-16LE). */
34         utf16lechar *print_name;
35
36         /* Number of bytes of the substitute name, not including null terminator
37          * if present */
38         u16 substitute_name_nbytes;
39
40         /* Number of bytes of the print name, not including null terminator if
41          * present */
42         u16 print_name_nbytes;
43 };
44
45 enum {
46         SUBST_NAME_IS_RELATIVE_LINK = -1,
47         SUBST_NAME_IS_VOLUME_JUNCTION = -2,
48         SUBST_NAME_IS_UNKNOWN = -3,
49 };
50 extern int
51 parse_substitute_name(const utf16lechar *substitute_name,
52                       u16 substitute_name_nbytes,
53                       u32 rptag);
54
55 extern int
56 parse_reparse_data(const u8 *rpbuf, u16 rpbuflen, struct reparse_data *rpdata);
57
58 extern int
59 make_reparse_buffer(const struct reparse_data *rpdata, u8 *buf);
60
61 extern int
62 wim_inode_get_reparse_data(const struct wim_inode *inode, u8 *rpbuf);
63
64 #ifndef __WIN32__
65 ssize_t
66 wim_inode_readlink(const struct wim_inode *inode, char *buf, size_t buf_len);
67
68 extern int
69 wim_inode_set_symlink(struct wim_inode *inode, const char *target,
70                       struct wim_lookup_table *lookup_table);
71 #endif
72
73 extern tchar *
74 capture_fixup_absolute_symlink(tchar *dest,
75                                u64 capture_root_ino, u64 capture_root_dev);
76
77 #endif /* _WIMLIB_REPARSE_H */