You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
5.5 KiB

15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
  1. /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
  2. /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
  3. Copyright (c) 2006 - 2021 Thomas Schmitt <scdbackup@gmx.net>
  4. Provided under GPL version 2 or later.
  5. */
  6. #ifndef __DRIVE
  7. #define __DRIVE
  8. #include "libburn.h"
  9. #include "toc.h"
  10. #include "structure.h"
  11. #include <pthread.h>
  12. struct burn_drive;
  13. struct command;
  14. struct mempage;
  15. struct scsi_mode_data;
  16. struct burn_speed_descriptor;
  17. struct burn_feature_descr;
  18. #define LEAD_IN 1
  19. #define GAP 2
  20. #define USER_DATA 3
  21. #define LEAD_OUT 4
  22. #define SYNC 5
  23. #define SESSION_LEADOUT_ENTRY(d,s) (d)->toc->session[(s)].leadout_entry
  24. #define CURRENT_SESSION_START(d) \
  25. burn_msf_to_lba(d->toc->session[d->currsession].start_m, \
  26. d->toc->session[d->currsession].start_s, \
  27. d->toc->session[d->currsession].start_f)
  28. #define SESSION_END(d,s) \
  29. TOC_ENTRY_PLBA((d)->toc, SESSION_LEADOUT_ENTRY((d), (s)))
  30. #define PREVIOUS_SESSION_END(d) \
  31. TOC_ENTRY_PLBA((d)->toc, SESSION_LEADOUT_ENTRY((d), (d)->currsession-1))
  32. #define LAST_SESSION_END(d) \
  33. TOC_ENTRY_PLBA((d)->toc, \
  34. SESSION_LEADOUT_ENTRY((d), (d)->toc->sessions-1))
  35. struct burn_drive *burn_drive_register(struct burn_drive *);
  36. int burn_drive_unregister(struct burn_drive *d);
  37. unsigned int burn_drive_count(void);
  38. /* ts A61007 */
  39. /* void burn_wait_all(void); */
  40. /* @param flag bit0= demand freed drives (else released drives) */
  41. int burn_drives_are_clear(int flag);
  42. int burn_sector_length_write(struct burn_drive *d);
  43. int burn_track_control(struct burn_drive *d, int);
  44. void burn_write_empty_sector(int fd);
  45. void burn_write_empty_subcode(int fd);
  46. void burn_drive_free(struct burn_drive *d);
  47. void burn_drive_free_all(void);
  48. /* @param flag bit0= reset global drive list */
  49. int burn_drive_scan_sync(struct burn_drive_info *drives[],
  50. unsigned int *n_drives, int flag);
  51. void burn_disc_erase_sync(struct burn_drive *d, int fast);
  52. int burn_drive_get_block_types(struct burn_drive *d,
  53. enum burn_write_types write_type);
  54. int burn_drive_is_open(struct burn_drive *d);
  55. int burn_drive_is_occupied(struct burn_drive *d);
  56. int burn_drive_forget(struct burn_drive *d, int force);
  57. int burn_drive_convert_fs_adr_sub(char *path, char adr[], int *rec_count);
  58. /* ts A61021 : the unspecific part of sg.c:enumerate_common()
  59. */
  60. int burn_setup_drive(struct burn_drive *d, char *fname);
  61. /* ts A61021 : after-setup activities from sg.c:enumerate_common()
  62. */
  63. struct burn_drive *burn_drive_finish_enum(struct burn_drive *d);
  64. /* ts A61125 : media status aspects of burn_drive_grab() */
  65. int burn_drive_inquire_media(struct burn_drive *d);
  66. /* ts A61125 : model aspects of burn_drive_release */
  67. int burn_drive_mark_unready(struct burn_drive *d, int flag);
  68. /* ts A61226 */
  69. int burn_speed_descriptor_new(struct burn_speed_descriptor **s,
  70. struct burn_speed_descriptor *prev,
  71. struct burn_speed_descriptor *next, int flag);
  72. /* ts A61226 */
  73. /* @param flag bit0= destroy whole next-chain of descriptors */
  74. int burn_speed_descriptor_destroy(struct burn_speed_descriptor **s, int flag);
  75. /* ts A61226 : free dynamically allocated sub data of struct scsi_mode_data */
  76. int burn_mdata_free_subs(struct scsi_mode_data *m);
  77. /* ts A61230 */
  78. void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag);
  79. /* ts A70207 : evaluate write mode related peculiarities of a disc */
  80. struct burn_disc_mode_demands {
  81. int multi_session;
  82. int multi_track;
  83. int unknown_track_size; /* 0=known, 1=unknown, 2=unknown+defaulted */
  84. int mixed_mode;
  85. int audio;
  86. int exotic_track;
  87. int block_types;
  88. int will_append; /* because of media state or multi session disc */
  89. };
  90. int burn_disc_get_write_mode_demands(struct burn_disc *disc,
  91. struct burn_write_opts *opts,
  92. struct burn_disc_mode_demands *result, int flag);
  93. /* ts A70924 : convert a special stdio address into fd number.
  94. @return >0 is a valid fd , -1 indicates unsuitable address string.
  95. */
  96. int burn_drive__fd_from_special_adr(char *adr);
  97. /* ts A70929 : Find the drive which is being worked on by pid , tid */
  98. int burn_drive_find_by_thread_pid(struct burn_drive **d, pid_t pid,
  99. pthread_t tid);
  100. /* ts A51221 - A80731 : Whitelist inquiry functions */
  101. int burn_drive_is_banned(char *device_address);
  102. int burn_drive_whitelist_count(void);
  103. char *burn_drive_whitelist_item(int idx, int flag);
  104. /* ts A80801 */
  105. int burn_drive_is_listed(char *path, struct burn_drive **found, int flag);
  106. /* ts B00226 : Outsourced backend of burn_abort()
  107. @param elapsed to be subtracted from start time
  108. @param flag bit0= do not shutdown the library
  109. */
  110. int burn_abort_5(int patience,
  111. int (*pacifier_func)(void *handle, int patience, int elapsed),
  112. void *handle, int elapsed, int flag);
  113. /* ts B10730 */
  114. /* Send a default mode page 05 to CD and DVD-R-oids */
  115. int burn_drive_send_default_page_05(struct burn_drive *d, int flag);
  116. /* ts B40106 */
  117. int burn_feature_descr_new(struct burn_feature_descr **new,
  118. unsigned char *descr, int descr_len, int flag);
  119. /* ts B40106 */
  120. int burn_feature_descr_free(struct burn_feature_descr **new, int flag);
  121. /* ts B40107 */
  122. int burn_drive_has_feature(struct burn_drive *d, int feature_code,
  123. struct burn_feature_descr **descr, int flag);
  124. int burn_drive_grab_stdio(struct burn_drive *d, int flag);
  125. /* ts C10213 */
  126. /* The size of limitless or oversized devices as pseudo drives */
  127. /* Do not change this value because of its meaning to
  128. burn_drive.media_read_capacity in libburn/transport.h
  129. */
  130. #define BURN_DRIVE_MAX_BYTES ((off_t) (0x7ffffff0) * (off_t) 2048)
  131. #endif /* __DRIVE */