18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * These structs are used by the system-use-sharing protocol, in which the
48c2ecf20Sopenharmony_ci * Rock Ridge extensions are embedded.  It is quite possible that other
58c2ecf20Sopenharmony_ci * extensions are present on the disk, and this is fine as long as they
68c2ecf20Sopenharmony_ci * all use SUSP
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct SU_SP_s {
108c2ecf20Sopenharmony_ci	__u8 magic[2];
118c2ecf20Sopenharmony_ci	__u8 skip;
128c2ecf20Sopenharmony_ci} __attribute__ ((packed));
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct SU_CE_s {
158c2ecf20Sopenharmony_ci	__u8 extent[8];
168c2ecf20Sopenharmony_ci	__u8 offset[8];
178c2ecf20Sopenharmony_ci	__u8 size[8];
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct SU_ER_s {
218c2ecf20Sopenharmony_ci	__u8 len_id;
228c2ecf20Sopenharmony_ci	__u8 len_des;
238c2ecf20Sopenharmony_ci	__u8 len_src;
248c2ecf20Sopenharmony_ci	__u8 ext_ver;
258c2ecf20Sopenharmony_ci	__u8 data[];
268c2ecf20Sopenharmony_ci} __attribute__ ((packed));
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistruct RR_RR_s {
298c2ecf20Sopenharmony_ci	__u8 flags[1];
308c2ecf20Sopenharmony_ci} __attribute__ ((packed));
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistruct RR_PX_s {
338c2ecf20Sopenharmony_ci	__u8 mode[8];
348c2ecf20Sopenharmony_ci	__u8 n_links[8];
358c2ecf20Sopenharmony_ci	__u8 uid[8];
368c2ecf20Sopenharmony_ci	__u8 gid[8];
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistruct RR_PN_s {
408c2ecf20Sopenharmony_ci	__u8 dev_high[8];
418c2ecf20Sopenharmony_ci	__u8 dev_low[8];
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct SL_component {
458c2ecf20Sopenharmony_ci	__u8 flags;
468c2ecf20Sopenharmony_ci	__u8 len;
478c2ecf20Sopenharmony_ci	__u8 text[];
488c2ecf20Sopenharmony_ci} __attribute__ ((packed));
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistruct RR_SL_s {
518c2ecf20Sopenharmony_ci	__u8 flags;
528c2ecf20Sopenharmony_ci	struct SL_component link;
538c2ecf20Sopenharmony_ci} __attribute__ ((packed));
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistruct RR_NM_s {
568c2ecf20Sopenharmony_ci	__u8 flags;
578c2ecf20Sopenharmony_ci	char name[];
588c2ecf20Sopenharmony_ci} __attribute__ ((packed));
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistruct RR_CL_s {
618c2ecf20Sopenharmony_ci	__u8 location[8];
628c2ecf20Sopenharmony_ci};
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistruct RR_PL_s {
658c2ecf20Sopenharmony_ci	__u8 location[8];
668c2ecf20Sopenharmony_ci};
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cistruct stamp {
698c2ecf20Sopenharmony_ci	__u8 time[7];		/* actually 6 unsigned, 1 signed */
708c2ecf20Sopenharmony_ci} __attribute__ ((packed));
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_cistruct RR_TF_s {
738c2ecf20Sopenharmony_ci	__u8 flags;
748c2ecf20Sopenharmony_ci	struct stamp times[];	/* Variable number of these beasts */
758c2ecf20Sopenharmony_ci} __attribute__ ((packed));
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* Linux-specific extension for transparent decompression */
788c2ecf20Sopenharmony_cistruct RR_ZF_s {
798c2ecf20Sopenharmony_ci	__u8 algorithm[2];
808c2ecf20Sopenharmony_ci	__u8 parms[2];
818c2ecf20Sopenharmony_ci	__u8 real_size[8];
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/*
858c2ecf20Sopenharmony_ci * These are the bits and their meanings for flags in the TF structure.
868c2ecf20Sopenharmony_ci */
878c2ecf20Sopenharmony_ci#define TF_CREATE 1
888c2ecf20Sopenharmony_ci#define TF_MODIFY 2
898c2ecf20Sopenharmony_ci#define TF_ACCESS 4
908c2ecf20Sopenharmony_ci#define TF_ATTRIBUTES 8
918c2ecf20Sopenharmony_ci#define TF_BACKUP 16
928c2ecf20Sopenharmony_ci#define TF_EXPIRATION 32
938c2ecf20Sopenharmony_ci#define TF_EFFECTIVE 64
948c2ecf20Sopenharmony_ci#define TF_LONG_FORM 128
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistruct rock_ridge {
978c2ecf20Sopenharmony_ci	__u8 signature[2];
988c2ecf20Sopenharmony_ci	__u8 len;
998c2ecf20Sopenharmony_ci	__u8 version;
1008c2ecf20Sopenharmony_ci	union {
1018c2ecf20Sopenharmony_ci		struct SU_SP_s SP;
1028c2ecf20Sopenharmony_ci		struct SU_CE_s CE;
1038c2ecf20Sopenharmony_ci		struct SU_ER_s ER;
1048c2ecf20Sopenharmony_ci		struct RR_RR_s RR;
1058c2ecf20Sopenharmony_ci		struct RR_PX_s PX;
1068c2ecf20Sopenharmony_ci		struct RR_PN_s PN;
1078c2ecf20Sopenharmony_ci		struct RR_SL_s SL;
1088c2ecf20Sopenharmony_ci		struct RR_NM_s NM;
1098c2ecf20Sopenharmony_ci		struct RR_CL_s CL;
1108c2ecf20Sopenharmony_ci		struct RR_PL_s PL;
1118c2ecf20Sopenharmony_ci		struct RR_TF_s TF;
1128c2ecf20Sopenharmony_ci		struct RR_ZF_s ZF;
1138c2ecf20Sopenharmony_ci	} u;
1148c2ecf20Sopenharmony_ci};
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define RR_PX 1			/* POSIX attributes */
1178c2ecf20Sopenharmony_ci#define RR_PN 2			/* POSIX devices */
1188c2ecf20Sopenharmony_ci#define RR_SL 4			/* Symbolic link */
1198c2ecf20Sopenharmony_ci#define RR_NM 8			/* Alternate Name */
1208c2ecf20Sopenharmony_ci#define RR_CL 16		/* Child link */
1218c2ecf20Sopenharmony_ci#define RR_PL 32		/* Parent link */
1228c2ecf20Sopenharmony_ci#define RR_RE 64		/* Relocation directory */
1238c2ecf20Sopenharmony_ci#define RR_TF 128		/* Timestamps */
124