00001 00002 /* 00003 API definition of libisoburn. 00004 00005 Copyright 2007-2010 Vreixo Formoso Lopes <metalpain2002@yahoo.es> 00006 and Thomas Schmitt <scdbackup@gmx.net> 00007 */ 00008 00009 /** Overview 00010 00011 libisoburn is a frontend for libraries libburn and libisofs which enables 00012 creation and expansion of ISO-9660 filesystems on all CD/DVD media supported 00013 by libburn. This includes media like DVD+RW, which do not support multi-session 00014 management on media level and even plain disk files or block devices. 00015 00016 The price for that is thorough specialization on data files in ISO-9660 00017 filesystem images. So libisoburn is not suitable for audio (CD-DA) or any 00018 other CD layout which does not entirely consist of ISO-9660 sessions. 00019 00020 00021 Connector functions 00022 00023 libisofs and libburn do not depend on each other but share some interfaces 00024 by which they can cooperate. 00025 libisoburn establishes the connection between both modules by creating the 00026 necessary interface objects and attaching them to the right places. 00027 00028 00029 Wrapper functions 00030 00031 The priciple of this frontend is that you may use any call of libisofs or 00032 libburn unless it has a isoburn_*() wrapper listed in the following function 00033 documentation. 00034 00035 E.g. call isoburn_initialize() rather than iso_init(); burn_initialize(); 00036 and call isoburn_drive_scan_and_grab() rather than burn_drive_scan_and_grab(). 00037 But you may call burn_disc_get_profile() directly if you want to display 00038 the media type. 00039 00040 The wrappers will transparently provide the necessary emulations which 00041 are appropriate for particular target drives and media states. 00042 To learn about them you have to read both API descriptions: the one of 00043 the wrapper and the one of the underlying libburn or libisofs call. 00044 00045 Macros BURN_* and functions burn_*() are documented in <libburn/libburn.h> 00046 Macros ISO_* and functions iso_*() are documented in <libisofs/libisofs.h> 00047 00048 00049 Usage model 00050 00051 There may be an input drive and an output drive. Either of them may be missing 00052 with the consequence that no reading resp. writing is possible. 00053 Both drive roles can be fulfilled by the same drive. 00054 00055 Input can be a random access readable libburn drive: 00056 optical media, regular files, block devices. 00057 Output can be any writeable libburn drive: 00058 writeable optical media in burner, writeable file objects (no directories). 00059 00060 libburn demands rw-permissions to drive device file resp. file object. 00061 00062 If the input drive provides a suitable ISO RockRidge image, then its tree 00063 may be loaded into memory and can then be manipulated by libisofs API calls. 00064 The loading is done by isoburn_read_image() under control of 00065 struct isoburn_read_opts which the application obtains from libisoburn 00066 and manipulates by the family of isoburn_ropt_set_*() functions. 00067 00068 Writing of result images is controlled by libisofs related parameters 00069 in a struct isoburn_imgen_opts which the application obtains from libisoburn 00070 and manipulates by the family of isoburn_igopt_set_*() functions. 00071 00072 All multi-session aspects are handled by libisoburn according to these 00073 settings. The application does not have to analyze media state and write 00074 job parameters. It rather states its desires which libisoburn tries to 00075 fulfill, or else will refuse to start the write run. 00076 00077 00078 Setup for Growing, Modifying or Blind Growing 00079 00080 The connector function family offers alternative API calls for performing 00081 the setup for several alternative image generation strategies. 00082 00083 Growing: 00084 If input and output drive are the same, then isoburn_prepare_disc() is to 00085 be used. It will lead to an add-on session on appendable or overwriteable 00086 media with existing ISO image. With blank media it will produce a first 00087 session. 00088 00089 Modifying: 00090 If the output drive is not the input drive, and if it bears blank media 00091 or overwriteable without a valid ISO image, then one may produce a consolidated 00092 image with old and new data. This will copy file data from an eventual input 00093 drive with valid image, add any newly introduced data from the local 00094 filesystem, and produce a first session on output media. 00095 To prepare for such an image generation run, use isoburn_prepare_new_image(). 00096 00097 Blind Growing: 00098 This method reads the old image from one drive and writes the add-on session 00099 to a different drive. That output drive is nevertheless supposed to 00100 finally lead to the same media from where the session was loaded. Usually it 00101 will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program 00102 like with this classic gesture: 00103 mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev 00104 Blind growing is prepared by the call isoburn_prepare_blind_grow(). 00105 The input drive should be released immediately after this call in order 00106 to allow the consumer of the output stream to access that drive for writing. 00107 00108 After either of these setups, some peripheral libburn drive parameter settings 00109 like burn_write_opts_set_simulate(), burn_write_opts_set_multi(), 00110 burn_drive_set_speed(), burn_write_opts_set_underrun_proof() should be made. 00111 Do not set the write mode. It will be chosen by libisoburn so it matches job 00112 and media state. 00113 00114 Writing the image 00115 00116 Then one may start image generation and write threads by isoburn_disc_write(). 00117 Progress may be watched at the output drive by burn_drive_get_status() and 00118 isoburn_get_fifo_status(). 00119 00120 At some time, the output drive will be BURN_DRIVE_IDLE indicating that 00121 writing has ended. 00122 One should inquire isoburn_drive_wrote_well() to learn about overall success. 00123 00124 Finally one must call isoburn_activate_session() which will complete any 00125 eventual multi-session emulation. 00126 00127 00128 Application Constraints 00129 00130 Applications shall include libisofs/libisofs.h , libburn/libburn.h and this 00131 file itself: libisoburn/libisoburn.h . 00132 They shall link with -lisofs -lburn -lisoburn or with the .o files emerging 00133 from building those libraries from their sources. 00134 00135 Applications must use 64 bit off_t, e.g. on 32-bit Linux by defining 00136 #define _LARGEFILE_SOURCE 00137 #define _FILE_OFFSET_BITS 64 00138 or take special precautions to interface with the library by 64 bit integers 00139 where above .h files prescribe off_t. Not to use 64 bit file i/o will keep 00140 the application from producing and processing ISO images of more than 2 GB 00141 size. 00142 00143 */ 00144 00145 00146 /* API functions */ 00147 00148 00149 /** Initialize libisoburn, libisofs and libburn. 00150 Wrapper for : iso_init() and burn_initialize() 00151 @since 0.1.0 00152 @param msg A character array for eventual messages (e.g. with errors) 00153 @param flag Bitfield for control purposes (unused yet, submit 0) 00154 @return 1 indicates success, 0 is failure 00155 */ 00156 int isoburn_initialize(char msg[1024], int flag); 00157 00158 00159 /** Check whether all features of header file libisoburn.h from the given 00160 major.minor.micro revision triple can be delivered by the library version 00161 which is performing this call. 00162 An application of libisoburn can easily memorize the version of the 00163 libisofs.h header in its own code. Immediately after isoburn_initialize() 00164 it should simply do this check: 00165 if (! isoburn_is_compatible(isoburn_header_version_major, 00166 isoburn_header_version_minor, 00167 isoburn_header_version_micro, 0)) 00168 ...refuse to start the program with this dynamic library version... 00169 @since 0.1.0 00170 @param major obtained at build time 00171 @param minor obtained at build time 00172 @param micro obtained at build time 00173 @param flag Bitfield for control purposes. Unused yet. Submit 0. 00174 @return 1= library can work for caller 00175 0= library is not usable in some aspects. Caller must restrict 00176 itself to an earlier API version or must not use this libray 00177 at all. 00178 */ 00179 int isoburn_is_compatible(int major, int minor, int micro, int flag); 00180 00181 00182 /** Obtain the three release version numbers of the library. These are the 00183 numbers encountered by the application when linking with libisoburn, 00184 i.e. possibly not before run time. 00185 Better do not base the fundamental compatibility decision of an application 00186 on these numbers. For a reliable check use isoburn_is_compatible(). 00187 @since 0.1.0 00188 @param major The maturity version (0 for now, as we are still learning) 00189 @param minor The development goal version. 00190 @param micro The development step version. This has an additional meaning: 00191 00192 Pare numbers indicate a version with frozen API. I.e. you can 00193 rely on the same set of features to be present in all 00194 published releases with that major.minor.micro combination. 00195 Features of a pare release will stay available and ABI 00196 compatible as long as the SONAME of libisoburn stays "1". 00197 Currently there are no plans to ever change the SONAME. 00198 00199 Odd numbers indicate that API upgrades are in progress. 00200 I.e. new features might be already present or they might 00201 be still missing. Newly introduced features may be changed 00202 incompatibly or even be revoked before release of a pare 00203 version. 00204 So micro revisions {1,3,5,7,9} should never be used for 00205 dynamic linking unless the proper library match can be 00206 guaranteed by external circumstances. 00207 00208 @return 1 success, <=0 might in future become an error indication 00209 */ 00210 void isoburn_version(int *major, int *minor, int *micro); 00211 00212 00213 /** The minimum version of libisofs to be used with this version of libisoburn 00214 at compile time. 00215 @since 0.1.0 00216 */ 00217 #define isoburn_libisofs_req_major 0 00218 #define isoburn_libisofs_req_minor 6 00219 #define isoburn_libisofs_req_micro 26 00220 00221 /** The minimum version of libburn to be used with this version of libisoburn 00222 at compile time. 00223 @since 0.1.0 00224 */ 00225 #define isoburn_libburn_req_major 0 00226 #define isoburn_libburn_req_minor 7 00227 #define isoburn_libburn_req_micro 6 00228 00229 00230 /** The minimum version of libisofs to be used with this version of libisoburn 00231 at runtime. This is checked already in isoburn_initialize() which will 00232 refuse on outdated version. So this call is for information purposes after 00233 successful startup only. 00234 @since 0.1.0 00235 @param major isoburn_libisofs_req_major as seen at build time 00236 @param minor as seen at build time 00237 @param micro as seen at build time 00238 @return 1 success, <=0 might in future become an error indication 00239 */ 00240 int isoburn_libisofs_req(int *major, int *minor, int *micro); 00241 00242 00243 /** The minimum version of libburn to be used with this version of libisoburn 00244 at runtime. This is checked already in isoburn_initialize() which will 00245 refuse on outdated version. So this call is for information purposes after 00246 successful startup only. 00247 @since 0.1.0 00248 @param major isoburn_libburn_req_major as seen at build time 00249 @param minor as seen at build time 00250 @param micro as seen at build time 00251 @return 1 success, <=0 might in future become an error indication 00252 */ 00253 int isoburn_libburn_req(int *major, int *minor, int *micro); 00254 00255 00256 /** These three release version numbers tell the revision of this header file 00257 and of the API it describes. They are memorized by applications at build 00258 time. 00259 @since 0.1.0 00260 */ 00261 #define isoburn_header_version_major 0 00262 #define isoburn_header_version_minor 4 00263 #define isoburn_header_version_micro 8 00264 /** Note: 00265 Above version numbers are also recorded in configure.ac because libtool 00266 wants them as parameters at build time. 00267 For the library compatibility check, ISOBURN_*_VERSION in configure.ac 00268 are not decisive. Only the three numbers here do matter. 00269 */ 00270 /** Usage discussion: 00271 00272 Some developers of the libburnia project have differing 00273 opinions how to ensure the compatibility of libaries 00274 and applications. 00275 00276 It is about whether to use at compile time and at runtime 00277 the version numbers isoburn_header_version_* provided here. 00278 Thomas Schmitt advises to use them. 00279 Vreixo Formoso advises to use other means. 00280 00281 At compile time: 00282 00283 Vreixo Formoso advises to leave proper version matching 00284 to properly programmed checks in the the application's 00285 build system, which will eventually refuse compilation. 00286 00287 Thomas Schmitt advises to use the macros defined here 00288 for comparison with the application's requirements of 00289 library revisions and to eventually break compilation. 00290 00291 Both advises are combinable. I.e. be master of your 00292 build system and have #if checks in the source code 00293 of your application, nevertheless. 00294 00295 At runtime (via *_is_compatible()): 00296 00297 Vreixo Formoso advises to compare the application's 00298 requirements of library revisions with the runtime 00299 library. This is to allow runtime libraries which are 00300 young enough for the application but too old for 00301 the lib*.h files seen at compile time. 00302 00303 Thomas Schmitt advises to compare the header 00304 revisions defined here with the runtime library. 00305 This is to enforce a strictly monotonous chain 00306 of revisions from app to header to library, 00307 at the cost of excluding some older libraries. 00308 00309 These two advises are mutually exclusive. 00310 00311 ----------------------------------------------------- 00312 00313 For an implementation of the Thomas Schmitt approach, 00314 see libisoburn/burn_wrap.c : isoburn_initialize() 00315 This connects libisoburn as "application" with libisofs 00316 as "library". 00317 00318 The compatible part of Vreixo Formoso's approach is implemented 00319 in configure.ac LIBBURN_REQUIRED, LIBISOFS_REQUIRED. 00320 In isoburn_initialize() it would rather test by 00321 iso_lib_is_compatible(isoburn_libisofs_req_major,... 00322 than by 00323 iso_lib_is_compatible(iso_lib_header_version_major,... 00324 and would leave out the ugly compile time traps. 00325 00326 */ 00327 00328 00329 /** Announce to the library an application provided method for immediate 00330 delivery of messages. It is used when no drive is affected directly or 00331 if the drive has no own msgs_submit() method attached by 00332 isoburn_drive_set_msgs_submit. 00333 If no method is preset or if the method is set to NULL then libisoburn 00334 delivers its messages through the message queue of libburn. 00335 @param msgs_submit The function call which implements the method 00336 @param submit_handle Handle to be used as first argument of msgs_submit 00337 @param submit_flag Flag to be used as last argument of msgs_submit 00338 @param flag Unused yet, submit 0 00339 @since 0.2.0 00340 */ 00341 int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code, 00342 char msg_text[], int os_errno, 00343 char severity[], int flag), 00344 void *submit_handle, int submit_flag, int flag); 00345 00346 00347 /** Aquire a target drive by its filesystem path resp. libburn persistent 00348 address. 00349 Wrapper for: burn_drive_scan_and_grab() 00350 @since 0.1.0 00351 @param drive_infos On success returns a one element array with the drive 00352 (cdrom/burner). Thus use with driveno 0 only. On failure 00353 the array has no valid elements at all. 00354 The returned array should be freed via burn_drive_info_free() 00355 when the drive is no longer needed. But before this is done 00356 one has to call isoburn_drive_release(drive_infos[0].drive). 00357 @param adr The persistent address of the desired drive. 00358 @param load 1 attempt to load the disc tray. 0 no attempt,rather failure. 00359 @return 1 = success , 0 = drive not found , <0 = other error 00360 */ 00361 int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], 00362 char* adr, int load); 00363 00364 00365 /** Aquire a target drive by its filesystem path resp. libburn persistent 00366 address. This is a modern successor of isoburn_drive_scan_and_grab(). 00367 Wrapper for: burn_drive_scan_and_grab() 00368 @since 0.1.2 00369 @param drive_infos On success returns a one element array with the drive 00370 (cdrom/burner). Thus use with driveno 0 only. On failure 00371 the array has no valid elements at all. 00372 The returned array should be freed via burn_drive_info_free() 00373 when the drive is no longer needed. But before this is done 00374 one has to call isoburn_drive_release(drive_infos[0].drive). 00375 @param adr The persistent address of the desired drive. 00376 @param flag bit0= attempt to load the disc tray. 00377 Else: failure if not loaded. 00378 bit1= regard overwriteable media as blank 00379 bit2= if the drive is a regular disk file: truncate it to 00380 the write start address 00381 bit3= if the drive reports a read-only profile try to read 00382 table of content by scanning for ISO image headers. 00383 (depending on media type and drive this might 00384 help or it might make the resulting toc even worse) 00385 bit4= do not emulate table of content on overwriteable media 00386 bit5= ignore ACL from external filesystems 00387 bit6= ignore POSIX Extended Attributes from external 00388 filesystems 00389 bit7= pretend read-only profile and scan for table of content 00390 @return 1 = success , 0 = drive not found , <0 = other error 00391 */ 00392 int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], 00393 char* adr, int flag); 00394 00395 /** Aquire a drive from the burn_drive_info[] array which was obtained by 00396 a previous call of burn_drive_scan(). 00397 Wrapper for: burn_drive_grab() 00398 @since 0.1.0 00399 @param drive The drive to grab. E.g. drive_infos[1].drive . 00400 Call isoburn_drive_release(drive) when it it no longer needed. 00401 @param load 1 attempt to load the disc tray. 0 no attempt, rather failure. 00402 @return 1 success, <=0 failure 00403 */ 00404 int isoburn_drive_grab(struct burn_drive *drive, int load); 00405 00406 00407 /** Attach to a drive an application provided method for immediate 00408 delivery of messages. 00409 If no method is set or if the method is set to NULL then libisoburn 00410 delivers messages of the drive through the global msgs_submit() method 00411 set by isoburn_set_msgs_submiti() or by the message queue of libburn. 00412 @since 0.2.0 00413 @param d The drive to which this function, handle and flag shall apply 00414 @param msgs_submit The function call which implements the method 00415 @param submit_handle Handle to be used as first argument of msgs_submit 00416 @param submit_flag Flag to be used as last argument of msgs_submit 00417 @param flag Unused yet, submit 0 00418 */ 00419 int isoburn_drive_set_msgs_submit(struct burn_drive *d, 00420 int (*msgs_submit)(void *handle, int error_code, 00421 char msg_text[], int os_errno, 00422 char severity[], int flag), 00423 void *submit_handle, int submit_flag, int flag); 00424 00425 00426 /** Inquire the media status. Expect the whole spectrum of libburn BURN_DISC_* 00427 with multi-session media. Emulated states with random access media are 00428 BURN_DISC_BLANK and BURN_DISC_APPENDABLE. 00429 Wrapper for: burn_disc_get_status() 00430 @since 0.1.0 00431 @param drive The drive to inquire. 00432 @return The status of the drive, or what kind of disc is in it. 00433 Note: BURN_DISC_UNGRABBED indicates wrong API usage 00434 */ 00435 enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive); 00436 00437 00438 /** Tells whether the media can be treated by isoburn_disc_erase(). 00439 Wrapper for: burn_disc_erasable() 00440 @since 0.1.0 00441 @param d The drive to inquire. 00442 @return 0=not erasable , else erasable 00443 */ 00444 int isoburn_disc_erasable(struct burn_drive *d); 00445 00446 00447 /** Mark the media as blank. With multi-session media this will call 00448 burn_disc_erase(). With random access media, an eventual ISO-9660 00449 filesystem will get invalidated by altering its start blocks on media. 00450 In case of success, the media is in status BURN_DISC_BLANK afterwards. 00451 Wrapper for: burn_disc_erase() 00452 @since 0.1.0 00453 @param drive The drive with the media to erase. 00454 @param fast 1=fast erase, 0=thorough erase 00455 With DVD-RW, fast erase yields media incapable of multi-session. 00456 */ 00457 void isoburn_disc_erase(struct burn_drive *drive, int fast); 00458 00459 00460 /** Set up isoburn_disc_get_msc1() to return a fabricated value. 00461 This makes only sense between aquiring the drive and reading the 00462 image. After isoburn_read_image() it will confuse the coordination 00463 of libisoburn and libisofs. 00464 Note: Sessions and tracks are counted beginning with 1, not with 0. 00465 @since 0.1.6 00466 @param d The drive where msc1 is to be set 00467 @param adr_mode Determines how to interpret adr_value and to set msc1. 00468 If adr_value shall represent a number then decimal ASCII 00469 digits are expected. 00470 0= start lba of last session in TOC, ignore adr_value 00471 1= start lba of session number given by adr_value 00472 2= start lba of track given number by adr_value 00473 3= adr_value itself is the lba to be used 00474 4= start lba of last session with volume id 00475 given by adr_value 00476 @param adr_value A string describing the value to be eventually used. 00477 @param flag Bitfield for control purposes. 00478 bit0= @since 0.2.2 00479 with adr_mode 3: adr_value might be 16 blocks too high 00480 (e.g. -C stemming from growisofs). Probe for ISO head 00481 at adr_value-16 and eventually adjust setting. 00482 bit1= insist in seeing a disc object with at least one session 00483 bit2= with adr_mode 4: use adr_value as regular expression 00484 */ 00485 int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, 00486 int flag); 00487 00488 00489 /* ----------------------------------------------------------------------- */ 00490 /* 00491 00492 Wrappers for emulation of TOC on overwriteable media 00493 00494 Media which match the overwriteable usage model lack of a history of sessions 00495 and tracks. libburn will not even hand out a burn_disc object for them and 00496 always declare them blank. libisoburn checks for a valid ISO filesystem 00497 header at LBA 0 and eventually declares them appendable. 00498 Nevertheless one can only determine an upper limit of the size of the overall 00499 image (by isoburn_get_min_start_byte()) but not a list of stored sessions 00500 and their LBAs, as it is possible with true multi-session media. 00501 00502 The following wrappers add the capability to obtain a session and track TOC 00503 from emulated multi-session images on overwriteables if the first session 00504 was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32). 00505 00506 Be aware that the structs emitted by these isoburn calls are not compatible 00507 with the libburn structs. I.e. you may use them only with isoburn_toc_* 00508 calls. 00509 isoburn_toc_disc needs to be freed after use. isoburn_toc_session and 00510 isoburn_toc_track vanish together with their isoburn_toc_disc. 00511 */ 00512 00513 /* Opaque handles to media, session, track */ 00514 struct isoburn_toc_disc; 00515 struct isoburn_toc_session; 00516 struct isoburn_toc_track; 00517 00518 00519 /** Obtain a master handle for the table of content. 00520 This handle governs allocated resources which have to be released by 00521 isoburn_toc_disc_free() when no longer needed. 00522 Wrapper for: burn_drive_get_disc() 00523 @since 0.1.6 00524 @param d The drive with the media to inspect 00525 @return NULL in case there is no content info, else it is a valid handle 00526 */ 00527 struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d); 00528 00529 00530 /** Tell the number of 2048 byte blocks covered by the table of content. 00531 This number includes the eventual gaps between sessions and tracks. 00532 So this call is not really a wrapper for burn_disc_get_sectors(). 00533 @since 0.1.6 00534 @param disc The master handle of the media 00535 @return Number of blocks, <=0 indicates unknown or unreadable state 00536 */ 00537 int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc); 00538 00539 00540 /** Get the array of session handles from the table of content. 00541 Wrapper for: burn_disc_get_sessions() 00542 @since 0.1.6 00543 @param disc The master handle of the media 00544 @param num returns the number of sessions in the array 00545 @return the address of the array of session handles 00546 */ 00547 struct isoburn_toc_session **isoburn_toc_disc_get_sessions( 00548 struct isoburn_toc_disc *disc, int *num); 00549 00550 00551 /** Tell the number of 2048 byte blocks covered by a particular session. 00552 Wrapper for: burn_session_get_sectors() 00553 @since 0.1.6 00554 @param s The session handle 00555 @return number of blocks, <=0 indicates unknown or unreadable state 00556 */ 00557 int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s); 00558 00559 00560 /** Obtain a copy of the entry which describes the end of a particular session. 00561 Wrapper for: burn_session_get_leadout_entry() 00562 @since 0.1.6 00563 @param s The session handle 00564 @param entry A pointer to memory provided by the caller. It will be filled 00565 with info according to struct burn_toc_entry as defined 00566 in libburn.h 00567 */ 00568 void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s, 00569 struct burn_toc_entry *entry); 00570 00571 00572 /** Get the array of track handles from a particular session. 00573 Wrapper for: burn_session_get_tracks() 00574 @since 0.1.6 00575 @param s The session handle 00576 @param num returns the number of tracks in the array 00577 @return the address of the array of track handles 00578 */ 00579 struct isoburn_toc_track **isoburn_toc_session_get_tracks( 00580 struct isoburn_toc_session *s, int *num); 00581 00582 00583 /** Obtain a copy of the entry which describes a particular track. 00584 Wrapper for: burn_track_get_entry() 00585 @since 0.1.6 00586 @param t The track handle 00587 @param entry A pointer to memory provided by the caller. It will be filled 00588 with info according to struct burn_toc_entry as defined 00589 in libburn.h 00590 */ 00591 void isoburn_toc_track_get_entry(struct isoburn_toc_track *t, 00592 struct burn_toc_entry *entry); 00593 00594 00595 /** Obtain eventual ISO image parameters of an emulated track. This info was 00596 gained with much effort and thus gets cached in the track object. 00597 If this call returns 1 then one can save a call of isoburn_read_iso_head() 00598 with return mode 1 which could cause an expensive read operation. 00599 @since 0.4.0 00600 @param t The track handle 00601 @param start_lba Returns the start address of the ISO session 00602 @param image_blocks Returns the number of 2048 bytes blocks 00603 @param volid Caller provided memory for the volume id 00604 @param flag unused yet, submit 0 00605 @return 0= not an emulated ISO session , 1= reply is valid 00606 */ 00607 int isoburn_toc_track_get_emul(struct isoburn_toc_track *t, int *start_lba, 00608 int *image_blocks, char volid[33], int flag); 00609 00610 00611 00612 /** Release the memory associated with a master handle of media. 00613 The handle is invalid afterwards and may not be used any more. 00614 Wrapper for: burn_disc_free() 00615 @since 0.1.6 00616 @param disc The master handle of the media 00617 */ 00618 void isoburn_toc_disc_free(struct isoburn_toc_disc *disc); 00619 00620 00621 /** Try whether the data at the given address look like a ISO 9660 00622 image header and obtain its alleged size. Depending on the info mode 00623 one other string of text information can be retrieved too. 00624 @since 0.1.6 00625 @param d The drive with the media to inspect 00626 @param lba The block number from where to read 00627 @param image_blocks The number of 2048 bytes blocks 00628 @param info Caller provided memory, enough to take eventual info reply 00629 @param flag bit0-7: info return mode 00630 0= do not return anything in info (do not even touch it) 00631 1= copy volume id to info (info needs 33 bytes) 00632 2= @since 0.2.2 : 00633 copy 64 kB header to info (needs 65536 bytes) 00634 bit13= @since 0.2.2: 00635 do not read head from media but use first 64 kB from info 00636 bit14= check both half buffers (not only second) 00637 return 2 if found in first block 00638 bit15= return -1 on read error 00639 @return >0 seems to be a valid ISO image, 0 format not recognized, <0 error 00640 */ 00641 int isoburn_read_iso_head(struct burn_drive *d, int lba, 00642 int *image_blocks, char *info, int flag); 00643 00644 00645 /** Try to convert the given entity address into various entity addresses 00646 which would describe it. 00647 Note: Sessions and tracks are counted beginning with 1, not with 0. 00648 @since 0.3.2 00649 @param d The drive where msc1 is to be set 00650 @param adr_mode Determines how to interpret the input adr_value. 00651 If adr_value shall represent a number then decimal ASCII 00652 digits are expected. 00653 0= start lba of last session in TOC, ignore adr_value 00654 1= start lba of session number given by adr_value 00655 2= start lba of track given number by adr_value 00656 3= adr_value itself is the lba to be used 00657 4= start lba of last session with volume id 00658 given by adr_value 00659 @param adr_value A string describing the value to be eventually used. 00660 @param lba returns the block address of the entity, -1 means invalid 00661 @param track returns the track number of the entity, -1 means invalid 00662 @param session returns the session number of the entity, -1 means invalid 00663 @param volid returns the volume id of the entity if it is a ISO session 00664 @param flag Bitfield for control purposes. 00665 bit2= with adr_mode 4: use adr_value as regular expression 00666 @return <=0 error , 1 ok, ISO session, 2 ok, not an ISO session 00667 */ 00668 int isoburn_get_mount_params(struct burn_drive *d, 00669 int adr_mode, char *adr_value, 00670 int *lba, int *track, int *session, 00671 char volid[33], int flag); 00672 00673 00674 /* ----------------------------------------------------------------------- */ 00675 /* 00676 00677 Options for image reading. 00678 00679 An application shall create an option set object by isoburn_ropt_new(), 00680 program it by isoburn_ropt_set_*(), use it with isoburn_read_image(), 00681 and finally delete it by isoburn_ropt_destroy(). 00682 00683 */ 00684 /* ----------------------------------------------------------------------- */ 00685 00686 struct isoburn_read_opts; 00687 00688 /** Produces a set of image read options, initialized with default values. 00689 @since 0.1.0 00690 @param o the newly created option set object 00691 @param flag Bitfield for control purposes. Submit 0 for now. 00692 @return 1=ok , <0 = failure 00693 */ 00694 int isoburn_ropt_new(struct isoburn_read_opts **o, int flag); 00695 00696 00697 /** Deletes an option set which was created by isoburn_ropt_new(). 00698 @since 0.1.0 00699 @param o The option set to work on 00700 @param flag Bitfield for control purposes. Submit 0 for now. 00701 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00702 */ 00703 int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag); 00704 00705 00706 /** Which existing ISO 9660 extensions in the image to read or not to read. 00707 Whether to read the content of an existing image at all. 00708 The bits can be combined by | resp. inquired by &. 00709 @since 0.1.0 00710 @param ext Bitfield: 00711 bit0= norock 00712 Do not read Rock Ridge extensions 00713 bit1= nojoliet 00714 Do not read Joliet extensions 00715 bit2= noiso1999 00716 Do not read ISO 9660:1999 enhanced tree 00717 bit3= preferjoliet 00718 When both Joliet and RR extensions are present, the RR 00719 tree is used. If you prefer using Joliet, set this to 1. 00720 bit4= pretend_blank 00721 Always create empty image.Ignore any image on input drive. 00722 bit5= noaaip 00723 @since 0.3.4 00724 Do not load AAIP information from image. This information 00725 eventually contains ACL or XFS-style Extended Attributes. 00726 bit6= noacl 00727 @since 0.3.4 00728 Do not obtain ACL from external filesystem objects (e.g. 00729 local filesystem files). 00730 bit7= noea 00731 @since 0.3.4 00732 Do not obtain XFS-style Extended Attributes from external 00733 filesystem objects (e.g. local filesystem files). 00734 bit8= noino 00735 @since 0.4.0 00736 Do not load eventual inode numbers from RRIP entry PX, 00737 but generate a new unique inode number for each imported 00738 IsoNode object. 00739 PX inode numbers allow to mark families of hardlinks by 00740 giving all family members the same inode number. libisofs 00741 keeps the PX inode numbers unaltered when IsoNode objects 00742 get written into an ISO image. 00743 bit9= nomd5 00744 @since 0.4.2 00745 Do not load the eventual MD5 checksum array. 00746 @return 1 success, <=0 failure 00747 */ 00748 #define isoburn_ropt_norock 1 00749 #define isoburn_ropt_nojoliet 2 00750 #define isoburn_ropt_noiso1999 4 00751 #define isoburn_ropt_preferjoliet 8 00752 #define isoburn_ropt_pretend_blank 16 00753 #define isoburn_ropt_noaaip 32 00754 #define isoburn_ropt_noacl 64 00755 #define isoburn_ropt_noea 128 00756 #define isoburn_ropt_noino 256 00757 #define isoburn_ropt_nomd5 512 00758 00759 int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext); 00760 int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext); 00761 00762 00763 /** Default attributes to use if no RockRidge extension gets loaded. 00764 @since 0.1.0 00765 @param o The option set to work on 00766 @param uid user id number (see /etc/passwd) 00767 @param gid group id number (see /etc/group) 00768 @param mode permissions (not file type) as of man 2 stat. 00769 With directories, r-permissions will automatically imply 00770 x-permissions. See isoburn_ropt_set_default_dirperms() below. 00771 @return 1 success, <=0 failure 00772 */ 00773 int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o, 00774 uid_t uid, gid_t gid, mode_t mode); 00775 int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o, 00776 uid_t *uid, gid_t *gid, mode_t *mode); 00777 00778 /** Default attributes to use on directories if no RockRidge extension 00779 gets loaded. 00780 Above call isoburn_ropt_set_default_perms() automatically adds 00781 x-permissions to r-permissions for directories. This call here may 00782 be done afterwards to set independend permissions for directories, 00783 especially to override the automatically added x-permissions. 00784 @since 0.1.0 00785 @param o The option set to work on 00786 @param mode permissions (not file type) as of man 2 stat. 00787 @return 1 success, <=0 failure 00788 */ 00789 int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o, 00790 mode_t mode); 00791 int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o, 00792 mode_t *mode); 00793 00794 00795 00796 /** Set the character set for reading RR file names from ISO images. 00797 @since 0.1.0 00798 @param o The option set to work on 00799 @param input_charset Set this to NULL to use the default locale charset 00800 For selecting a particular character set, submit its 00801 name, e.g. as listed by program iconv -l. 00802 Example: "UTF-8". 00803 @return 1 success, <=0 failure 00804 */ 00805 int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o, 00806 char *input_charset); 00807 int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o, 00808 char **input_charset); 00809 00810 /** 00811 Enable or disable methods to automatically choose an input charset. 00812 This eventually overrides the name set via isoburn_ropt_set_input_charset() 00813 @since 0.3.8 00814 @param o The option set to work on 00815 @param mode Bitfield for control purposes: 00816 bit0= allow to set the input character set automatically from 00817 attribute "isofs.cs" of root directory. 00818 Submit any other bits with value 0. 00819 @return 1 success, <=0 failure 00820 */ 00821 int isoburn_ropt_set_auto_incharset(struct isoburn_read_opts *o, int mode); 00822 int isoburn_ropt_get_auto_incharset(struct isoburn_read_opts *o, int *mode); 00823 00824 00825 /** After calling function isoburn_read_image() there are informations 00826 available in the option set. 00827 This info can be obtained as bits in parameter has_what. Like: 00828 joliet_available = (has_what & isoburn_ropt_has_joliet); 00829 @since 0.1.0 00830 @param o The option set to work on 00831 @param size Number of image data blocks, 2048 bytes each. 00832 @param has_what Bitfield: 00833 bit0= has_rockridge 00834 RockRidge extension info is available (POSIX filesystem) 00835 bit1= has_joliet 00836 Joliet extension info is available (suitable for MS-Windows) 00837 bit2= has_iso1999 00838 ISO version 2 Enhanced Volume Descriptor is available. 00839 This is rather exotic. 00840 bit3= has_el_torito 00841 El-Torito boot record is present 00842 @return 1 success, <=0 failure 00843 */ 00844 #define isoburn_ropt_has_rockridge 1 00845 #define isoburn_ropt_has_joliet 2 00846 #define isoburn_ropt_has_iso1999 4 00847 #define isoburn_ropt_has_el_torito 8 00848 00849 /* ts A90122 */ 00850 /* >>> to be implemented: 00851 #define isoburn_ropt_has_acl 64 00852 #define isoburn_ropt_has_ea 128 00853 */ 00854 00855 int isoburn_ropt_get_size_what(struct isoburn_read_opts *o, 00856 uint32_t *size, int *has_what); 00857 00858 00859 /* ----------------------------------------------------------------------- */ 00860 /* End of Options for image reading */ 00861 /* ----------------------------------------------------------------------- */ 00862 00863 /* ----------------------------------------------------------------------- */ 00864 /* 00865 00866 Options for image generation by libisofs and image transport to libburn. 00867 00868 An application shall create an option set by isoburn_igopt_new(), 00869 program it by isoburn_igopt_set_*(), use it with either 00870 isoburn_prepare_new_image() or isoburn_prepare_disc(), and finally delete 00871 it by isoburn_igopt_destroy(). 00872 00873 */ 00874 /* ----------------------------------------------------------------------- */ 00875 00876 struct isoburn_imgen_opts; 00877 00878 /** Produces a set of generation and transfer options, initialized with default 00879 values. 00880 @since 0.1.0 00881 @param o the newly created option set object 00882 @param flag Bitfield for control purposes. Submit 0 for now. 00883 @return 1=ok , <0 = failure 00884 */ 00885 int isoburn_igopt_new(struct isoburn_imgen_opts **o, int flag); 00886 00887 00888 /** Deletes an option set which was created by isoburn_igopt_new(). 00889 @since 0.1.0 00890 @param o The option set to give up 00891 @param flag Bitfield for control purposes. Submit 0 for now. 00892 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00893 */ 00894 int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag); 00895 00896 00897 /** ISO level to write at. 00898 @since 0.1.0 00899 @param o The option set to work on 00900 @param level is a term of the ISO 9660 standard. It should be one of: 00901 1= filenames restricted to form 8.3 00902 2= filenames allowed up to 31 characters 00903 @return 1 success, <=0 failure 00904 */ 00905 int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level); 00906 int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level); 00907 00908 00909 /** Which extensions to support. 00910 @since 0.1.0 00911 @param o The option set to work on 00912 @param ext Bitfield: 00913 bit0= rockridge 00914 Rock Ridge extensions add POSIX file attributes like 00915 owner, group, access permissions, long filenames. Very 00916 advisable if the designed audience has Unix style systems. 00917 bit1= joliet 00918 Longer filenames for Windows systems. 00919 Weaker than RockRidge, but also readable with Linux. 00920 bit2= iso1999 00921 This is rather exotic. Better do not surprise the readers. 00922 bit3= hardlinks 00923 Enable hardlink consolidation. IsoNodes which refer to the 00924 same source object and have the same properties will get 00925 the same ISO image inode numbers. 00926 If combined with isoburn_igopt_rrip_version_1_10 below, 00927 then the PX entry layout of RRIP-1.12 will be used within 00928 RRIP-1.10 (mkisofs does this without causing visible trouble). 00929 bit5= aaip 00930 The libisofs specific SUSP based extension of ECMA-119 which 00931 can encode ACL and XFS-style Extended Attributes. 00932 bit6= session_md5 00933 @since 0.4.2 00934 Produce and write a MD5 checksum of the whole session stream. 00935 bit7= file_md5 00936 @since 0.4.2 00937 Produce and write MD5 checksums for each single IsoFile. 00938 bit8= file_stability (only together with file_md5) 00939 @since 0.4.2 00940 Compute MD5 of each file before copying it into the image and 00941 compare this with the MD5 of the actual copying. If they do 00942 not match then issue MISHAP event. 00943 See also libisofs.h iso_write_opts_set_record_md5() 00944 @return 1 success, <=0 failure 00945 */ 00946 #define isoburn_igopt_rockridge 1 00947 #define isoburn_igopt_joliet 2 00948 #define isoburn_igopt_iso1999 4 00949 #define isoburn_igopt_hardlinks 8 00950 #define isoburn_igopt_aaip 32 00951 #define isoburn_igopt_session_md5 64 00952 #define isoburn_igopt_file_md5 128 00953 #define isoburn_igopt_file_stability 256 00954 int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext); 00955 int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext); 00956 00957 /** Relaxed constraints. Setting any of the bits to 1 break the specifications, 00958 but it is supposed to work on most moderns systems. Use with caution. 00959 @since 0.1.0 00960 @param o The option set to work on 00961 @param relax Bitfield: 00962 bit0= omit_version_numbers 00963 Omit the version number (";1") at the end of the 00964 ISO-9660 identifiers. Version numbers are usually 00965 not used. 00966 bit1= allow_deep_paths 00967 Allow ISO-9660 directory hierarchy to be deeper 00968 than 8 levels. 00969 bit2= allow_longer_paths 00970 Allow path in the ISO-9660 tree to have more than 00971 255 characters. 00972 bit3= max_37_char_filenames 00973 Allow a single file or directory hierarchy to have 00974 up to 37 characters. This is larger than the 31 00975 characters allowed by ISO level 2, and the extra space 00976 is taken from the version number, so this also forces 00977 omit_version_numbers. 00978 bit4= no_force_dots 00979 ISO-9660 forces filenames to have a ".", that separates 00980 file name from extension. libisofs adds it if original 00981 filename has none. Set this to 1 to prevent this 00982 behavior. 00983 bit5= allow_lowercase 00984 Allow lowercase characters in ISO-9660 filenames. 00985 By default, only uppercase characters, numbers and 00986 a few other characters are allowed. 00987 bit6= allow_full_ascii 00988 Allow all ASCII characters to be appear on an ISO-9660 00989 filename. Note * that "/" and "\0" characters are never 00990 allowed, even in RR names. 00991 bit7= joliet_longer_paths 00992 Allow paths in the Joliet tree to have more than 00993 240 characters. 00994 bit8= always_gmt 00995 Write timestamps as GMT although the specs prescribe local 00996 time with eventual non-zero timezone offset. Negative 00997 timezones (west of GMT) can trigger bugs in some operating 00998 systems which typically appear in mounted ISO images as if 00999 the timezone shift from GMT was applied twice 01000 (e.g. in New York 22:36 becomes 17:36). 01001 bit9= rrip_version_1_10 01002 Write Rock Ridge info as of specification RRIP-1.10 rather 01003 than RRIP-1.12: signature "RRIP_1991A" rather than 01004 "IEEE_1282", field PX without file serial number. 01005 bit10= dir_rec_mtime 01006 Store as ECMA-119 Directory Record timestamp the mtime 01007 of the source rather than the image creation time. 01008 bit11= aaip_susp_1_10 01009 Write AAIP fields without announcing AAIP by an ER field and 01010 without distinguishing RRIP fields from the AAIP field by 01011 prefixed ES fields. This saves 5 to 10 bytes per file and 01012 might avoid problems with readers which only accept RRIP. 01013 SUSP-1.10 allows it, SUSP-1.12 frowns on it. 01014 01015 @return 1 success, <=0 failure 01016 */ 01017 #define isoburn_igopt_omit_version_numbers 1 01018 #define isoburn_igopt_allow_deep_paths 2 01019 #define isoburn_igopt_allow_longer_paths 4 01020 #define isoburn_igopt_max_37_char_filenames 8 01021 #define isoburn_igopt_no_force_dots 16 01022 #define isoburn_igopt_allow_lowercase 32 01023 #define isoburn_igopt_allow_full_ascii 64 01024 #define isoburn_igopt_joliet_longer_paths 128 01025 #define isoburn_igopt_always_gmt 256 01026 #define isoburn_igopt_rrip_version_1_10 512 01027 #define isoburn_igopt_dir_rec_mtime 1024 01028 #define isoburn_igopt_aaip_susp_1_10 2048 01029 int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax); 01030 int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax); 01031 01032 01033 /** Whether and how files should be sorted. 01034 @since 0.1.0 01035 @param o The option set to work on 01036 @param value Bitfield: bit0= sort_files_by_weight 01037 files should be sorted based on their weight. 01038 Weight is attributed to files in the image 01039 by libisofs call iso_node_set_sort_weight(). 01040 @return 1 success, <=0 failure 01041 */ 01042 #define isoburn_igopt_sort_files_by_weight 1 01043 int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value); 01044 int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value); 01045 01046 01047 /** Set the override values for files and directory permissions. 01048 The parameters replace_* these take one of three values: 0, 1 or 2. 01049 If 0, the corresponding attribute will be kept as set in the IsoNode 01050 at the time of image generation. 01051 If set to 1, the corresponding attrib. will be changed by a default 01052 suitable value. 01053 With value 2, the attrib. will be changed with the value specified 01054 in the corresponding *_mode options. Note that only the permissions 01055 are set, the file type remains unchanged. 01056 @since 0.1.0 01057 @param o The option set to work on 01058 @param replace_dir_mode whether and how to override directories 01059 @param replace_file_mode whether and how to override files of other type 01060 @param dir_mode Mode to use on dirs with replace_dir_mode == 2. 01061 @param file_mode; Mode to use on files with replace_file_mode == 2. 01062 @return 1 success, <=0 failure 01063 */ 01064 int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o, 01065 int replace_dir_mode, int replace_file_mode, 01066 mode_t dir_mode, mode_t file_mode); 01067 int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o, 01068 int *replace_dir_mode, int *replace_file_mode, 01069 mode_t *dir_mode, mode_t *file_mode); 01070 01071 /** Set the override values values for group id and user id. 01072 The rules are like with above overriding of mode values. replace_* controls 01073 whether and how. The other two parameters provide values for eventual use. 01074 @since 0.1.0 01075 @param o The option set to work on 01076 @param replace_uid whether and how to override user ids 01077 @param replace_gid whether and how to override group ids 01078 @param uid User id to use with replace_uid == 2. 01079 @param gid Group id to use on files with replace_gid == 2. 01080 @return 1 success, <=0 failure 01081 */ 01082 int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o, 01083 int replace_uid, int replace_gid, 01084 uid_t uid, gid_t gid); 01085 int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o, 01086 int *replace_uid, int *replace_gid, 01087 uid_t *uid, gid_t *gid); 01088 01089 /** Set the charcter set to use for representing filenames in the image. 01090 @since 0.1.0 01091 @param o The option set to work on 01092 @param output_charset Set this to NULL to use the default output charset. 01093 For selecting a particular character set, submit its 01094 name, e.g. as listed by program iconv -l. 01095 Example: "UTF-8". 01096 @return 1 success, <=0 failure 01097 */ 01098 int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o, 01099 char *output_charset); 01100 int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o, 01101 char **output_charset); 01102 01103 01104 /** The number of bytes to be used for the fifo which decouples libisofs 01105 and libburn for better throughput and for reducing the risk of 01106 interrupting signals hitting the libburn thread which operates the 01107 MMC drive. 01108 The size will be rounded up to the next full 2048. 01109 Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway). 01110 @since 0.1.0 01111 @param o The option set to work on 01112 @param fifo_size Number of bytes to use 01113 @return 1 success, <=0 failure 01114 */ 01115 int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size); 01116 int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size); 01117 01118 01119 /** Obtain after image preparation the block address where the session will 01120 start on media. 01121 This value cannot be set by the application but only be inquired. 01122 @since 0.1.4 01123 @param o The option set to work on 01124 @param lba The block number of the session start on media. 01125 <0 means that no address has been determined yet. 01126 @return 1 success, <=0 failure 01127 */ 01128 int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba); 01129 01130 01131 /** Obtain after image preparation the lowest block address of file content 01132 data. Failure can occur if libisofs is too old to provide this information, 01133 if the result exceeds 31 bit, or if the call is made before image 01134 preparation. 01135 This value cannot be set by the application but only be inquired. 01136 @since 0.3.6 01137 @param o The option set to work on 01138 @param lba The block number of the session start on media. 01139 <0 means that no address has been determined yet. 01140 @return 1 success, <=0 failure 01141 */ 01142 int isoburn_igopt_get_data_start(struct isoburn_imgen_opts *o, int *lba); 01143 01144 01145 /** Set resp. get parameters "name" and "timestamp" for a scdbackup checksum 01146 tag. It will be appended to the libisofs session tag if the image starts at 01147 LBA 0. See isoburn_disc_track_lba_nwa. The scdbackup tag can be used 01148 to verify the image by command scdbackup_verify <device> -auto_end. 01149 See scdbackup/README appendix VERIFY for its inner details. 01150 @since 0.4.4 01151 @param o The option set to work on 01152 @param name The tag name. 80 characters max. 01153 @param timestamp A string of up to 13 characters YYMMDD.hhmmss 01154 A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ... 01155 @param tag_written Either NULL or the address of an array with at least 512 01156 characters. In the latter case the eventually produced 01157 scdbackup tag will be copied to this array when the image 01158 gets written. This call sets scdbackup_tag_written[0] = 0 01159 to mark its preliminary invalidity. 01160 @return 1 success, <=0 failure 01161 */ 01162 int isoburn_igopt_set_scdbackup_tag(struct isoburn_imgen_opts *o, char *name, 01163 char *timestamp, char *tag_written); 01164 int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o, 01165 char name[81], char timestamp[19], 01166 char **tag_written); 01167 01168 01169 /* ----------------------------------------------------------------------- */ 01170 /* End of Options for image generation */ 01171 /* ----------------------------------------------------------------------- */ 01172 01173 01174 /** Get the image attached to a drive, if any. 01175 @since 0.1.0 01176 @param d The drive to inquire 01177 @return A reference to attached image, or NULL if the drive has no image 01178 attached. This reference needs to be released via iso_image_unref() 01179 when it is not longer needed. 01180 */ 01181 IsoImage *isoburn_get_attached_image(struct burn_drive *d); 01182 01183 01184 /** Load the ISO filesystem directory tree from the media in the given drive. 01185 This will give libisoburn the base on which it can let libisofs perform 01186 image growing or image modification. The loaded volset gets attached 01187 to the drive object and handed out to the application. 01188 Not a wrapper, but peculiar to libisoburn. 01189 @since 0.1.0 01190 @param d The drive which holds an existing ISO filesystem or blank media. 01191 d is allowed to be NULL which produces an empty ISO image. In 01192 this case one has to call before writing isoburn_attach_volset() 01193 with the volset from this call and with the intended output 01194 drive. 01195 @param read_opts The read options which can be chosen by the application 01196 @param image the image read, if the disc is blank it will have no files. 01197 This reference needs to be released via iso_image_unref() when 01198 it is not longer needed. The drive, if not NULL, will hold an 01199 own reference which it will release when it gets a new volset 01200 or when it gets released via isoburn_drive_release(). 01201 You can pass NULL if you already have a reference or you plan to 01202 obtain it later with isoburn_get_attached_image(). Of course, if 01203 you haven't specified a valid drive (i.e., if d == NULL), this 01204 parameter can't be NULL. 01205 @return <=0 error , 1 = success 01206 */ 01207 int isoburn_read_image(struct burn_drive *d, 01208 struct isoburn_read_opts *read_opts, 01209 IsoImage **image); 01210 01211 /** Set a callback function for producing pacifier messages during the lengthy 01212 process of image reading. The callback function and the application handle 01213 are stored until they are needed for the underlying call to libisofs. 01214 Other than with libisofs the handle is managed entirely by the application. 01215 An idle .free() function is exposed to libisofs. The handle has to stay 01216 valid until isoburn_read_image() is done. It has to be detached by 01217 isoburn_set_read_pacifier(drive, NULL, NULL); 01218 before it may be removed from memory. 01219 @since 0.1.0 01220 @param drive The drive which will be used with isoburn_read_image() 01221 It has to be aquired by an isoburn_* wrapper call. 01222 @param read_pacifier The callback function 01223 @param app_handle The app handle which the callback function can obtain 01224 via iso_image_get_attached_data() from its IsoImage* 01225 @return 1 success, <=0 failure 01226 */ 01227 int isoburn_set_read_pacifier(struct burn_drive *drive, 01228 int (*read_pacifier)(IsoImage*, IsoFileSource*), 01229 void *app_handle); 01230 01231 01232 /** Set the IsoImage to be used with a drive. This eventually releases 01233 the reference to the old IsoImage attached to the drive. 01234 Caution: Use with care. It hardly makes sense to replace an image that 01235 reflects a valid ISO image on media. 01236 This call is rather intended for writing a newly created and populated 01237 image to blank media. The use case in xorriso is to let an image survive 01238 the change or demise of the outdev target drive. 01239 @since 0.1.0 01240 @param d The drive which shall be write target of the volset. 01241 @param image The image that represents the image to be written. 01242 This image pointer MUST already be a valid reference suitable 01243 for iso_image_unref(). 01244 It may have been obtained by appropriate libisofs calls or by 01245 isoburn_read_image() with d==NULL. 01246 @return <=0 error , 1 = success 01247 */ 01248 int isoburn_attach_image(struct burn_drive *d, IsoImage *image); 01249 01250 01251 /** Return the best possible estimation of the currently available capacity of 01252 the media. This might depend on particular write option settings and on 01253 drive state. 01254 An eventual start address for emulated multi-session will be subtracted 01255 from the capacity estimation given by burn_disc_available_space(). 01256 Negative results get defaulted to 0. 01257 Wrapper for: burn_disc_available_space() 01258 @since 0.1.0 01259 @param d The drive to query. 01260 @param o If not NULL: write parameters to be set on drive before query 01261 @return number of most probably available free bytes 01262 */ 01263 off_t isoburn_disc_available_space(struct burn_drive *d, 01264 struct burn_write_opts *o); 01265 01266 01267 /** Obtain the start block number of the most recent session on media. In 01268 case of random access media this will normally be 0. Successfull return is 01269 not a guarantee that there is a ISO-9660 image at all. The call will fail, 01270 nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE 01271 or BURN_DISC_FULL. 01272 Note: The result of this call may be fabricated by a previous call of 01273 isoburn_set_msc1() which can override the rule to load the most recent 01274 session. 01275 Wrapper for: burn_disc_get_msc1() 01276 @since 0.1.0 01277 @param d The drive to inquire 01278 @param start_lba Contains on success the start address in 2048 byte blocks 01279 @return <=0 error , 1 = success 01280 */ 01281 int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba); 01282 01283 01284 /** Use this with trackno==0 to obtain the predicted start block number of the 01285 new session. The interesting number is returned in parameter nwa. 01286 Wrapper for: burn_disc_track_lba_nwa() 01287 @since 0.1.0 01288 @param d The drive to inquire 01289 @param o If not NULL: write parameters to be set on drive before query 01290 @param trackno Submit 0. 01291 @param lba return value: start lba 01292 @param nwa return value: Next Writeable Address 01293 @return 1=nwa is valid , 0=nwa is not valid , -1=error 01294 */ 01295 int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, 01296 int trackno, int *lba, int *nwa); 01297 01298 01299 /** Obtain the size which was attributed to an emulated appendable on actually 01300 overwriteable media. This value is supposed to be <= 2048 * nwa as of 01301 isoburn_disc_track_lba_nwa(). 01302 @since 0.1.0 01303 @param d The drive holding the media. 01304 @param start_byte The reply value counted in bytes, not in sectors. 01305 @param flag Unused yet. Submit 0. 01306 @return 1=stat_byte is valid, 0=not an emulated appendable, -1=error 01307 */ 01308 int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte, 01309 int flag); 01310 01311 01312 /** To choose the expansion method of Growing: 01313 Create a disc object for writing the new session from the created or loaded 01314 iso_volset which has been manipulated via libisofs, to the same media from 01315 where the image was eventually loaded. This struct burn_disc is ready for 01316 use by a subsequent call to isoburn_disc_write(). 01317 After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE 01318 again, the burn_disc object has to be disposed by burn_disc_free(). 01319 @since 0.1.0 01320 @param drive The combined source and target drive, grabbed with 01321 isoburn_drive_scan_and_grab(). . 01322 @param disc Returns the newly created burn_disc object. 01323 @param opts Image generation options, see isoburn_igopt_*() 01324 @return <=0 error , 1 = success 01325 */ 01326 int isoburn_prepare_disc(struct burn_drive *drive, struct burn_disc **disc, 01327 struct isoburn_imgen_opts *opts); 01328 01329 01330 /** To choose the expansion method of Modifying: 01331 Create a disc object for producing a new image from a previous image 01332 plus the changes made by user. The generated burn_disc is suitable 01333 to be written to a grabbed drive with blank writeable media. 01334 But you must not use the same drive for input and output, because data 01335 will be read from the source drive while at the same time the target 01336 drive is already writing. 01337 The resulting burn_disc object has to be disposed when all its writing 01338 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01339 burn_disc_write(). 01340 @since 0.1.0 01341 @param in_drive The input drive, grabbed with isoburn_drive_aquire() or 01342 one of its alternatives. 01343 @param disc Returns the newly created burn_disc object. 01344 @param opts Options for image generation and data transport to media. 01345 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01346 @return <=0 error , 1 = success 01347 */ 01348 int isoburn_prepare_new_image(struct burn_drive *in_drive, 01349 struct burn_disc **disc, 01350 struct isoburn_imgen_opts *opts, 01351 struct burn_drive *out_drive); 01352 01353 01354 /** To choose the expansion method of Blind Growing: 01355 Create a disc object for writing an add-on session from the created or 01356 loaded IsoImage which has been manipulated via libisofs, to a different 01357 drive than the one from where it was loaded. 01358 Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped 01359 into some burn program like with this classic gesture: 01360 mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev 01361 Parameter translation into libisoburn: 01362 $dev is the address by which parameter in_drive of this call was aquired 01363 $msc1 was set by isoburn_set_msc1() before image reading 01364 or was detected from the in_drive media 01365 $nwa is a parameter of this call 01366 or can be used as detected from the in_drive media 01367 01368 This call waits for libisofs output to become available and then detaches 01369 the input drive object from the data source object by which libisofs was 01370 reading from the input drive. 01371 So, as far as libisofs is concerned, that drive may be released immediately 01372 after this call in order to allow the consumer to access the drive for 01373 writing. 01374 The consumer should wait for input to become available and only then open 01375 its burn drive. With cdrecord this is caused by option -waiti. 01376 01377 The resulting burn_disc object has to be disposed when all its writing 01378 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01379 burn_disc_write(). 01380 @since 0.2.2 01381 @param in_drive The input drive,grabbed with isoburn_drive_scan_and_grab(). 01382 @param disc Returns the newly created burn_disc object. 01383 @param opts Options for image generation and data transport to media. 01384 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01385 typically stdio:/dev/fd/1 . 01386 @param nwa The address (2048 byte block count) where the add-on 01387 session will be finally stored on a mountable media 01388 or in a mountable file. 01389 If nwa is -1 then the address is used as determined from 01390 the in_drive media. 01391 @return <=0 error , 1 = success 01392 */ 01393 int isoburn_prepare_blind_grow(struct burn_drive *in_drive, 01394 struct burn_disc **disc, 01395 struct isoburn_imgen_opts *opts, 01396 struct burn_drive *out_drive, int nwa); 01397 01398 01399 /** 01400 Revoke isoburn_prepare_*() instead of running isoburn_disc_write(). 01401 libisofs reserves resources and maybe already starts generating the 01402 image stream when one of above three calls is performed. It is mandatory to 01403 either run isoburn_disc_write() or to revoke the preparations by the 01404 call described here. 01405 @since 0.1.0 01406 @param input_drive The drive resp. in_drive which was used with the 01407 preparation call. 01408 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01409 NULL if none. 01410 @param flag Bitfield, submit 0 for now. 01411 bit0= -reserved for internal use- 01412 @return <0 error, 0= no pending preparations detectable, 1 = canceled 01413 */ 01414 int isoburn_cancel_prepared_write(struct burn_drive *input_drive, 01415 struct burn_drive *output_drive, int flag); 01416 01417 01418 /** Start writing of the new session. 01419 This call is asynchrounous. I.e. it returns quite soon and the progress has 01420 to be watched by a loop with call burn_drive_get_status() until 01421 BURN_DRIVE_IDLE is returned. 01422 Wrapper for: burn_disc_write() 01423 @since 0.1.0 01424 @param o Options which control the burn process. See burnwrite_opts_*() 01425 in libburn.h. 01426 @param disc Disc object created either by isoburn_prepare_disc() or by 01427 isoburn_prepare_new_image(). 01428 */ 01429 void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); 01430 01431 01432 /** Inquire state and fill parameters of the fifo which is attached to 01433 the emerging track. This should be done in the pacifier loop while 01434 isoburn_disc_write() or burn_disc_write() are active. 01435 This works only with drives obtained by isoburn_drive_scan_and_grab() 01436 or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then 01437 parameter out_drive must have announced the track output drive. 01438 Hint: If only burn_write_opts and not burn_drive is known, then the drive 01439 can be obtained by burn_write_opts_get_drive(). 01440 @since 0.1.0 01441 @param d The drive to which the track with the fifo gets burned. 01442 @param size The total size of the fifo 01443 @param free_bytes The current free capacity of the fifo 01444 @param status_text Returns a pointer to a constant text, see below 01445 @return <0 reply invalid, >=0 fifo status code: 01446 bit0+1=input status, bit2=consumption status, i.e: 01447 0="standby" : data processing not started yet 01448 1="active" : input and consumption are active 01449 2="ending" : input has ended without error 01450 3="failing" : input had error and ended, 01451 4="unused" : ( consumption has ended before processing start ) 01452 5="abandoned" : consumption has ended prematurely 01453 6="ended" : consumption has ended without input error 01454 7="aborted" : consumption has ended after input error 01455 */ 01456 int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes, 01457 char **status_text); 01458 01459 01460 /** Inquire whether the most recent write run was successful. 01461 Wrapper for: burn_drive_wrote_well() 01462 @since 0.1.0 01463 @param d The drive to inquire 01464 @return 1=burn seems to have went well, 0=burn failed 01465 */ 01466 int isoburn_drive_wrote_well(struct burn_drive *d); 01467 01468 01469 /** Call this after isoburn_disc_write has finished and burn_drive_wrote_well() 01470 indicates success. It will eventually complete the emulation of 01471 multi-session functionality, if needed at all. Let libisoburn decide. 01472 Not a wrapper, but peculiar to libisoburn. 01473 @since 0.1.0 01474 @param d The output drive to which the session was written 01475 @return 1 success , <=0 failure 01476 */ 01477 int isoburn_activate_session(struct burn_drive *d); 01478 01479 01480 /** Wait after normal end of operations until libisofs ended all write 01481 threads and freed resource reservations. 01482 This call is not mandatory. But without it, messages from the ending 01483 threads might appear after the application ended its write procedure. 01484 @since 0.1.0 01485 @param input_drive The drive resp. in_drive which was used with the 01486 preparation call. 01487 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01488 NULL if none. 01489 @param flag Bitfield, submit 0 for now. 01490 @return <=0 error , 1 = success 01491 */ 01492 int isoburn_sync_after_write(struct burn_drive *input_drive, 01493 struct burn_drive *output_drive, int flag); 01494 01495 01496 /** Release an aquired drive. 01497 Wrapper for: burn_drive_release() 01498 @since 0.1.0 01499 @param drive The drive to be released 01500 @param eject 1= eject media from drive , 0= do not eject 01501 */ 01502 void isoburn_drive_release(struct burn_drive *drive, int eject); 01503 01504 01505 /** Shutdown all three libraries. 01506 Wrapper for : iso_finish() and burn_finish(). 01507 @since 0.1.0 01508 */ 01509 void isoburn_finish(void); 01510 01511 01512 /* 01513 The following calls are for expert applications only. 01514 An application should have a special reason to use them. 01515 */ 01516 01517 01518 /** Inquire wether the media needs emulation or would be suitable for 01519 generic multi-session via libburn. 01520 @since 0.1.0 01521 @param d The drive to inquire 01522 @return 0 is generic multi-session 01523 1 is emulated multi-session 01524 -1 is not suitable for isoburn 01525 */ 01526 int isoburn_needs_emulation(struct burn_drive *d); 01527 01528