1 #ifndef _WIMLIB_REPARSE_H
2 #define _WIMLIB_REPARSE_H
4 #include "wimlib/types.h"
7 struct wim_lookup_table;
9 #define REPARSE_POINT_MAX_SIZE (16 * 1024)
11 /* On-disk format of reparse point buffer */
12 struct reparse_buffer_disk {
17 u8 rpdata[REPARSE_POINT_MAX_SIZE - 8];
20 le16 substitute_name_offset;
21 le16 substitute_name_nbytes;
22 le16 print_name_offset;
23 le16 print_name_nbytes;
25 u8 data[REPARSE_POINT_MAX_SIZE - 20];
26 } _packed_attribute symlink;
29 le16 substitute_name_offset;
30 le16 substitute_name_nbytes;
31 le16 print_name_offset;
32 le16 print_name_nbytes;
33 u8 data[REPARSE_POINT_MAX_SIZE - 16];
34 } _packed_attribute junction;
38 #define REPARSE_DATA_OFFSET (offsetof(struct reparse_buffer_disk, rpdata))
40 #define REPARSE_DATA_MAX_SIZE (REPARSE_POINT_MAX_SIZE - REPARSE_DATA_OFFSET)
43 /* Structured format for symbolic link, junction point, or mount point reparse
46 /* Reparse point tag (see WIM_IO_REPARSE_TAG_* values) */
49 /* Length of reparse data, not including the 8-byte header (ReparseTag,
50 * ReparseDataLength, ReparseReserved) */
56 /* Flags (only for WIM_IO_REPARSE_TAG_SYMLINK reparse points).
57 * SYMBOLIC_LINK_RELATIVE means this is a relative symbolic link;
58 * otherwise should be set to 0. */
59 #define SYMBOLIC_LINK_RELATIVE 0x00000001
62 /* Pointer to the substitute name of the link (UTF-16LE). */
63 utf16lechar *substitute_name;
65 /* Pointer to the print name of the link (UTF-16LE). */
66 utf16lechar *print_name;
68 /* Number of bytes of the substitute name, not including null terminator
70 u16 substitute_name_nbytes;
72 /* Number of bytes of the print name, not including null terminator if
74 u16 print_name_nbytes;
78 parse_reparse_data(const u8 * restrict rpbuf, u16 rpbuflen,
79 struct reparse_data * restrict rpdata);
82 make_reparse_buffer(const struct reparse_data * restrict rpdata,
84 u16 * restrict rpbuflen_ret);
87 wim_inode_get_reparse_data(const struct wim_inode * restrict inode,
89 u16 * restrict rpbuflen_ret,
90 struct wim_lookup_table_entry *lte_override);
94 wim_inode_readlink(const struct wim_inode * restrict inode, char * restrict buf,
95 size_t buf_len, struct wim_lookup_table_entry *lte);
98 wim_inode_set_symlink(struct wim_inode *inode, const char *target,
99 struct wim_lookup_table *lookup_table);
102 #endif /* _WIMLIB_REPARSE_H */