libcdio  0.83
rock.h
Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005, 2006 2008 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 
00038 /* MSYS 1.0.10 with MinGW 3.4.2 (and perhaps others) don't have
00039    S_ISSOCK() or S_ISLNK() macros, so we'll roll our own. */
00040 #if !defined(HAVE_S_ISSOCK) && !defined(S_ISSOCK)
00041 #define S_ISSOCK(st_mode) ((((st_mode)) & 0170000) == (0140000))
00042 #endif
00043 
00044 #if !defined(HAVE_S_ISLNK) && !defined(S_ISLNK)
00045 #define S_ISLNK(st_mode) ((((st_mode)) & 0170000) == (0010000))
00046 #endif
00047 
00053 extern enum iso_rock_enums {
00054   ISO_ROCK_IRUSR  = 000400,   
00055   ISO_ROCK_IWUSR  = 000200,   
00056   ISO_ROCK_IXUSR  = 000100,   
00057   ISO_ROCK_IRGRP  = 000040,   
00058   ISO_ROCK_IWGRP  = 000020,   
00059   ISO_ROCK_IXGRP  = 000010,   
00060   ISO_ROCK_IROTH  = 000004,   
00061   ISO_ROCK_IWOTH  = 000002,   
00062   ISO_ROCK_IXOTH  = 000001,   
00064   ISO_ROCK_ISUID  = 004000,   
00065   ISO_ROCK_ISGID  = 002000,   
00066   ISO_ROCK_ISVTX  = 001000,   
00068   ISO_ROCK_ISSOCK = 0140000,  
00069   ISO_ROCK_ISLNK  = 0120000,  
00070   ISO_ROCK_ISREG  = 0100000,  
00071   ISO_ROCK_ISBLK  = 060000,   
00072   ISO_ROCK_ISCHR  = 020000,   
00073   ISO_ROCK_ISDIR  = 040000,   
00074   ISO_ROCK_ISFIFO = 010000    
00075 } iso_rock_enums;
00076 
00077 #define ISO_ROCK_IRUSR    000400  
00078 #define ISO_ROCK_IWUSR    000200  
00079 #define ISO_ROCK_IXUSR    000100  
00080 #define ISO_ROCK_IRGRP    000040  
00081 #define ISO_ROCK_IWGRP    000020  
00082 #define ISO_ROCK_IXGRP    000010  
00083 #define ISO_ROCK_IROTH    000004  
00084 #define ISO_ROCK_IWOTH    000002  
00085 #define ISO_ROCK_IXOTH    000001  
00087 #define ISO_ROCK_ISUID    004000  
00088 #define ISO_ROCK_ISGID    002000  
00089 #define ISO_ROCK_ISVTX    001000  
00091 #define ISO_ROCK_ISSOCK  0140000  
00092 #define ISO_ROCK_ISLNK   0120000  
00093 #define ISO_ROCK_ISREG   0100000  
00094 #define ISO_ROCK_ISBLK    060000  
00095 #define ISO_ROCK_ISCHR    020000  
00096 #define ISO_ROCK_ISDIR    040000  
00097 #define ISO_ROCK_ISFIFO   010000  
00100 #define ISO_ROCK_ENFMT ISO_ROCK_ISGID
00101 
00102 PRAGMA_BEGIN_PACKED
00103 
00110 typedef struct iso_su_sp_s{
00111   unsigned char magic[2];
00112   uint8_t       skip;
00113 } GNUC_PACKED iso_su_sp_t;
00114 
00116 typedef struct iso_su_er_s {
00117   iso711_t      len_id;  
00118   unsigned char len_des;
00119   unsigned char len_src;
00120   iso711_t      ext_ver; 
00121   char data[EMPTY_ARRAY_SIZE];
00122 } GNUC_PACKED iso_su_er_t;
00123 
00124 typedef struct iso_su_ce_s {
00125   char extent[8];
00126   char offset[8];
00127   char size[8];
00128 } iso_su_ce_t;
00129 
00131 typedef struct iso_rock_px_s {
00132   iso733_t st_mode;       
00134   iso733_t st_nlinks;     
00136   iso733_t st_uid;        
00138   iso733_t st_gid;        
00140 } GNUC_PACKED iso_rock_px_t ;
00141 
00150 typedef struct iso_rock_pn_s {
00151   iso733_t dev_high;     
00153   iso733_t dev_low;      
00155 } GNUC_PACKED iso_rock_pn_t ;
00156 
00158 typedef enum {
00159   ISO_ROCK_SL_CONTINUE = 1,
00160   ISO_ROCK_SL_CURRENT  = 2,
00161   ISO_ROCK_SL_PARENT   = 4,
00162   ISO_ROCK_SL_ROOT     = 8
00163 } iso_rock_sl_flag_t;
00164 
00165 #define ISO_ROCK_SL_CONTINUE 1
00166 #define ISO_ROCK_SL_CURRENT  2
00167 #define ISO_ROCK_SL_PARENT   4
00168 #define ISO_ROCK_SL_ROOT     8
00169 
00170 typedef struct iso_rock_sl_part_s {
00171   uint8_t flags;
00172   uint8_t len;
00173   char text[EMPTY_ARRAY_SIZE];
00174 } GNUC_PACKED iso_rock_sl_part_t ;
00175 
00177 typedef struct iso_rock_sl_s {
00178   unsigned char flags;
00179   iso_rock_sl_part_t link;
00180 } GNUC_PACKED iso_rock_sl_t ;
00181 
00185 typedef enum {
00186   ISO_ROCK_NM_CONTINUE = 1,
00187   ISO_ROCK_NM_CURRENT  = 2,
00188   ISO_ROCK_NM_PARENT   = 4,
00189 } iso_rock_nm_flag_t;
00190 
00191 #define ISO_ROCK_NM_CONTINUE 1
00192 #define ISO_ROCK_NM_CURRENT  2
00193 #define ISO_ROCK_NM_PARENT   4
00194 
00195 
00196 typedef struct iso_rock_nm_s {
00197   unsigned char flags;
00198   char name[EMPTY_ARRAY_SIZE];
00199 } GNUC_PACKED iso_rock_nm_t ;
00200 
00202 typedef struct iso_rock_cl_s {
00203   char location[1];
00204 } GNUC_PACKED iso_rock_cl_t ;
00205 
00207 typedef struct iso_rock_pl_s {
00208   char location[1];
00209 } GNUC_PACKED iso_rock_pl_t ;
00210 
00212 typedef enum {
00213   ISO_ROCK_TF_CREATE     =  1,
00214   ISO_ROCK_TF_MODIFY     =  2,
00215   ISO_ROCK_TF_ACCESS     =  4,
00216   ISO_ROCK_TF_ATTRIBUTES =  8,
00217   ISO_ROCK_TF_BACKUP     =  16,
00218   ISO_ROCK_TF_EXPIRATION =  32,
00219   ISO_ROCK_TF_EFFECTIVE  =  64,
00220   ISO_ROCK_TF_LONG_FORM  = 128
00221 } iso_rock_tf_flag_t;
00222 
00223 /* These are the bits and their meanings for flags in the TF structure. */
00224 #define ISO_ROCK_TF_CREATE      1
00225 #define ISO_ROCK_TF_MODIFY      2
00226 #define ISO_ROCK_TF_ACCESS      4
00227 #define ISO_ROCK_TF_ATTRIBUTES  8
00228 #define ISO_ROCK_TF_BACKUP     16
00229 #define ISO_ROCK_TF_EXPIRATION 32
00230 #define ISO_ROCK_TF_EFFECTIVE  64
00231 #define ISO_ROCK_TF_LONG_FORM 128
00232 
00234 typedef struct iso_rock_tf_s {
00235   uint8_t flags; 
00236   uint8_t time_bytes[EMPTY_ARRAY_SIZE]; 
00247 } GNUC_PACKED iso_rock_tf_t ;
00248 
00250 typedef struct iso_rock_sf_s {
00251   iso733_t virtual_size_high; 
00252   iso733_t virtual_size_low;  
00253   uint8_t   table_depth;
00254 } GNUC_PACKED iso_rock_sf_t ;
00255 
00256 typedef struct iso_extension_record_s {
00257   char signature[2];   
00260   iso711_t len;        
00263   iso711_t version;    
00264   union {
00265     iso_su_sp_t    SP;  
00267     iso_su_er_t    ER;  
00269     iso_su_ce_t    CE;  
00270     iso_rock_px_t  PX;  
00271     iso_rock_pn_t  PN;  
00272     iso_rock_sl_t  SL;  
00273     iso_rock_nm_t  NM;  
00274     iso_rock_cl_t  CL;  
00275     iso_rock_pl_t  PL;  
00276     iso_rock_tf_t  TF;  
00277   } u;
00278 } GNUC_PACKED iso_extension_record_t;
00279 
00280 typedef struct iso_rock_time_s {
00281   bool          b_used;     
00283   bool          b_longdate;  
00285   union 
00286   {
00287     iso9660_ltime_t ltime;
00288     iso9660_dtime_t dtime;
00289   } t;
00290 } GNUC_PACKED iso_rock_time_t;
00291 
00292 typedef struct iso_rock_statbuf_s {
00293   bool_3way_t   b3_rock;              
00297   posix_mode_t  st_mode;              
00298   posix_nlink_t st_nlinks;            
00299   posix_uid_t   st_uid;               
00300   posix_gid_t   st_gid;               
00301   uint8_t       s_rock_offset;
00302   int           i_symlink;            
00303   int           i_symlink_max;        
00304   char         *psz_symlink;          
00306   iso_rock_time_t create;             
00307   iso_rock_time_t modify;             
00310   iso_rock_time_t access;             
00312   iso_rock_time_t attributes;         
00314   iso_rock_time_t backup;             
00315   iso_rock_time_t expiration;         
00317   iso_rock_time_t effective;          
00319   uint32_t i_rdev;                    
00323 } iso_rock_statbuf_t;
00324   
00325 PRAGMA_END_PACKED
00326 
00328 int get_rock_ridge_filename(iso9660_dir_t * de, /*out*/ char * retname, 
00329                             /*out*/ iso9660_stat_t *p_stat);
00330 
00331   int parse_rock_ridge_stat(iso9660_dir_t *de, /*out*/ iso9660_stat_t *p_stat);
00332 
00336   mode_t 
00337   iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr);
00338 
00372 const char *iso9660_get_rock_attr_str(posix_mode_t st_mode);
00373 
00378 extern iso_rock_nm_flag_t iso_rock_nm_flag;
00379 extern iso_rock_sl_flag_t iso_rock_sl_flag;
00380 extern iso_rock_tf_flag_t iso_rock_tf_flag;
00381 
00382 #ifdef __cplusplus
00383 }
00384 #endif /* __cplusplus */
00385 
00386 #endif /* __ISO_ROCK_H__ */
00387 
00388 /* 
00389  * Local variables:
00390  *  c-file-style: "gnu"
00391  *  tab-width: 8
00392  *  indent-tabs-mode: nil
00393  * End:
00394  */

Generated for libcdio by doxygen 1.8.0