chio.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * ioctl interface for the scsi media changer driver
  4. */
  5. /* changer element types */
  6. #define CHET_MT 0 /* media transport element (robot) */
  7. #define CHET_ST 1 /* storage element (media slots) */
  8. #define CHET_IE 2 /* import/export element */
  9. #define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */
  10. #define CHET_V1 4 /* vendor specific #1 */
  11. #define CHET_V2 5 /* vendor specific #2 */
  12. #define CHET_V3 6 /* vendor specific #3 */
  13. #define CHET_V4 7 /* vendor specific #4 */
  14. /*
  15. * CHIOGPARAMS
  16. * query changer properties
  17. *
  18. * CHIOVGPARAMS
  19. * query vendor-specific element types
  20. *
  21. * accessing elements works by specifing type and unit of the element.
  22. * for example, storage elements are addressed with type = CHET_ST and
  23. * unit = 0 .. cp_nslots-1
  24. *
  25. */
  26. struct changer_params {
  27. int cp_curpicker; /* current transport element */
  28. int cp_npickers; /* number of transport elements (CHET_MT) */
  29. int cp_nslots; /* number of storage elements (CHET_ST) */
  30. int cp_nportals; /* number of import/export elements (CHET_IE) */
  31. int cp_ndrives; /* number of data transfer elements (CHET_DT) */
  32. };
  33. struct changer_vendor_params {
  34. int cvp_n1; /* number of vendor specific elems (CHET_V1) */
  35. char cvp_label1[16];
  36. int cvp_n2; /* number of vendor specific elems (CHET_V2) */
  37. char cvp_label2[16];
  38. int cvp_n3; /* number of vendor specific elems (CHET_V3) */
  39. char cvp_label3[16];
  40. int cvp_n4; /* number of vendor specific elems (CHET_V4) */
  41. char cvp_label4[16];
  42. int reserved[8];
  43. };
  44. /*
  45. * CHIOMOVE
  46. * move a medium from one element to another
  47. */
  48. struct changer_move {
  49. int cm_fromtype; /* type/unit of source element */
  50. int cm_fromunit;
  51. int cm_totype; /* type/unit of destination element */
  52. int cm_tounit;
  53. int cm_flags;
  54. };
  55. #define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */
  56. /*
  57. * CHIOEXCHANGE
  58. * move one medium from element #1 to element #2,
  59. * and another one from element #2 to element #3.
  60. * element #1 and #3 are allowed to be identical.
  61. */
  62. struct changer_exchange {
  63. int ce_srctype; /* type/unit of element #1 */
  64. int ce_srcunit;
  65. int ce_fdsttype; /* type/unit of element #2 */
  66. int ce_fdstunit;
  67. int ce_sdsttype; /* type/unit of element #3 */
  68. int ce_sdstunit;
  69. int ce_flags;
  70. };
  71. #define CE_INVERT1 1
  72. #define CE_INVERT2 2
  73. /*
  74. * CHIOPOSITION
  75. * move the transport element (robot arm) to a specific element.
  76. */
  77. struct changer_position {
  78. int cp_type;
  79. int cp_unit;
  80. int cp_flags;
  81. };
  82. #define CP_INVERT 1
  83. /*
  84. * CHIOGSTATUS
  85. * get element status for all elements of a specific type
  86. */
  87. struct changer_element_status {
  88. int ces_type;
  89. unsigned char __user *ces_data;
  90. };
  91. #define CESTATUS_FULL 0x01 /* full */
  92. #define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */
  93. #define CESTATUS_EXCEPT 0x04 /* error condition */
  94. #define CESTATUS_ACCESS 0x08 /* access allowed */
  95. #define CESTATUS_EXENAB 0x10 /* element can export media */
  96. #define CESTATUS_INENAB 0x20 /* element can import media */
  97. /*
  98. * CHIOGELEM
  99. * get more detailed status information for a single element
  100. */
  101. struct changer_get_element {
  102. int cge_type; /* type/unit */
  103. int cge_unit;
  104. int cge_status; /* status */
  105. int cge_errno; /* errno */
  106. int cge_srctype; /* source element of the last move/exchange */
  107. int cge_srcunit;
  108. int cge_id; /* scsi id (for data transfer elements) */
  109. int cge_lun; /* scsi lun (for data transfer elements) */
  110. char cge_pvoltag[36]; /* primary volume tag */
  111. char cge_avoltag[36]; /* alternate volume tag */
  112. int cge_flags;
  113. };
  114. /* flags */
  115. #define CGE_ERRNO 0x01 /* errno available */
  116. #define CGE_INVERT 0x02 /* media inverted */
  117. #define CGE_SRC 0x04 /* media src available */
  118. #define CGE_IDLUN 0x08 /* ID+LUN available */
  119. #define CGE_PVOLTAG 0x10 /* primary volume tag available */
  120. #define CGE_AVOLTAG 0x20 /* alternate volume tag available */
  121. /*
  122. * CHIOSVOLTAG
  123. * set volume tag
  124. */
  125. struct changer_set_voltag {
  126. int csv_type; /* type/unit */
  127. int csv_unit;
  128. char csv_voltag[36]; /* volume tag */
  129. int csv_flags;
  130. };
  131. #define CSV_PVOLTAG 0x01 /* primary volume tag */
  132. #define CSV_AVOLTAG 0x02 /* alternate volume tag */
  133. #define CSV_CLEARTAG 0x04 /* clear volume tag */
  134. /* ioctls */
  135. #define CHIOMOVE _IOW('c', 1,struct changer_move)
  136. #define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange)
  137. #define CHIOPOSITION _IOW('c', 3,struct changer_position)
  138. #define CHIOGPICKER _IOR('c', 4,int) /* not impl. */
  139. #define CHIOSPICKER _IOW('c', 5,int) /* not impl. */
  140. #define CHIOGPARAMS _IOR('c', 6,struct changer_params)
  141. #define CHIOGSTATUS _IOW('c', 8,struct changer_element_status)
  142. #define CHIOGELEM _IOW('c',16,struct changer_get_element)
  143. #define CHIOINITELEM _IO('c',17)
  144. #define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag)
  145. #define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params)
  146. /* ---------------------------------------------------------------------- */
  147. /*
  148. * Local variables:
  149. * c-basic-offset: 8
  150. * End:
  151. */