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