libcdio  0.90
rock.h
Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005, 2006 2008, 2012 Rocky Bernstein <rocky@gnu.org>
00003 
00004     See also rock.c by Eric Youngdale (1993) from GNU/Linux 
00005     This is Copyright 1993 Yggdrasil Computing, Incorporated
00006 
00007     This program is free software: you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation, either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00028 
00029 #ifndef CDIO_ROCK_H_
00030 #define CDIO_ROCK_H_
00031 
00032 #include <cdio/types.h>
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif /* __cplusplus */
00037 
00043 extern enum iso_rock_enums {
00044   ISO_ROCK_IRUSR  = 000400,   
00045   ISO_ROCK_IWUSR  = 000200,   
00046   ISO_ROCK_IXUSR  = 000100,   
00047   ISO_ROCK_IRGRP  = 000040,   
00048   ISO_ROCK_IWGRP  = 000020,   
00049   ISO_ROCK_IXGRP  = 000010,   
00050   ISO_ROCK_IROTH  = 000004,   
00051   ISO_ROCK_IWOTH  = 000002,   
00052   ISO_ROCK_IXOTH  = 000001,   
00054   ISO_ROCK_ISUID  = 004000,   
00055   ISO_ROCK_ISGID  = 002000,   
00056   ISO_ROCK_ISVTX  = 001000,   
00058   ISO_ROCK_ISSOCK = 0140000,  
00059   ISO_ROCK_ISLNK  = 0120000,  
00060   ISO_ROCK_ISREG  = 0100000,  
00061   ISO_ROCK_ISBLK  = 060000,   
00062   ISO_ROCK_ISCHR  = 020000,   
00063   ISO_ROCK_ISDIR  = 040000,   
00064   ISO_ROCK_ISFIFO = 010000    
00065 } iso_rock_enums;
00066 
00067 #define ISO_ROCK_IRUSR    000400  
00068 #define ISO_ROCK_IWUSR    000200  
00069 #define ISO_ROCK_IXUSR    000100  
00070 #define ISO_ROCK_IRGRP    000040  
00071 #define ISO_ROCK_IWGRP    000020  
00072 #define ISO_ROCK_IXGRP    000010  
00073 #define ISO_ROCK_IROTH    000004  
00074 #define ISO_ROCK_IWOTH    000002  
00075 #define ISO_ROCK_IXOTH    000001  
00077 #define ISO_ROCK_ISUID    004000  
00078 #define ISO_ROCK_ISGID    002000  
00079 #define ISO_ROCK_ISVTX    001000  
00081 #define ISO_ROCK_ISSOCK  0140000  
00082 #define ISO_ROCK_ISLNK   0120000  
00083 #define ISO_ROCK_ISREG   0100000  
00084 #define ISO_ROCK_ISBLK    060000  
00085 #define ISO_ROCK_ISCHR    020000  
00086 #define ISO_ROCK_ISDIR    040000  
00087 #define ISO_ROCK_ISFIFO   010000  
00090 #define ISO_ROCK_ENFMT ISO_ROCK_ISGID
00091 
00092 PRAGMA_BEGIN_PACKED
00093 
00100 typedef struct iso_su_sp_s{
00101   unsigned char magic[2];
00102   uint8_t       skip;
00103 } GNUC_PACKED iso_su_sp_t;
00104 
00106 typedef struct iso_su_er_s {
00107   iso711_t      len_id;  
00108   unsigned char len_des;
00109   unsigned char len_src;
00110   iso711_t      ext_ver; 
00111   char data[EMPTY_ARRAY_SIZE];
00112 } GNUC_PACKED iso_su_er_t;
00113 
00114 typedef struct iso_su_ce_s {
00115   char extent[8];
00116   char offset[8];
00117   char size[8];
00118 } iso_su_ce_t;
00119 
00121 typedef struct iso_rock_px_s {
00122   iso733_t st_mode;       
00124   iso733_t st_nlinks;     
00126   iso733_t st_uid;        
00128   iso733_t st_gid;        
00130 } GNUC_PACKED iso_rock_px_t ;
00131 
00140 typedef struct iso_rock_pn_s {
00141   iso733_t dev_high;     
00143   iso733_t dev_low;      
00145 } GNUC_PACKED iso_rock_pn_t ;
00146 
00148 typedef enum {
00149   ISO_ROCK_SL_CONTINUE = 1,
00150   ISO_ROCK_SL_CURRENT  = 2,
00151   ISO_ROCK_SL_PARENT   = 4,
00152   ISO_ROCK_SL_ROOT     = 8
00153 } iso_rock_sl_flag_t;
00154 
00155 #define ISO_ROCK_SL_CONTINUE 1
00156 #define ISO_ROCK_SL_CURRENT  2
00157 #define ISO_ROCK_SL_PARENT   4
00158 #define ISO_ROCK_SL_ROOT     8
00159 
00160 typedef struct iso_rock_sl_part_s {
00161   uint8_t flags;
00162   uint8_t len;
00163   char text[EMPTY_ARRAY_SIZE];
00164 } GNUC_PACKED iso_rock_sl_part_t ;
00165 
00167 typedef struct iso_rock_sl_s {
00168   unsigned char flags;
00169   iso_rock_sl_part_t link;
00170 } GNUC_PACKED iso_rock_sl_t ;
00171 
00175 typedef enum {
00176   ISO_ROCK_NM_CONTINUE = 1,
00177   ISO_ROCK_NM_CURRENT  = 2,
00178   ISO_ROCK_NM_PARENT   = 4,
00179 } iso_rock_nm_flag_t;
00180 
00181 #define ISO_ROCK_NM_CONTINUE 1
00182 #define ISO_ROCK_NM_CURRENT  2
00183 #define ISO_ROCK_NM_PARENT   4
00184 
00185 
00186 typedef struct iso_rock_nm_s {
00187   unsigned char flags;
00188   char name[EMPTY_ARRAY_SIZE];
00189 } GNUC_PACKED iso_rock_nm_t ;
00190 
00192 typedef struct iso_rock_cl_s {
00193   char location[1];
00194 } GNUC_PACKED iso_rock_cl_t ;
00195 
00197 typedef struct iso_rock_pl_s {
00198   char location[1];
00199 } GNUC_PACKED iso_rock_pl_t ;
00200 
00202 typedef enum {
00203   ISO_ROCK_TF_CREATE     =  1,
00204   ISO_ROCK_TF_MODIFY     =  2,
00205   ISO_ROCK_TF_ACCESS     =  4,
00206   ISO_ROCK_TF_ATTRIBUTES =  8,
00207   ISO_ROCK_TF_BACKUP     =  16,
00208   ISO_ROCK_TF_EXPIRATION =  32,
00209   ISO_ROCK_TF_EFFECTIVE  =  64,
00210   ISO_ROCK_TF_LONG_FORM  = 128
00211 } iso_rock_tf_flag_t;
00212 
00213 /* These are the bits and their meanings for flags in the TF structure. */
00214 #define ISO_ROCK_TF_CREATE      1
00215 #define ISO_ROCK_TF_MODIFY      2
00216 #define ISO_ROCK_TF_ACCESS      4
00217 #define ISO_ROCK_TF_ATTRIBUTES  8
00218 #define ISO_ROCK_TF_BACKUP     16
00219 #define ISO_ROCK_TF_EXPIRATION 32
00220 #define ISO_ROCK_TF_EFFECTIVE  64
00221 #define ISO_ROCK_TF_LONG_FORM 128
00222 
00224 typedef struct iso_rock_tf_s {
00225   uint8_t flags; 
00226   uint8_t time_bytes[EMPTY_ARRAY_SIZE]; 
00237 } GNUC_PACKED iso_rock_tf_t ;
00238 
00240 typedef struct iso_rock_sf_s {
00241   iso733_t virtual_size_high; 
00242   iso733_t virtual_size_low;  
00243   uint8_t   table_depth;
00244 } GNUC_PACKED iso_rock_sf_t ;
00245 
00246 typedef struct iso_extension_record_s {
00247   char signature[2];   
00250   iso711_t len;        
00253   iso711_t version;    
00254   union {
00255     iso_su_sp_t    SP;  
00257     iso_su_er_t    ER;  
00259     iso_su_ce_t    CE;  
00260     iso_rock_px_t  PX;  
00261     iso_rock_pn_t  PN;  
00262     iso_rock_sl_t  SL;  
00263     iso_rock_nm_t  NM;  
00264     iso_rock_cl_t  CL;  
00265     iso_rock_pl_t  PL;  
00266     iso_rock_tf_t  TF;  
00267   } u;
00268 } GNUC_PACKED iso_extension_record_t;
00269 
00270 typedef struct iso_rock_time_s {
00271   bool          b_used;     
00273   bool          b_longdate;  
00275   union 
00276   {
00277     iso9660_ltime_t ltime;
00278     iso9660_dtime_t dtime;
00279   } t;
00280 } GNUC_PACKED iso_rock_time_t;
00281 
00282 typedef struct iso_rock_statbuf_s {
00283   bool_3way_t   b3_rock;              
00287   posix_mode_t  st_mode;              
00288   posix_nlink_t st_nlinks;            
00289   posix_uid_t   st_uid;               
00290   posix_gid_t   st_gid;               
00291   uint8_t       s_rock_offset;
00292   int           i_symlink;            
00293   int           i_symlink_max;        
00294   char         *psz_symlink;          
00296   iso_rock_time_t create;             
00297   iso_rock_time_t modify;             
00300   iso_rock_time_t access;             
00302   iso_rock_time_t attributes;         
00304   iso_rock_time_t backup;             
00305   iso_rock_time_t expiration;         
00307   iso_rock_time_t effective;          
00309   uint32_t i_rdev;                    
00313 } iso_rock_statbuf_t;
00314   
00315 PRAGMA_END_PACKED
00316 
00318 int get_rock_ridge_filename(iso9660_dir_t * de, /*out*/ char * retname, 
00319                             /*out*/ iso9660_stat_t *p_stat);
00320 
00321   int parse_rock_ridge_stat(iso9660_dir_t *de, /*out*/ iso9660_stat_t *p_stat);
00322 
00326   mode_t 
00327   iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr);
00328 
00362 const char *iso9660_get_rock_attr_str(posix_mode_t st_mode);
00363 
00368 extern iso_rock_nm_flag_t iso_rock_nm_flag;
00369 extern iso_rock_sl_flag_t iso_rock_sl_flag;
00370 extern iso_rock_tf_flag_t iso_rock_tf_flag;
00371 
00372 #ifdef __cplusplus
00373 }
00374 #endif /* __cplusplus */
00375 
00376 #endif /* CDIO_ROCK_H_ */
00377 
00378 /* 
00379  * Local variables:
00380  *  c-file-style: "gnu"
00381  *  tab-width: 8
00382  *  indent-tabs-mode: nil
00383  * End:
00384  */