]> wimlib.net Git - wimlib/blob - include/wimlib/reparse.h
Fix packed attribute on struct wimlib_unix_data
[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 * restrict rpbuf, u16 rpbuflen,
57                    struct reparse_data * restrict rpdata);
58
59 extern int
60 make_reparse_buffer(const struct reparse_data * restrict rpdata,
61                     u8 * restrict rpbuf);
62
63 extern int
64 wim_inode_get_reparse_data(const struct wim_inode * restrict inode,
65                            u8 * restrict rpbuf,
66                            u16 * restrict rpbuflen_ret);
67
68 #ifndef __WIN32__
69 ssize_t
70 wim_inode_readlink(const struct wim_inode * restrict inode, char * restrict buf,
71                    size_t buf_len);
72
73 extern int
74 wim_inode_set_symlink(struct wim_inode *inode, const char *target,
75                       struct wim_lookup_table *lookup_table);
76 #endif
77
78 extern tchar *
79 capture_fixup_absolute_symlink(tchar *dest,
80                                u64 capture_root_ino, u64 capture_root_dev);
81
82 #endif /* _WIMLIB_REPARSE_H */