rock.h

Go to the documentation of this file.
00001 /*
00002     $Id: rock_8h-source.html,v 1.6 2006/10/27 11:16:41 rocky Exp $
00003 
00004     Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
00005 
00006     See also rock.c by Eric Youngdale (1993) from GNU/Linux 
00007     This is Copyright 1993 Yggdrasil Computing, Incorporated
00008 
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00030 
00031 #ifndef __CDIO_ROCK_H__
00032 #define __CDIO_ROCK_H__
00033 
00034 #include <cdio/types.h>
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif /* __cplusplus */
00039 
00040 /* MSYS 1.0.10 with MinGW 3.4.2 (and perhaps others) don't have
00041    S_ISSOCK() or S_ISLNK() macros, so we'll roll our own. */
00042 #if !defined(HAVE_S_ISSOCK) && !defined(S_ISSOCK)
00043 #define S_ISSOCK(st_mode) ((((st_mode)) & 0170000) == (0140000))
00044 #endif
00045 
00046 #if !defined(HAVE_S_ISLNK) && !defined(S_ISLNK)
00047 #define S_ISLNK(st_mode) ((((st_mode)) & 0170000) == (0010000))
00048 #endif
00049 
00055 extern enum iso_rock_enums {
00056   ISO_ROCK_IRUSR  = 000400,   
00057   ISO_ROCK_IWUSR  = 000200,   
00058   ISO_ROCK_IXUSR  = 000100,   
00059   ISO_ROCK_IRGRP  = 000040,   
00060   ISO_ROCK_IWGRP  = 000020,   
00061   ISO_ROCK_IXGRP  = 000010,   
00062   ISO_ROCK_IROTH  = 000004,   
00063   ISO_ROCK_IWOTH  = 000002,   
00064   ISO_ROCK_IXOTH  = 000001,   
00066   ISO_ROCK_ISUID  = 004000,   
00067   ISO_ROCK_ISGID  = 002000,   
00068   ISO_ROCK_ISVTX  = 001000,   
00070   ISO_ROCK_ISSOCK = 0140000,  
00071   ISO_ROCK_ISLNK  = 0120000,  
00072   ISO_ROCK_ISREG  = 0100000,  
00073   ISO_ROCK_ISBLK  = 060000,   
00074   ISO_ROCK_ISCHR  = 020000,   
00075   ISO_ROCK_ISDIR  = 040000,   
00076   ISO_ROCK_ISFIFO = 010000    
00077 } iso_rock_enums;
00078 
00079 #define ISO_ROCK_IRUSR    000400  
00080 #define ISO_ROCK_IWUSR    000200  
00081 #define ISO_ROCK_IXUSR    000100  
00082 #define ISO_ROCK_IRGRP    000040  
00083 #define ISO_ROCK_IWGRP    000020  
00084 #define ISO_ROCK_IXGRP    000010  
00085 #define ISO_ROCK_IROTH    000004  
00086 #define ISO_ROCK_IWOTH    000002  
00087 #define ISO_ROCK_IXOTH    000001  
00089 #define ISO_ROCK_ISUID    004000  
00090 #define ISO_ROCK_ISGID    002000  
00091 #define ISO_ROCK_ISVTX    001000  
00093 #define ISO_ROCK_ISSOCK  0140000  
00094 #define ISO_ROCK_ISLNK   0120000  
00095 #define ISO_ROCK_ISREG   0100000  
00096 #define ISO_ROCK_ISBLK    060000  
00097 #define ISO_ROCK_ISCHR    020000  
00098 #define ISO_ROCK_ISDIR    040000  
00099 #define ISO_ROCK_ISFIFO   010000  
00102 #define ISO_ROCK_ENFMT ISO_ROCK_ISGID
00103 
00104 PRAGMA_BEGIN_PACKED
00105 
00112 typedef struct iso_su_sp_s{
00113   unsigned char magic[2];
00114   uint8_t       skip;
00115 } GNUC_PACKED iso_su_sp_t;
00116 
00118 typedef struct iso_su_er_s {
00119   iso711_t      len_id;  
00120   unsigned char len_des;
00121   unsigned char len_src;
00122   iso711_t      ext_ver; 
00123   char data[EMPTY_ARRAY_SIZE];
00124 } GNUC_PACKED iso_su_er_t;
00125 
00126 typedef struct iso_su_ce_s {
00127   char extent[8];
00128   char offset[8];
00129   char size[8];
00130 } iso_su_ce_t;
00131 
00133 typedef struct iso_rock_px_s {
00134   iso733_t st_mode;       
00136   iso733_t st_nlinks;     
00138   iso733_t st_uid;        
00140   iso733_t st_gid;        
00142 } GNUC_PACKED iso_rock_px_t ;
00143 
00152 typedef struct iso_rock_pn_s {
00153   iso733_t dev_high;     
00155   iso733_t dev_low;      
00157 } GNUC_PACKED iso_rock_pn_t ;
00158 
00160 typedef enum {
00161   ISO_ROCK_SL_CONTINUE = 1,
00162   ISO_ROCK_SL_CURRENT  = 2,
00163   ISO_ROCK_SL_PARENT   = 4,
00164   ISO_ROCK_SL_ROOT     = 8
00165 } iso_rock_sl_flag_t;
00166 
00167 #define ISO_ROCK_SL_CONTINUE 1
00168 #define ISO_ROCK_SL_CURRENT  2
00169 #define ISO_ROCK_SL_PARENT   4
00170 #define ISO_ROCK_SL_ROOT     8
00171 
00172 typedef struct iso_rock_sl_part_s {
00173   uint8_t flags;
00174   uint8_t len;
00175   char text[EMPTY_ARRAY_SIZE];
00176 } GNUC_PACKED iso_rock_sl_part_t ;
00177 
00179 typedef struct iso_rock_sl_s {
00180   unsigned char flags;
00181   iso_rock_sl_part_t link;
00182 } GNUC_PACKED iso_rock_sl_t ;
00183 
00187 typedef enum {
00188   ISO_ROCK_NM_CONTINUE = 1,
00189   ISO_ROCK_NM_CURRENT  = 2,
00190   ISO_ROCK_NM_PARENT   = 4,
00191 } iso_rock_nm_flag_t;
00192 
00193 #define ISO_ROCK_NM_CONTINUE 1
00194 #define ISO_ROCK_NM_CURRENT  2
00195 #define ISO_ROCK_NM_PARENT   4
00196 
00197 
00198 typedef struct iso_rock_nm_s {
00199   unsigned char flags;
00200   char name[EMPTY_ARRAY_SIZE];
00201 } GNUC_PACKED iso_rock_nm_t ;
00202 
00204 typedef struct iso_rock_cl_s {
00205   char location[1];
00206 } GNUC_PACKED iso_rock_cl_t ;
00207 
00209 typedef struct iso_rock_pl_s {
00210   char location[1];
00211 } GNUC_PACKED iso_rock_pl_t ;
00212 
00214 typedef enum {
00215   ISO_ROCK_TF_CREATE     =  1,
00216   ISO_ROCK_TF_MODIFY     =  2,
00217   ISO_ROCK_TF_ACCESS     =  4,
00218   ISO_ROCK_TF_ATTRIBUTES =  8,
00219   ISO_ROCK_TF_BACKUP     =  16,
00220   ISO_ROCK_TF_EXPIRATION =  32,
00221   ISO_ROCK_TF_EFFECTIVE  =  64,
00222   ISO_ROCK_TF_LONG_FORM  = 128
00223 } iso_rock_tf_flag_t;
00224 
00225 /* These are the bits and their meanings for flags in the TF structure. */
00226 #define ISO_ROCK_TF_CREATE      1
00227 #define ISO_ROCK_TF_MODIFY      2
00228 #define ISO_ROCK_TF_ACCESS      4
00229 #define ISO_ROCK_TF_ATTRIBUTES  8
00230 #define ISO_ROCK_TF_BACKUP     16
00231 #define ISO_ROCK_TF_EXPIRATION 32
00232 #define ISO_ROCK_TF_EFFECTIVE  64
00233 #define ISO_ROCK_TF_LONG_FORM 128
00234 
00236 typedef struct iso_rock_tf_s {
00237   uint8_t flags; 
00238   uint8_t time_bytes[EMPTY_ARRAY_SIZE]; 
00249 } GNUC_PACKED iso_rock_tf_t ;
00250 
00252 typedef struct iso_rock_sf_s {
00253   iso733_t virtual_size_high; 
00254   iso733_t virtual_size_low;  
00255   uint8_t   table_depth;
00256 } GNUC_PACKED iso_rock_sf_t ;
00257 
00258 typedef struct iso_extension_record_s {
00259   char signature[2];   
00262   iso711_t len;        
00265   iso711_t version;    
00266   union {
00267     iso_su_sp_t    SP;  
00269     iso_su_er_t    ER;  
00271     iso_su_ce_t    CE;  
00272     iso_rock_px_t  PX;  
00273     iso_rock_pn_t  PN;  
00274     iso_rock_sl_t  SL;  
00275     iso_rock_nm_t  NM;  
00276     iso_rock_cl_t  CL;  
00277     iso_rock_pl_t  PL;  
00278     iso_rock_tf_t  TF;  
00279   } u;
00280 } GNUC_PACKED iso_extension_record_t;
00281 
00282 typedef struct iso_rock_time_s {
00283   bool          b_used;     
00285   bool          b_longdate;  
00287   union 
00288   {
00289     iso9660_ltime_t ltime;
00290     iso9660_dtime_t dtime;
00291   } t;
00292 } GNUC_PACKED iso_rock_time_t;
00293 
00294 typedef struct iso_rock_statbuf_s {
00295   bool_3way_t   b3_rock;              
00299   posix_mode_t  st_mode;              
00300   posix_nlink_t st_nlinks;            
00301   posix_uid_t   st_uid;               
00302   posix_gid_t   st_gid;               
00303   uint8_t       s_rock_offset;
00304   int           i_symlink;            
00305   int           i_symlink_max;        
00306   char         *psz_symlink;          
00308   iso_rock_time_t create;             
00309   iso_rock_time_t modify;             
00312   iso_rock_time_t access;             
00314   iso_rock_time_t attributes;         
00316   iso_rock_time_t backup;             
00317   iso_rock_time_t expiration;         
00319   iso_rock_time_t effective;          
00321   uint32_t i_rdev;                    
00325 } iso_rock_statbuf_t;
00326   
00327 PRAGMA_END_PACKED
00328 
00330 int get_rock_ridge_filename(iso9660_dir_t * de, /*out*/ char * retname, 
00331                             /*out*/ iso9660_stat_t *p_stat);
00332 
00333   int parse_rock_ridge_stat(iso9660_dir_t *de, /*out*/ iso9660_stat_t *p_stat);
00334 
00338   mode_t 
00339   iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr);
00340 
00374 const char *iso9660_get_rock_attr_str(posix_mode_t st_mode);
00375 
00380 extern iso_rock_nm_flag_t iso_rock_nm_flag;
00381 extern iso_rock_sl_flag_t iso_rock_sl_flag;
00382 extern iso_rock_tf_flag_t iso_rock_tf_flag;
00383 
00384 #ifdef __cplusplus
00385 }
00386 #endif /* __cplusplus */
00387 
00388 #endif /* __ISO_ROCK_H__ */
00389 
00390 /* 
00391  * Local variables:
00392  *  c-file-style: "gnu"
00393  *  tab-width: 8
00394  *  indent-tabs-mode: nil
00395  * End:
00396  */

Generated on Fri Oct 27 06:38:08 2006 for libcdio by  doxygen 1.4.6