00001 00002 /* 00003 API definition of libisoburn. 00004 00005 Copyright 2007-2009 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 14 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 6 00227 #define isoburn_libburn_req_micro 0 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 3 00263 #define isoburn_header_version_micro 4 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 @return 1 = success , 0 = drive not found , <0 = other error 00390 */ 00391 int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], 00392 char* adr, int flag); 00393 00394 /** Aquire a drive from the burn_drive_info[] array which was obtained by 00395 a previous call of burn_drive_scan(). 00396 Wrapper for: burn_drive_grab() 00397 @since 0.1.0 00398 @param drive The drive to grab. E.g. drive_infos[1].drive . 00399 Call isoburn_drive_release(drive) when it it no longer needed. 00400 @param load 1 attempt to load the disc tray. 0 no attempt, rather failure. 00401 @return 1 success, <=0 failure 00402 */ 00403 int isoburn_drive_grab(struct burn_drive *drive, int load); 00404 00405 00406 /** Attach to a drive an application provided method for immediate 00407 delivery of messages. 00408 If no method is set or if the method is set to NULL then libisoburn 00409 delivers messages of the drive through the global msgs_submit() method 00410 set by isoburn_set_msgs_submiti() or by the message queue of libburn. 00411 @since 0.2.0 00412 @param d The drive to which this function, handle and flag shall apply 00413 @param msgs_submit The function call which implements the method 00414 @param submit_handle Handle to be used as first argument of msgs_submit 00415 @param submit_flag Flag to be used as last argument of msgs_submit 00416 @param flag Unused yet, submit 0 00417 */ 00418 int isoburn_drive_set_msgs_submit(struct burn_drive *d, 00419 int (*msgs_submit)(void *handle, int error_code, 00420 char msg_text[], int os_errno, 00421 char severity[], int flag), 00422 void *submit_handle, int submit_flag, int flag); 00423 00424 00425 /** Inquire the media status. Expect the whole spectrum of libburn BURN_DISC_* 00426 with multi-session media. Emulated states with random access media are 00427 BURN_DISC_BLANK and BURN_DISC_APPENDABLE. 00428 Wrapper for: burn_disc_get_status() 00429 @since 0.1.0 00430 @param drive The drive to inquire. 00431 @return The status of the drive, or what kind of disc is in it. 00432 Note: BURN_DISC_UNGRABBED indicates wrong API usage 00433 */ 00434 enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive); 00435 00436 00437 /** Tells whether the media can be treated by isoburn_disc_erase(). 00438 Wrapper for: burn_disc_erasable() 00439 @since 0.1.0 00440 @param drive The drive to inquire. 00441 @return 0=not erasable , else erasable 00442 */ 00443 int isoburn_disc_erasable(struct burn_drive *d); 00444 00445 00446 /** Mark the media as blank. With multi-session media this will call 00447 burn_disc_erase(). With random access media, an eventual ISO-9660 00448 filesystem will get invalidated by altering its start blocks on media. 00449 In case of success, the media is in status BURN_DISC_BLANK afterwards. 00450 Wrapper for: burn_disc_erase() 00451 @since 0.1.0 00452 @param drive The drive with the media to erase. 00453 @param fast 1=fast erase, 0=thorough erase 00454 With DVD-RW, fast erase yields media incapable of multi-session. 00455 */ 00456 void isoburn_disc_erase(struct burn_drive *drive, int fast); 00457 00458 00459 /** Set up isoburn_disc_get_msc1() to return a fabricated value. 00460 This makes only sense between aquiring the drive and reading the 00461 image. After isoburn_read_image() it will confuse the coordination 00462 of libisoburn and libisofs. 00463 Note: Sessions and tracks are counted beginning with 1, not with 0. 00464 @since 0.1.6 00465 @param drive The drive where msc1 is to be set 00466 @param adr_mode Determines how to interpret adr_value and to set msc1. 00467 If adr_value shall represent a number then decimal ASCII 00468 digits are expected. 00469 0= start lba of last session in TOC, ignore adr_value 00470 1= start lba of session number given by adr_value 00471 2= start lba of track given number by adr_value 00472 3= adr_value itself is the lba to be used 00473 4= start lba of last session with volume id 00474 given by adr_value 00475 @param adr_value A string describing the value to be eventually used. 00476 @param flag Bitfield for control purposes. 00477 bit0= @since 0.2.2 00478 with adr_mode 3: adr_value might be 16 blocks too high 00479 (e.g. -C stemming from growisofs). Probe for ISO head 00480 at adr_value-16 and eventually adjust setting. 00481 bit1= insist in seeing a disc object with at least one session 00482 bit2= with adr_mode 4: use adr_value as regular expression 00483 */ 00484 int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, 00485 int flag); 00486 00487 00488 /* ----------------------------------------------------------------------- */ 00489 /* 00490 00491 Wrappers for emulation of TOC on overwriteable media 00492 00493 Media which match the overwriteable usage model lack of a history of sessions 00494 and tracks. libburn will not even hand out a burn_disc object for them and 00495 always declare them blank. libisoburn checks for a valid ISO filesystem 00496 header at LBA 0 and eventually declares them appendable. 00497 Nevertheless one can only determine an upper limit of the size of the overall 00498 image (by isoburn_get_min_start_byte()) but not a list of stored sessions 00499 and their LBAs, as it is possible with true multi-session media. 00500 00501 The following wrappers add the capability to obtain a session and track TOC 00502 from emulated multi-session images on overwriteables if the first session 00503 was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32). 00504 00505 Be aware that the structs emitted by these isoburn calls are not compatible 00506 with the libburn structs. I.e. you may use them only with isoburn_toc_* 00507 calls. 00508 isoburn_toc_disc needs to be freed after use. isoburn_toc_session and 00509 isoburn_toc_track vanish together with their isoburn_toc_disc. 00510 */ 00511 00512 /* Opaque handles to media, session, track */ 00513 struct isoburn_toc_disc; 00514 struct isoburn_toc_session; 00515 struct isoburn_toc_track; 00516 00517 00518 /** Obtain a master handle for the table of content. 00519 This handle governs allocated resources which have to be released by 00520 isoburn_toc_disc_free() when no longer needed. 00521 Wrapper for: burn_drive_get_disc() 00522 @since 0.1.6 00523 @param drive The drive with the media to inspect 00524 @return NULL in case there is no content info, else it is a valid handle 00525 */ 00526 struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d); 00527 00528 00529 /** Tell the number of 2048 byte blocks covered by the table of content. 00530 This number includes the eventual gaps between sessions and tracks. 00531 So this call is not really a wrapper for burn_disc_get_sectors(). 00532 @since 0.1.6 00533 @param disc The master handle of the media 00534 @return number of blocks, <=0 indicates unknown or unreadable state 00535 */ 00536 int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc); 00537 00538 00539 /** Get the array of session handles from the table of content. 00540 Wrapper for: burn_disc_get_sessions() 00541 @since 0.1.6 00542 @param disc The master handle of the media 00543 @param num returns the number of sessions in the array 00544 @return the address of the array of session handles 00545 */ 00546 struct isoburn_toc_session **isoburn_toc_disc_get_sessions( 00547 struct isoburn_toc_disc *disc, int *num); 00548 00549 00550 /** Tell the number of 2048 byte blocks covered by a particular session. 00551 Wrapper for: burn_session_get_sectors() 00552 @since 0.1.6 00553 @param s The session handle 00554 @return number of blocks, <=0 indicates unknown or unreadable state 00555 */ 00556 int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s); 00557 00558 00559 /** Obtain a copy of the entry which describes the end of a particular session. 00560 Wrapper for: burn_session_get_leadout_entry() 00561 @since 0.1.6 00562 @param s The session handle 00563 @param entry A pointer to memory provided by the caller. It will be filled 00564 with info according to struct burn_toc_entry as defined 00565 in libburn.h 00566 */ 00567 void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s, 00568 struct burn_toc_entry *entry); 00569 00570 00571 /** Get the array of track handles from a particular session. 00572 Wrapper for: burn_session_get_tracks() 00573 @since 0.1.6 00574 @param s The session handle 00575 @param num returns the number of tracks in the array 00576 @return the address of the array of track handles 00577 */ 00578 struct isoburn_toc_track **isoburn_toc_session_get_tracks( 00579 struct isoburn_toc_session *s, int *num); 00580 00581 00582 /** Obtain a copy of the entry which describes a particular track. 00583 Wrapper for: burn_track_get_entry() 00584 @since 0.1.6 00585 @param s The track handle 00586 @param entry A pointer to memory provided by the caller. It will be filled 00587 with info according to struct burn_toc_entry as defined 00588 in libburn.h 00589 */ 00590 void isoburn_toc_track_get_entry(struct isoburn_toc_track *t, 00591 struct burn_toc_entry *entry); 00592 00593 00594 /** Release the memory associated with a master handle of media. 00595 The handle is invalid afterwards and may not be used any more. 00596 Wrapper for: burn_disc_free() 00597 @since 0.1.6 00598 @param disc The master handle of the media 00599 */ 00600 void isoburn_toc_disc_free(struct isoburn_toc_disc *disc); 00601 00602 00603 /** Try whether the data at the given address look like a ISO 9660 00604 image header and obtain its alleged size. Depending on the info mode 00605 one other string of text information can be retrieved too. 00606 @since 0.1.6 00607 @param drive The drive with the media to inspect 00608 @param lba The block number from where to read 00609 @param image_blocks The number of 2048 bytes blocks 00610 @param info Caller provided memory, enough to take eventual info reply 00611 @param flag bit0-7: info return mode 00612 0= do not return anything in info (do not even touch it) 00613 1= copy volume id to info (info needs 33 bytes) 00614 2= @since 0.2.2 : 00615 copy 64 kB header to info (needs 65536 bytes) 00616 bit13= @since 0.2.2: 00617 do not read head from media but use first 64 kB from info 00618 bit14= check both half buffers (not only second) 00619 return 2 if found in first block 00620 bit15= return-1 on read error 00621 @return >0 seems to be a valid ISO image, 0 format not recognized, <0 error 00622 */ 00623 int isoburn_read_iso_head(struct burn_drive *d, int lba, 00624 int *image_blocks, char *info, int flag); 00625 00626 00627 /** Try to convert the given entity address into various entity addresses 00628 which would describe it. 00629 Note: Sessions and tracks are counted beginning with 1, not with 0. 00630 @since 0.3.2 00631 @param drive The drive where msc1 is to be set 00632 @param adr_mode Determines how to interpret the input adr_value. 00633 If adr_value shall represent a number then decimal ASCII 00634 digits are expected. 00635 0= start lba of last session in TOC, ignore adr_value 00636 1= start lba of session number given by adr_value 00637 2= start lba of track given number by adr_value 00638 3= adr_value itself is the lba to be used 00639 4= start lba of last session with volume id 00640 given by adr_value 00641 @param adr_value A string describing the value to be eventually used. 00642 @param lba returns the block address of the entity, -1 means invalid 00643 @param track returns the track number of the entity, -1 means invalid 00644 @param session returns the session number of the entity, -1 means invalid 00645 @param volid returns the volume id of the entity if it is a ISO session 00646 @param flag Bitfield for control purposes. 00647 bit2= with adr_mode 4: use adr_value as regular expression 00648 @return <=0 error , 1 ok, ISO session, 2 ok, not an ISO session 00649 */ 00650 int isoburn_get_mount_params(struct burn_drive *d, 00651 int adr_mode, char *adr_value, 00652 int *lba, int *track, int *session, 00653 char volid[33], int flag); 00654 00655 00656 /* ----------------------------------------------------------------------- */ 00657 /* 00658 00659 Options for image reading. 00660 00661 An application shall create an option set object by isoburn_ropt_new(), 00662 program it by isoburn_ropt_set_*(), use it with isoburn_read_image(), 00663 and finally delete it by isoburn_ropt_destroy(). 00664 00665 */ 00666 /* ----------------------------------------------------------------------- */ 00667 00668 struct isoburn_read_opts; 00669 00670 /** Produces a set of image read options, initialized with default values. 00671 @since 0.1.0 00672 @param o the newly created option set object 00673 @param flag Bitfield for control purposes. Submit 0 for now. 00674 @return 1=ok , <0 = failure 00675 */ 00676 int isoburn_ropt_new(struct isoburn_read_opts **o, int flag); 00677 00678 00679 /** Deletes an option set which was created by isoburn_ropt_new(). 00680 @since 0.1.0 00681 @param o The option set to work on 00682 @param flag Bitfield for control purposes. Submit 0 for now. 00683 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00684 */ 00685 int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag); 00686 00687 00688 /** Which existing ISO 9660 extensions in the image to read or not to read. 00689 Whether to read the content of an existing image at all. 00690 The bits can be combined by | resp. inquired by &. 00691 @since 0.1.0 00692 @param ext Bitfield: 00693 bit0= norock 00694 Do not read Rock Ridge extensions 00695 bit1= nojoliet 00696 Do not read Joliet extensions 00697 bit2= noiso1999 00698 Do not read ISO 9660:1999 enhanced tree 00699 bit3= preferjoliet 00700 When both Joliet and RR extensions are present, the RR 00701 tree is used. If you prefer using Joliet, set this to 1. 00702 bit4= pretend_blank 00703 Always create empty image.Ignore any image on input drive. 00704 bit5= noaaip 00705 @since 0.3.4 00706 Do not load AAIP information from image. This information 00707 eventually contains ACL or XFS-style Extended Attributes. 00708 bit6= noacl 00709 @since 0.3.4 00710 Do not obtain ACL from external filesystem objects (e.g. 00711 local filesystem files). 00712 bit7= noea 00713 @since 0.3.4 00714 Do not obtain XFS-style Extended Attributes from external 00715 filesystem objects (e.g. local filesystem files). 00716 @return 1 success, <=0 failure 00717 */ 00718 #define isoburn_ropt_norock 1 00719 #define isoburn_ropt_nojoliet 2 00720 #define isoburn_ropt_noiso1999 4 00721 #define isoburn_ropt_preferjoliet 8 00722 #define isoburn_ropt_pretend_blank 16 00723 #define isoburn_ropt_noaaip 32 00724 #define isoburn_ropt_noacl 64 00725 #define isoburn_ropt_noea 128 00726 00727 int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext); 00728 int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext); 00729 00730 00731 /** Default attributes to use if no RockRidge extension gets loaded. 00732 @since 0.1.0 00733 @param o The option set to work on 00734 @param uid user id number (see /etc/passwd) 00735 @param gid group id number (see /etc/group) 00736 @param mode permissions (not file type) as of man 2 stat. 00737 With directories, r-permissions will automatically imply 00738 x-permissions. See isoburn_ropt_set_default_dirperms() below. 00739 @return 1 success, <=0 failure 00740 */ 00741 int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o, 00742 uid_t uid, gid_t gid, mode_t mode); 00743 int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o, 00744 uid_t *uid, gid_t *gid, mode_t *mode); 00745 00746 /** Default attributes to use on directories if no RockRidge extension 00747 gets loaded. 00748 Above call isoburn_ropt_set_default_perms() automatically adds 00749 x-permissions to r-permissions for directories. This call here may 00750 be done afterwards to set independend permissions for directories, 00751 especially to override the automatically added x-permissions. 00752 @since 0.1.0 00753 @param o The option set to work on 00754 @param mode permissions (not file type) as of man 2 stat. 00755 @return 1 success, <=0 failure 00756 */ 00757 int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o, 00758 mode_t mode); 00759 int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o, 00760 mode_t *mode); 00761 00762 00763 00764 /** Set the character set for reading RR file names from ISO images. 00765 @since 0.1.0 00766 @param o The option set to work on 00767 @param input_charset Set this to NULL to use the default locale charset. 00768 For selecting a particular character set, submit its 00769 name, e.g. as listed by program iconv -l. 00770 Example: "UTF-8". 00771 @return 1 success, <=0 failure 00772 */ 00773 int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o, 00774 char *input_charset); 00775 int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o, 00776 char **input_charset); 00777 00778 00779 /** After calling function isoburn_read_image() there are informations 00780 available in the option set. 00781 This info can be obtained as bits in parameter has_what. Like: 00782 joliet_available = (has_what & isoburn_ropt_has_joliet); 00783 @since 0.1.0 00784 @param o The option set to work on 00785 @param size Number of image data blocks, 2048 bytes each. 00786 @param has_what Bitfield: 00787 bit0= has_rockridge 00788 RockRidge extension info is available (POSIX filesystem) 00789 bit1= has_joliet 00790 Joliet extension info is available (suitable for MS-Windows) 00791 bit2= has_iso1999 00792 ISO version 2 Enhanced Volume Descriptor is available. 00793 This is rather exotic. 00794 bit3= has_el_torito 00795 El-Torito boot record is present 00796 @return 1 success, <=0 failure 00797 */ 00798 #define isoburn_ropt_has_rockridge 1 00799 #define isoburn_ropt_has_joliet 2 00800 #define isoburn_ropt_has_iso1999 4 00801 #define isoburn_ropt_has_el_torito 8 00802 00803 /* ts A90122 */ 00804 /* >>> to be implemented: 00805 #define isoburn_ropt_has_acl 64 00806 #define isoburn_ropt_ihas_ea 128 00807 */ 00808 00809 int isoburn_ropt_get_size_what(struct isoburn_read_opts *o, 00810 uint32_t *size, int *has_what); 00811 00812 00813 /* ----------------------------------------------------------------------- */ 00814 /* End of Options for image reading */ 00815 /* ----------------------------------------------------------------------- */ 00816 00817 /* ----------------------------------------------------------------------- */ 00818 /* 00819 00820 Options for image generation by libisofs and image transport to libburn. 00821 00822 An application shall create an option set by isoburn_igopt_new(), 00823 program it by isoburn_igopt_set_*(), use it with either 00824 isoburn_prepare_new_image() or isoburn_prepare_disc(), and finally delete 00825 it by isoburn_igopt_destroy(). 00826 00827 */ 00828 /* ----------------------------------------------------------------------- */ 00829 00830 struct isoburn_imgen_opts; 00831 00832 /** Produces a set of generation and transfer options, initialized with default 00833 values. 00834 @since 0.1.0 00835 @param o the newly created option set object 00836 @param flag Bitfield for control purposes. Submit 0 for now. 00837 @return 1=ok , <0 = failure 00838 */ 00839 int isoburn_igopt_new(struct isoburn_imgen_opts **o, int flag); 00840 00841 00842 /** Deletes an option set which was created by isoburn_igopt_new(). 00843 @since 0.1.0 00844 @param o The option set to give up 00845 @param flag Bitfield for control purposes. Submit 0 for now. 00846 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00847 */ 00848 int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag); 00849 00850 00851 /** ISO level to write at. 00852 @since 0.1.0 00853 @param o The option set to work on 00854 @param level is a term of the ISO 9660 standard. It should be one of: 00855 1= filenames restricted to form 8.3 00856 2= filenames allowed up to 31 characters 00857 @return 1 success, <=0 failure 00858 */ 00859 int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level); 00860 int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level); 00861 00862 00863 /** Which extensions to support. 00864 @since 0.1.0 00865 @param o The option set to work on 00866 @param ext Bitfield: 00867 bit0= rockridge 00868 Rock Ridge extensions add POSIX file attributes like 00869 owner, group, access permissions, long filenames. Very 00870 advisable if the designed audience has Unix style systems. 00871 bit1= joliet 00872 Longer filenames for Windows systems. 00873 Weaker than RockRidge, but also readable with Linux. 00874 bit2= iso1999 00875 This is rather exotic. Better do not surprise the readers. 00876 bit5= aaip 00877 The libisofs specific SUSP based extension of ECMA-119 which 00878 can encode ACL and XFS-style Extended Attributes. 00879 @return 1 success, <=0 failure 00880 */ 00881 #define isoburn_igopt_rockridge 1 00882 #define isoburn_igopt_joliet 2 00883 #define isoburn_igopt_iso1999 4 00884 /* ts A90122 */ 00885 #define isoburn_igopt_aaip 32 00886 int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext); 00887 int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext); 00888 00889 /** Relaxed constraints. Setting any of the bits to 1 break the specifications, 00890 but it is supposed to work on most moderns systems. Use with caution. 00891 @since 0.1.0 00892 @param o The option set to work on 00893 @param relax Bitfield: 00894 bit0= omit_version_numbers 00895 Omit the version number (";1") at the end of the 00896 ISO-9660 identifiers. Version numbers are usually 00897 not used. 00898 bit1= allow_deep_paths 00899 Allow ISO-9660 directory hierarchy to be deeper 00900 than 8 levels. 00901 bit2= allow_longer_paths 00902 Allow path in the ISO-9660 tree to have more than 00903 255 characters. 00904 bit3= max_37_char_filenames 00905 Allow a single file or directory hierarchy to have 00906 up to 37 characters. This is larger than the 31 00907 characters allowed by ISO level 2, and the extra space 00908 is taken from the version number, so this also forces 00909 omit_version_numbers. 00910 bit4= no_force_dots 00911 ISO-9660 forces filenames to have a ".", that separates 00912 file name from extension. libisofs adds it if original 00913 filename has none. Set this to 1 to prevent this 00914 behavior. 00915 bit5= allow_lowercase 00916 Allow lowercase characters in ISO-9660 filenames. 00917 By default, only uppercase characters, numbers and 00918 a few other characters are allowed. 00919 bit6= allow_full_ascii 00920 Allow all ASCII characters to be appear on an ISO-9660 00921 filename. Note * that "/" and "\0" characters are never 00922 allowed, even in RR names. 00923 bit7= joliet_longer_paths 00924 Allow paths in the Joliet tree to have more than 00925 240 characters. 00926 bit8= always_gmt 00927 Write timestamps as GMT although the specs prescribe local 00928 time with eventual non-zero timezone offset. Negative 00929 timezones (west of GMT) can trigger bugs in some operating 00930 systems which typically appear in mounted ISO images as if 00931 the timezone shift from GMT was applied twice 00932 (e.g. in New York 22:36 becomes 17:36). 00933 bit9= rrip_version_1_10 00934 Write Rock Ridge info as of specification RRIP-1.10 rather 00935 than RRIP-1.12: signature "RRIP_1991A" rather than 00936 "IEEE_1282", field PX without file serial number. 00937 bit10= dir_rec_mtime 00938 Store as ECMA-119 Directory Record timestamp the mtime 00939 of the source rather than the image creation time. 00940 bit11= aaip_susp_1_10 00941 Write AAIP fields without announcing AAIP by an ER field and 00942 without distinguishing RRIP fields from the AAIP field by 00943 prefixed ES fields. This saves 5 to 10 bytes per file and 00944 might avoid problems with readers which only accept RRIP. 00945 SUSP-1.10 allows it, SUSP-1.12 frowns on it. 00946 00947 @return 1 success, <=0 failure 00948 */ 00949 #define isoburn_igopt_omit_version_numbers 1 00950 #define isoburn_igopt_allow_deep_paths 2 00951 #define isoburn_igopt_allow_longer_paths 4 00952 #define isoburn_igopt_max_37_char_filenames 8 00953 #define isoburn_igopt_no_force_dots 16 00954 #define isoburn_igopt_allow_lowercase 32 00955 #define isoburn_igopt_allow_full_ascii 64 00956 #define isoburn_igopt_joliet_longer_paths 128 00957 #define isoburn_igopt_always_gmt 256 00958 #define isoburn_igopt_rrip_version_1_10 512 00959 #define isoburn_igopt_dir_rec_mtime 1024 00960 #define isoburn_igopt_aaip_susp_1_10 2048 00961 int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax); 00962 int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax); 00963 00964 00965 /** Whether and how files should be sorted. 00966 @since 0.1.0 00967 @param o The option set to work on 00968 @param value Bitfield: bit0= sort_files_by_weight 00969 files should be sorted based on their weight. 00970 Weight is attributed to files in the image 00971 by libisofs call iso_node_set_sort_weight(). 00972 @return 1 success, <=0 failure 00973 */ 00974 #define isoburn_igopt_sort_files_by_weight 1 00975 int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value); 00976 int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value); 00977 00978 00979 /** Set the override values for files and directory permissions. 00980 The parameters replace_* these take one of three values: 0, 1 or 2. 00981 If 0, the corresponding attribute will be kept as set in the IsoNode 00982 at the time of image generation. 00983 If set to 1, the corresponding attrib. will be changed by a default 00984 suitable value. 00985 With value 2, the attrib. will be changed with the value specified 00986 in the corresponding *_mode options. Note that only the permissions 00987 are set, the file type remains unchanged. 00988 @since 0.1.0 00989 @param o The option set to work on 00990 @param replace_dir_mode whether and how to override directories 00991 @param replace_file_mode whether and how to override files of other type 00992 @param dir_mode Mode to use on dirs with replace_dir_mode == 2. 00993 @param file_mode; Mode to use on files with replace_file_mode == 2. 00994 @return 1 success, <=0 failure 00995 */ 00996 int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o, 00997 int replace_dir_mode, int replace_file_mode, 00998 mode_t dir_mode, mode_t file_mode); 00999 int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o, 01000 int *replace_dir_mode, int *replace_file_mode, 01001 mode_t *dir_mode, mode_t *file_mode); 01002 01003 /** Set the override values values for group id and user id. 01004 The rules are like with above overriding of mode values. replace_* controls 01005 whether and how. The other two parameters provide values for eventual use. 01006 @since 0.1.0 01007 @param o The option set to work on 01008 @param replace_uid whether and how to override user ids 01009 @param replace_gid whether and how to override group ids 01010 @param uid User id to use with replace_uid == 2. 01011 @param gid Group id to use on files with replace_gid == 2. 01012 @return 1 success, <=0 failure 01013 */ 01014 int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o, 01015 int replace_uid, int replace_gid, 01016 uid_t uid, gid_t gid); 01017 int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o, 01018 int *replace_uid, int *replace_gid, 01019 uid_t *uid, gid_t *gid); 01020 01021 /** Set the charcter set to use for representing filenames in the image. 01022 @since 0.1.0 01023 @param o The option set to work on 01024 @param output_charset Set this to NULL to use the default output charset. 01025 For selecting a particular character set, submit its 01026 name, e.g. as listed by program iconv -l. 01027 Example: "UTF-8". 01028 @return 1 success, <=0 failure 01029 */ 01030 int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o, 01031 char *output_charset); 01032 int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o, 01033 char **output_charset); 01034 01035 01036 /** The number of bytes to be used for the fifo which decouples libisofs 01037 and libburn for better throughput and for reducing the risk of 01038 interrupting signals hitting the libburn thread which operates the 01039 MMC drive. 01040 The size will be rounded up to the next full 2048. 01041 Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway). 01042 @since 0.1.0 01043 @param o The option set to work on 01044 @param fifo_size Number of bytes to use 01045 @return 1 success, <=0 failure 01046 */ 01047 int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size); 01048 int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size); 01049 01050 01051 /** Obtain after image preparation the block address where the session will 01052 start on media. 01053 This value cannot be set by the application but only be inquired. 01054 @since 0.1.4 01055 @param o The option set to work on 01056 @param lba The block number of the session start on media. 01057 <0 means that no address has been determined yet. 01058 @return 1 success, <=0 failure 01059 */ 01060 int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba); 01061 01062 01063 /** Obtain after image preparation the lowest block address of file content 01064 data. Failure can occur if libisofs is too old to provide this information, 01065 if the result exceeds 31 bit, or if the call is made before image 01066 preparation. 01067 This value cannot be set by the application but only be inquired. 01068 @since 0.3.4 01069 @param o The option set to work on 01070 @param lba The block number of the session start on media. 01071 <0 means that no address has been determined yet. 01072 @return 1 success, <=0 failure 01073 */ 01074 int isoburn_igopt_get_data_start(struct isoburn_imgen_opts *o, int *lba); 01075 01076 01077 01078 /* ----------------------------------------------------------------------- */ 01079 /* End of Options for image generation */ 01080 /* ----------------------------------------------------------------------- */ 01081 01082 01083 /** Get the image attached to a drive, if any. 01084 @since 0.1.0 01085 @param d The drive to inquire 01086 @return A reference to attached image, or NULL if the drive has no image 01087 attached. This reference needs to be released via iso_image_unref() 01088 when it is not longer needed. 01089 */ 01090 IsoImage *isoburn_get_attached_image(struct burn_drive *d); 01091 01092 01093 /** Load the ISO filesystem directory tree from the media in the given drive. 01094 This will give libisoburn the base on which it can let libisofs perform 01095 image growing or image modification. The loaded volset gets attached 01096 to the drive object and handed out to the application. 01097 Not a wrapper, but peculiar to libisoburn. 01098 @since 0.1.0 01099 @param d The drive which holds an existing ISO filesystem or blank media. 01100 d is allowed to be NULL which produces an empty ISO image. In 01101 this case one has to call before writing isoburn_attach_volset() 01102 with the volset from this call and with the intended output 01103 drive. 01104 @param read_opts The read options which can be chosen by the application 01105 @param image the image read, if the disc is blank it will have no files. 01106 This reference needs to be released via iso_image_unref() when 01107 it is not longer needed. The drive, if not NULL, will hold an 01108 own reference which it will release when it gets a new volset 01109 or when it gets released via isoburn_drive_release(). 01110 You can pass NULL if you already have a reference or you plan to 01111 obtain it later with isoburn_get_attached_image(). Of course, if 01112 you haven't specified a valid drive (i.e., if d == NULL), this 01113 parameter can't be NULL. 01114 @return <=0 error , 1 = success 01115 */ 01116 int isoburn_read_image(struct burn_drive *d, 01117 struct isoburn_read_opts *read_opts, 01118 IsoImage **image); 01119 01120 /** Set a callback function for producing pacifier messages during the lengthy 01121 process of image reading. The callback function and the application handle 01122 are stored until they are needed for the underlying call to libisofs. 01123 Other than with libisofs the handle is managed entirely by the application. 01124 An idle .free() function is exposed to libisofs. The handle has to stay 01125 valid until isoburn_read_image() is done. It has to be detached by 01126 isoburn_set_read_pacifier(drive, NULL, NULL); 01127 before it may be removed from memory. 01128 @since 0.1.0 01129 @param drive The drive which will be used with isoburn_read_image() 01130 It has to be aquired by an isoburn_* wrapper call. 01131 @param read_pacifier The callback function 01132 @param app_handle The app handle which the callback function can obtain 01133 via iso_image_get_attached_data() from its IsoImage* 01134 @return 1 success, <=0 failure 01135 */ 01136 int isoburn_set_read_pacifier(struct burn_drive *drive, 01137 int (*read_pacifier)(IsoImage*, IsoFileSource*), 01138 void *app_handle); 01139 01140 01141 /** Set the IsoImage to be used with a drive. This eventually releases 01142 the reference to the old IsoImage attached to the drive. 01143 Caution: Use with care. It hardly makes sense to replace an image that 01144 reflects a valid ISO image on media. 01145 This call is rather intended for writing a newly created and populated 01146 image to blank media. The use case in xorriso is to let an image survive 01147 the change or demise of the outdev target drive. 01148 @since 0.1.0 01149 @param d The drive which shall be write target of the volset. 01150 @param image The image that represents the image to be written. 01151 This image pointer MUST already be a valid reference suitable 01152 for iso_image_unref(). 01153 It may have been obtained by appropriate libisofs calls or by 01154 isoburn_read_image() with d==NULL. 01155 @return <=0 error , 1 = success 01156 */ 01157 int isoburn_attach_image(struct burn_drive *d, IsoImage *image); 01158 01159 01160 /** Return the best possible estimation of the currently available capacity of 01161 the media. This might depend on particular write option settings and on 01162 drive state. 01163 An eventual start address for emulated multi-session will be subtracted 01164 from the capacity estimation given by burn_disc_available_space(). 01165 Negative results get defaulted to 0. 01166 Wrapper for: burn_disc_available_space() 01167 @since 0.1.0 01168 @param d The drive to query. 01169 @param o If not NULL: write parameters to be set on drive before query 01170 @return number of most probably available free bytes 01171 */ 01172 off_t isoburn_disc_available_space(struct burn_drive *d, 01173 struct burn_write_opts *o); 01174 01175 01176 /** Obtain the start block number of the most recent session on media. In 01177 case of random access media this will normally be 0. Successfull return is 01178 not a guarantee that there is a ISO-9660 image at all. The call will fail, 01179 nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE 01180 or BURN_DISC_FULL. 01181 Note: The result of this call may be fabricated by a previous call of 01182 isoburn_set_msc1() which can override the rule to load the most recent 01183 session. 01184 Wrapper for: burn_disc_get_msc1() 01185 @since 0.1.0 01186 @param d The drive to inquire 01187 @param start_lba Contains on success the start address in 2048 byte blocks 01188 @return <=0 error , 1 = success 01189 */ 01190 int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba); 01191 01192 01193 /** Use this with trackno==0 to obtain the predicted start block number of the 01194 new session. The interesting number is returned in parameter nwa. 01195 Wrapper for: burn_disc_track_lba_nwa() 01196 @since 0.1.0 01197 @param d The drive to inquire 01198 @param o If not NULL: write parameters to be set on drive before query 01199 @param trackno Submit 0. 01200 @param lba return value: start lba 01201 @param nwa return value: Next Writeable Address 01202 @return 1=nwa is valid , 0=nwa is not valid , -1=error 01203 */ 01204 int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, 01205 int trackno, int *lba, int *nwa); 01206 01207 01208 /** Obtain the size which was attributed to an emulated appendable on actually 01209 overwriteable media. This value is supposed to be <= 2048 * nwa as of 01210 isoburn_disc_track_lba_nwa(). 01211 @since 0.1.0 01212 @param drive The drive holding the media. 01213 @param start_byte The reply value counted in bytes, not in sectors. 01214 @param flag Unused yet. Submit 0. 01215 @return 1=stat_byte is valid, 0=not an emulated appendable, -1=error 01216 */ 01217 int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte, 01218 int flag); 01219 01220 01221 /** To choose the expansion method of Growing: 01222 Create a disc object for writing the new session from the created or loaded 01223 iso_volset which has been manipulated via libisofs, to the same media from 01224 where the image was eventually loaded. This struct burn_disc is ready for 01225 use by a subsequent call to isoburn_disc_write(). 01226 After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE 01227 again, the burn_disc object has to be disposed by burn_disc_free(). 01228 @since 0.1.0 01229 @param drive The combined source and target drive, grabbed with 01230 isoburn_drive_scan_and_grab(). . 01231 @param disc Returns the newly created burn_disc object. 01232 @param opts Image generation options, see isoburn_igopt_*() 01233 @return <=0 error , 1 = success 01234 */ 01235 int isoburn_prepare_disc(struct burn_drive *drive, struct burn_disc **disc, 01236 struct isoburn_imgen_opts *opts); 01237 01238 01239 /** To choose the expansion method of Modifying: 01240 Create a disc object for producing a new image from a previous image 01241 plus the changes made by user. The generated burn_disc is suitable 01242 to be written to a grabbed drive with blank writeable media. 01243 But you must not use the same drive for input and output, because data 01244 will be read from the source drive while at the same time the target 01245 drive is already writing. 01246 The resulting burn_disc object has to be disposed when all its writing 01247 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01248 burn_disc_write(). 01249 @since 0.1.0 01250 @param in_drive The input drive, grabbed with isoburn_drive_aquire() or 01251 one of its alternatives. 01252 @param disc Returns the newly created burn_disc object. 01253 @param opts Options for image generation and data transport to media. 01254 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01255 @return <=0 error , 1 = success 01256 */ 01257 int isoburn_prepare_new_image(struct burn_drive *in_drive, 01258 struct burn_disc **disc, 01259 struct isoburn_imgen_opts *opts, 01260 struct burn_drive *out_drive); 01261 01262 01263 /** To choose the expansion method of Blind Growing: 01264 Create a disc object for writing an add-on session from the created or 01265 loaded IsoImage which has been manipulated via libisofs, to a different 01266 drive than the one from where it was loaded. 01267 Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped 01268 into some burn program like with this classic gesture: 01269 mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev 01270 Parameter translation into libisoburn: 01271 $dev is the address by which parameter in_drive of this call was aquired 01272 $msc1 was set by isoburn_set_msc1() before image reading 01273 or was detected from the in_drive media 01274 $nwa is a parameter of this call 01275 or can be used as detected from the in_drive media 01276 01277 This call waits for libisofs output to become available and then detaches 01278 the input drive object from the data source object by which libisofs was 01279 reading from the input drive. 01280 So, as far as libisofs is concerned, that drive may be released immediately 01281 after this call in order to allow the consumer to access the drive for 01282 writing. 01283 The consumer should wait for input to become available and only then open 01284 its burn drive. With cdrecord this is caused by option -waiti. 01285 01286 The resulting burn_disc object has to be disposed when all its writing 01287 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01288 burn_disc_write(). 01289 @since 0.2.2 01290 @param in_drive The input drive,grabbed with isoburn_drive_scan_and_grab(). 01291 @param disc Returns the newly created burn_disc object. 01292 @param opts Options for image generation and data transport to media. 01293 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01294 typically stdio:/dev/fd/1 . 01295 @param nwa The address (2048 byte block count) where the add-on 01296 session will be finally stored on a mountable media 01297 or in a mountable file. 01298 If nwa is -1 then the address is used as determined from 01299 the in_drive media. 01300 @return <=0 error , 1 = success 01301 */ 01302 int isoburn_prepare_blind_grow(struct burn_drive *d, struct burn_disc **disc, 01303 struct isoburn_imgen_opts *opts, 01304 struct burn_drive *out_drive, int nwa); 01305 01306 01307 /** 01308 Revoke isoburn_prepare_*() instead of running isoburn_disc_write(). 01309 libisofs reserves resources and maybe already starts generating the 01310 image stream when one of above three calls is performed. It is mandatory to 01311 either run isoburn_disc_write() or to revoke the preparations by the 01312 call described here. 01313 @since 0.1.0 01314 @param input_drive The drive resp. in_drive which was used with the 01315 preparation call. 01316 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01317 NULL if none. 01318 @param flag Bitfield, submit 0 for now. 01319 bit0= -reserved for internal use- 01320 @return <0 error, 0= no pending preparations detectable, 1 = canceled 01321 */ 01322 int isoburn_cancel_prepared_write(struct burn_drive *input_drive, 01323 struct burn_drive *output_drive, int flag); 01324 01325 01326 /** Start writing of the new session. 01327 This call is asynchrounous. I.e. it returns quite soon and the progress has 01328 to be watched by a loop with call burn_drive_get_status() until 01329 BURN_DRIVE_IDLE is returned. 01330 Wrapper for: burn_disc_write() 01331 @since 0.1.0 01332 @param o Options which control the burn process. See burnwrite_opts_*() 01333 in libburn.h. 01334 @param disc Disc object created either by isoburn_prepare_disc() or by 01335 isoburn_prepare_new_image(). 01336 */ 01337 void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); 01338 01339 01340 /** Inquire state and fill parameters of the fifo which is attached to 01341 the emerging track. This should be done in the pacifier loop while 01342 isoburn_disc_write() or burn_disc_write() are active. 01343 This works only with drives obtained by isoburn_drive_scan_and_grab() 01344 or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then 01345 parameter out_drive must have announced the track output drive. 01346 Hint: If only burn_write_opts and not burn_drive is known, then the drive 01347 can be obtained by burn_write_opts_get_drive(). 01348 @since 0.1.0 01349 @param d The drive to which the track with the fifo gets burned. 01350 @param size The total size of the fifo 01351 @param free_bytes The current free capacity of the fifo 01352 @param status_text Returns a pointer to a constant text, see below 01353 @return <0 reply invalid, >=0 fifo status code: 01354 bit0+1=input status, bit2=consumption status, i.e: 01355 0="standby" : data processing not started yet 01356 1="active" : input and consumption are active 01357 2="ending" : input has ended without error 01358 3="failing" : input had error and ended, 01359 4="unused" : ( consumption has ended before processing start ) 01360 5="abandoned" : consumption has ended prematurely 01361 6="ended" : consumption has ended without input error 01362 7="aborted" : consumption has ended after input error 01363 */ 01364 int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes, 01365 char **status_text); 01366 01367 01368 /** Inquire whether the most recent write run was successful. 01369 Wrapper for: burn_drive_wrote_well() 01370 @since 0.1.0 01371 @param d The drive to inquire 01372 @return 1=burn seems to have went well, 0=burn failed 01373 */ 01374 int isoburn_drive_wrote_well(struct burn_drive *d); 01375 01376 01377 /** Call this after isoburn_disc_write has finished and burn_drive_wrote_well() 01378 indicates success. It will eventually complete the emulation of 01379 multi-session functionality, if needed at all. Let libisoburn decide. 01380 Not a wrapper, but peculiar to libisoburn. 01381 @since 0.1.0 01382 @param d The output drive to which the session was written 01383 @return 1 success , <=0 failure 01384 */ 01385 int isoburn_activate_session(struct burn_drive *drive); 01386 01387 01388 /** Wait after normal end of operations until libisofs ended all write 01389 threads and freed resource reservations. 01390 This call is not mandatory. But without it, messages from the ending 01391 threads might appear after the application ended its write procedure. 01392 @since 0.1.0 01393 @param input_drive The drive resp. in_drive which was used with the 01394 preparation call. 01395 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01396 NULL if none. 01397 @param flag Bitfield, submit 0 for now. 01398 @return <=0 error , 1 = success 01399 */ 01400 int isoburn_sync_after_write(struct burn_drive *input_drive, 01401 struct burn_drive *output_drive, int flag); 01402 01403 01404 /** Release an aquired drive. 01405 Wrapper for: burn_drive_release() 01406 @since 0.1.0 01407 @param drive The drive to be released 01408 @param eject 1= eject media from drive , 0= do not eject 01409 */ 01410 void isoburn_drive_release(struct burn_drive *drive, int eject); 01411 01412 01413 /** Shutdown all three libraries. 01414 Wrapper for : iso_finish() and burn_finish(). 01415 @since 0.1.0 01416 */ 01417 void isoburn_finish(void); 01418 01419 01420 /* 01421 The following calls are for expert applications only. 01422 An application should have a special reason to use them. 01423 */ 01424 01425 01426 /** Inquire wether the media needs emulation or would be suitable for 01427 generic multi-session via libburn. 01428 @since 0.1.0 01429 @param d The drive to inquire 01430 @return 0 is generic multi-session 01431 1 is emulated multi-session 01432 -1 is not suitable for isoburn 01433 */ 01434 int isoburn_needs_emulation(struct burn_drive *drive); 01435 01436