File indexing completed on 2024-05-12 17:22:22

0001 /*
0002     SPDX-FileCopyrightText: 2002 Shie Erlich <erlich@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2002 Rafi Yanai <yanai@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org>
0005 
0006     From the linux kernel
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef ROCK_H
0012 #define ROCK_H 1
0013 
0014 /* These structs are used by the system-use-sharing protocol, in which the
0015    Rock Ridge extensions are embedded.  It is quite possible that other
0016    extensions are present on the disk, and this is fine as long as they
0017    all use SUSP */
0018 
0019 struct SU_SP {
0020     unsigned char magic[2];
0021     unsigned char skip;
0022 };
0023 
0024 struct SU_CE {
0025     char extent[8];
0026     char offset[8];
0027     char size[8];
0028 };
0029 
0030 struct SU_ER {
0031     unsigned char len_id;
0032     unsigned char len_des;
0033     unsigned char len_src;
0034     unsigned char ext_ver;
0035     char data[1];
0036 };
0037 
0038 struct RR_RR {
0039     char flags[1];
0040 };
0041 
0042 struct RR_PX {
0043     char mode[8];
0044     char n_links[8];
0045     char uid[8];
0046     char gid[8];
0047     char serno[8];
0048 };
0049 
0050 struct RR_PN {
0051     char dev_high[8];
0052     char dev_low[8];
0053 };
0054 
0055 struct SL_component {
0056     unsigned char flags;
0057     unsigned char len;
0058     char text[1];
0059 };
0060 
0061 struct RR_SL {
0062     unsigned char flags;
0063     struct SL_component link;
0064 };
0065 
0066 struct RR_NM {
0067     unsigned char flags;
0068     char name[1];
0069 };
0070 
0071 struct RR_CL {
0072     char location[8];
0073 };
0074 
0075 struct RR_PL {
0076     char location[8];
0077 };
0078 
0079 struct stamp {
0080     char time[7];
0081 };
0082 
0083 struct RR_TF {
0084     char flags;
0085     struct stamp times[1]; /* Variable number of these beasts */
0086 };
0087 
0088 /* Linux-specific extension for transparent decompression */
0089 struct RR_ZF {
0090     char algorithm[2];
0091     char parms[2];
0092     char real_size[8];
0093 };
0094 
0095 /* These are the bits and their meanings for flags in the TF structure. */
0096 #define TF_CREATE 1
0097 #define TF_MODIFY 2
0098 #define TF_ACCESS 4
0099 #define TF_ATTRIBUTES 8
0100 #define TF_BACKUP 16
0101 #define TF_EXPIRATION 32
0102 #define TF_EFFECTIVE 64
0103 #define TF_LONG_FORM 128
0104 
0105 struct rock_ridge {
0106     char signature[2];
0107     char len; /* 711 */
0108     char version; /* 711 */
0109     union {
0110         struct SU_SP SP;
0111         struct SU_CE CE;
0112         struct SU_ER ER;
0113         struct RR_RR RR;
0114         struct RR_PX PX;
0115         struct RR_PN PN;
0116         struct RR_SL SL;
0117         struct RR_NM NM;
0118         struct RR_CL CL;
0119         struct RR_PL PL;
0120         struct RR_TF TF;
0121         struct RR_ZF ZF;
0122     } u;
0123 };
0124 
0125 #define RR_PX 1 /* POSIX attributes */
0126 #define RR_PN 2 /* POSIX devices */
0127 #define RR_SL 4 /* Symbolic link */
0128 #define RR_NM 8 /* Alternate Name */
0129 #define RR_CL 16 /* Child link */
0130 #define RR_PL 32 /* Parent link */
0131 #define RR_RE 64 /* Relocation directory */
0132 #define RR_TF 128 /* Timestamps */
0133 
0134 #endif /* ROCK_H */