1 2 /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 4 Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> 5 6 Provided under GPL version 2 or later. 7 8 This file contains declarations of classes: 9 10 - SplitparT which represents byte intervals of data files. 11 12 - DirseQ which crawls along a directory's content list. 13 14 - ExclusionS which manages the list of excluded file paths and 15 leaf patterns. 16 17 - Xorriso_lsT which provides a generic double-linked list. 18 19 - LinkiteM, PermiteM which temporarily record relations and states. 20 21 */ 22 23 24 #ifndef Xorriso_pvt_auxobj_includeD 25 #define Xorriso_pvt_auxobj_includeD yes 26 27 struct SplitparT; 28 29 int Splitparts_new(struct SplitparT **o, int count, int flag); 30 31 int Splitparts_destroy(struct SplitparT **o, int count, int flag); 32 33 int Splitparts_set(struct SplitparT *o, int idx, 34 char *name, int partno, int total_parts, 35 off_t offset, off_t bytes, off_t total_bytes, int flag); 36 37 int Splitparts_get(struct SplitparT *o, int idx, char **name, int *partno, 38 int *total_parts, off_t *offset, off_t *bytes, 39 off_t *total_bytes, int flag); 40 41 int Splitpart__parse(char *name, int *partno, int *total_parts, 42 off_t *offset, off_t *bytes, off_t *total_bytes, int flag); 43 44 int Splitpart__is_part_path(char *path, int flag); 45 46 int Splitpart__compose(char *adr, int partno, int total_parts, 47 off_t offset, off_t bytes, off_t total_bytes, int flag); 48 49 int Splitpart__read_next_num(char *base_pt, char **next_pt, off_t *num, 50 int flag); 51 52 int Splitparts_sort(struct SplitparT *o, int count, int flag); 53 54 55 56 struct DirseQ; 57 58 int Dirseq_new(struct DirseQ **o, char *adr, int flag); 59 60 int Dirseq_destroy(struct DirseQ **o, int flag); 61 62 int Dirseq_next_adr(struct DirseQ *o, char reply[SfileadrL], int flag); 63 64 int Dirseq_rewind(struct DirseQ *o, int flag); 65 66 67 68 struct Xorriso_lsT { 69 char *text; 70 struct Xorriso_lsT *prev,*next; 71 }; 72 73 /** Create a new list item with arbitrary byte content. 74 @param lstring The newly created object or NULL on failure 75 @param data An array of bytes to be copied into the new object 76 @param data_len Number of bytes to be copied 77 @param link Xorriso_lsT object to which the new object shall be linked 78 @param flag Bitfield for control purposes 79 bit0= insert before link rather than after it 80 bit1= do not copy data (e.g. because *data is invalid) 81 bit2= attach data directly by pointer rather than by copying 82 @return <=0 error, 1 ok 83 */ 84 int Xorriso_lst_new_binary(struct Xorriso_lsT **lstring, char *data, 85 int data_len, struct Xorriso_lsT *link, int flag); 86 87 88 /** Create a new list item with a 0-terminated text as content. 89 @param lstring The newly created object or NULL on failure 90 @param text A 0-terminated array of bytes 91 @param link Xorriso_lsT object to which the new object shall be linked 92 @param flag see Xorriso_lst_new_binary 93 @return <=0 error, 1 ok 94 */ 95 int Xorriso_lst_new(struct Xorriso_lsT **lstring, char *text, 96 struct Xorriso_lsT *link, int flag); 97 98 99 /** Create a new list item at the end of a given list. 100 @param entry Contains as input a pointer to a pointer to any existing 101 list item. As output this list item pointer may be 102 changed to the address of the new list item: 103 if ((*entry == 0) || (flag & 1)) 104 @param data An array of bytes to be copied into the new object 105 @param data_len Number of bytes to be copied 106 @param flag Bitfield for control purposes 107 bit0= Return new object address in *entry 108 bit1= do not copy data (e.g. because *data is invalid) 109 bit2= attach data directly by pointer rather than by copying 110 @return <=0 error, 1 ok 111 */ 112 int Xorriso_lst_append_binary(struct Xorriso_lsT **entry, 113 char *data, int data_len, int flag); 114 115 116 /** Destroy a single list item and connect its eventual list neighbors. 117 @param lstring pointer to the pointer to be freed and set to NULL 118 @param flag unused yet, submit 0 119 @return 0= *lstring was alredy NULL, 1= ok 120 */ 121 int Xorriso_lst_destroy(struct Xorriso_lsT **lstring, int flag); 122 123 124 struct Xorriso_lsT *Xorriso_lst_get_next(struct Xorriso_lsT *entry, int flag); 125 126 struct Xorriso_lsT *Xorriso_lst_get_prev(struct Xorriso_lsT *entry, int flag); 127 128 char *Xorriso_lst_get_text(struct Xorriso_lsT *entry, int flag); 129 130 int Xorriso_lst_detach_text(struct Xorriso_lsT *entry, int flag); 131 132 int Xorriso_lst_get_last(struct Xorriso_lsT *entry, struct Xorriso_lsT **last, 133 int flag); 134 135 int Xorriso_lst_concat(struct Xorriso_lsT *first, struct Xorriso_lsT *second, 136 int flag); 137 138 139 int Exclusions_new(struct ExclusionS **o, int flag); 140 141 int Exclusions_destroy(struct ExclusionS **o, int flag); 142 143 int Exclusions_get_descrs(struct ExclusionS *o, 144 struct Xorriso_lsT **not_paths_descr, 145 struct Xorriso_lsT **not_leafs_descr, int flag); 146 147 /* @param flag bit0= whole subtree is banned with -not_paths 148 @return 0=no match , 1=not_paths , 2=not_leafs, <0=error 149 */ 150 int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag); 151 152 int Exclusions_add_not_leafs(struct ExclusionS *o, char *not_leafs_descr, 153 regex_t *re, int flag); 154 155 int Exclusions_add_not_paths(struct ExclusionS *o, int descrc, char **descrs, 156 int pathc, char **paths, int flag); 157 158 159 160 struct LinkiteM; /* Trace of hops during symbolic link resolution */ 161 162 int Linkitem_new(struct LinkiteM **o, char *link_path, dev_t target_dev, 163 ino_t target_ino, struct LinkiteM *next, int flag); 164 165 int Linkitem_destroy(struct LinkiteM **o, int flag); 166 167 int Linkitem_reset_stack(struct LinkiteM **o, struct LinkiteM *to, int flag); 168 169 int Linkitem_find(struct LinkiteM *stack, dev_t target_dev, ino_t target_ino, 170 struct LinkiteM **result, int flag); 171 172 int Linkitem_get_link_count(struct LinkiteM *item, int flag); 173 174 175 struct PermiteM; /* Stack of temporarily altered access permissions */ 176 177 int Permstack_push(struct PermiteM **o, char *disk_path, struct stat *stbuf, 178 int flag); 179 180 int Permstack_pop(struct PermiteM **o, struct PermiteM *stopper, 181 struct XorrisO *xorriso, int flag); 182 183 184 #endif /* ! Xorriso_pvt_auxobj_includeD */ 185 186