"Fossies" - the Fresh Open Source Software Archive

Member "xorriso-1.5.4/xorriso/check_media.h" (30 Jan 2021, 7022 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "check_media.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.5.2_vs_1.5.4.

    1 
    2 /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
    3 
    4    Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net>
    5 
    6    Provided under GPL version 2 or later.
    7 
    8    This file contains declarations of classes SpotlistiteM, SpotlisT,
    9    SectorbitmaP, CheckmediajoB which represent media checks and their outcome.
   10 */
   11 
   12 
   13 #ifndef Xorriso_pvt_check_includeD
   14 #define Xorriso_pvt_check_includeD yes
   15 
   16 struct SpotlisT;          /* List of intervals with different read qualities */
   17 struct CheckmediajoB;     /* Parameters for Xorriso_check_media() */
   18 
   19 int Xorriso_check_media_setup_job(struct XorrisO *xorriso,
   20                               struct CheckmediajoB *job,
   21                               char **argv, int old_idx, int end_idx, int flag);
   22 
   23 int Xorriso_sectormap_to_spotlist(struct XorrisO *xorriso,
   24                                   struct CheckmediajoB *job,
   25                                   struct SpotlisT **spotlist,
   26                                   int flag);
   27 
   28 /* @param flag bit0= mark untested areas as valid
   29 */
   30 int Xorriso_spotlist_to_sectormap(struct XorrisO *xorriso,
   31                                   struct SpotlisT *spotlist,
   32                                   int read_chunk,
   33                                   struct SectorbitmaP **map,
   34                                   int flag);
   35 
   36 /* Opens the -check_media data copy in for reading and writing
   37 */
   38 int Xorriso_open_job_data_to(struct XorrisO *xorriso,
   39                              struct CheckmediajoB *job, int flag);
   40 
   41 /* @param report Buffer of at least 10*SfileadrL
   42    @param flag bit0= only report non-default settings
   43    @return <=0 error , 1 ok , 2 with bit0: every option is on default setting
   44 */
   45 int Xorriso_check_media_list_job(struct XorrisO *xorriso,
   46                                  struct CheckmediajoB *job,
   47                                  char *report, int flag);
   48 
   49 int Xorriso_update_in_sector_map(struct XorrisO *xorriso,
   50                                  struct SpotlisT *spotlist, int read_chunk,
   51                                  struct CheckmediajoB *job, int flag);
   52 
   53 
   54 /* Distiniction between valid and invalid sectors */
   55 struct SectorbitmaP {
   56  int sectors;
   57  int sector_size;
   58  unsigned char *map;
   59  int map_size;
   60 };
   61 
   62 int Spotlist_new(struct SpotlisT **o, int flag);
   63 
   64 int Spotlist_destroy(struct SpotlisT **o, int flag);
   65 
   66 int Spotlist_add_item(struct SpotlisT *o, int start_lba, int blocks,
   67                       int quality, int flag);
   68 
   69 int Spotlist_count(struct SpotlisT *o, int flag);
   70 
   71 int Spotlist_block_count(struct SpotlisT *o, int flag);
   72 
   73 int Spotlist_sector_size(struct SpotlisT *o, int read_chunk, int flag);
   74 
   75 int Spotlist_get_item(struct SpotlisT *o, int idx,
   76                       int *start_lba, int *blocks, int *quality, int flag);
   77 
   78 char *Spotlist__quality_name(int quality, char name[80], int bad_limit,
   79                              int flag);
   80 
   81 
   82 #define Xorriso_read_quality_gooD         0x7fffffff
   83 #define Xorriso_read_quality_md5_matcH    0x70000000
   84 #define Xorriso_read_quality_sloW         0x60000000
   85 #define Xorriso_read_quality_partiaL      0x50000000
   86 #define Xorriso_read_quality_valiD        0x40000000
   87 #define Xorriso_read_quality_untesteD     0x3fffffff
   88 #define Xorriso_read_quality_md5_mismatcH 0x38000000
   89 #define Xorriso_read_quality_invaliD      0x30000000
   90 #define Xorriso_read_quality_tao_enD      0x20000000
   91 #define Xorriso_read_quality_off_tracK    0x10000000
   92 #define Xorriso_read_quality_unreadablE   0x00000000
   93 
   94 
   95 struct CheckmediajoB {
   96  int use_dev;        /* 0= use indev , 1= use outdev , 2= use sector map*/
   97  
   98  int min_lba;        /* if >=0 : begin checking at this address */ 
   99  int max_lba;        /* if >=0 : read up to this address, else use mode */
  100  
  101  int min_block_size; /* granularity desired by user
  102                      */
  103  int async_chunks;   /* >= 2 : run MD5 thread, use given number of chunks
  104                         else : synchronous
  105                      */
  106  int mode;           /* 0= track by track
  107                         1= single sweep over libisoburn medium capacity
  108                         2= single sweep over libburn medium capacity
  109                      */
  110  time_t start_time;  
  111  int time_limit;     /* Number of seconds after which to abort */
  112  
  113  int item_limit;     /* Maximum number of medium check list items as result */
  114  
  115  char abort_file_path[SfileadrL];
  116 
  117  char data_to_path[SfileadrL];
  118  int data_to_fd;
  119  off_t data_to_offset; /* usually 0 with image copy, negative with file copy */
  120  off_t data_to_limit;  /* used with file copy */
  121  int data_to_skip;     /* number of bytes to skip on writing. < 2048 */
  122  int patch_lba0;
  123  int patch_lba0_msc1;
  124 
  125  char sector_map_path[SfileadrL];
  126  struct SectorbitmaP *sector_map;
  127  int map_with_volid;  /* 0=add quick toc to map file,
  128                          1=read ISO heads for toc
  129                       */
  130 
  131  int retry;          /* -1= only try full read_chunk, 1=retry with 2k blocks
  132                          0= retry with CD, full chunk else
  133                       */
  134 
  135  int report_mode;    /* 0= print MCL items
  136                         1= print damaged files
  137                      */
  138 
  139  char event_severity[20]; /* If not "ALL": trigger event of given severity
  140                              at the end of a check job if bad blocks were
  141                              discovered.
  142                            */
  143 
  144  double slow_threshold_seq; /* Time limit in seconds for the decision whether
  145                                a read operation is considered slow. This does
  146                                not apply to thr first read of an interval.
  147                              */
  148 };
  149 
  150 int Checkmediajob_new(struct CheckmediajoB **o, int flag);
  151 
  152 int Checkmediajob_destroy(struct CheckmediajoB **o, int flag);
  153 
  154 int Checkmediajob_copy(struct CheckmediajoB *from, struct CheckmediajoB *to,
  155                        int flag);
  156 
  157 int Sectorbitmap_new(struct SectorbitmaP **o, int sectors, int sector_size,
  158                      int flag);
  159 int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag);
  160 int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
  161                            int *os_errno, int flag);
  162 int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *info,
  163                          char *msg, int *os_errno, int flag);
  164 int Sectorbitmap_set(struct SectorbitmaP *o, int sector, int flag);
  165 int Sectorbitmap_set_range(struct SectorbitmaP *o,
  166                            int start_sector, int sectors, int flag);
  167 int Sectorbitmap_is_set(struct SectorbitmaP *o, int sector, int flag);
  168 int Sectorbitmap_bytes_are_set(struct SectorbitmaP *o,
  169                                off_t start_byte, off_t end_byte, int flag);
  170 
  171 int Sectorbitmap_get_layout(struct SectorbitmaP *o,
  172                            int *sectors, int *sector_size, int flag);
  173 
  174 int Sectorbitmap_copy(struct SectorbitmaP *from, struct SectorbitmaP *to,
  175                       int flag);
  176 
  177 int Sectorbitmap_clone(struct SectorbitmaP *from, struct SectorbitmaP **clone,
  178                       int flag);
  179 
  180 #endif /* ! Xorriso_pvt_check_includeD */
  181