2 * Copyright (c) 2005 Zmanda, Inc. All Rights Reserved.
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 2.1 as
6 * published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11 * License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
18 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
24 /* Tape operations for AIX systems. Most of this stuff is based on
26 http://publibn.boulder.ibm.com/doc_link/Ja_JP/a_doc_lib/files/aixfiles/rmt.htm */
28 /* Uncomment to test compilation on non-AIX systems. */
34 #define st_count mt_count
43 gboolean tape_rewind(int fd) {
47 return 0 == ioctl(fd, STIOCTOP, &st);
50 gboolean tape_fsf(int fd, guint count) {
54 return 0 == ioctl(fd, STIOCTOP, &st);
57 gboolean tape_bsf(int fd, guint count) {
61 return 0 == ioctl(fd, STIOCTOP, &st);
64 gboolean tape_fsr(int fd, guint count) {
68 return 0 == ioctl(fd, STIOCTOP, &st);
71 gboolean tape_bsr(int fd, guint count) {
75 return 0 == ioctl(fd, STIOCTOP, &st);
78 gint tape_eod(int fd) {
79 g_assert_not_reached();
83 gboolean tape_weof(int fd, guint8 count) {
87 return 0 == ioctl(fd, STIOCTOP, &st);
90 gboolean tape_setcompression(int fd, gboolean on) {
94 TapeCheckResult tape_is_tape_device(int fd) {
95 /* AIX doesn't have a no-op. */
96 return TAPE_CHECK_UNKNOWN;
99 TapeCheckResult tape_is_ready(int fd) {
100 return TAPE_CHECK_UNKNOWN;
103 void tape_device_discover_capabilities(TapeDevice * t_self) {
107 self = DEVICE(t_self);
108 g_return_if_fail(self != NULL);
110 bzero(&val, sizeof(val));
111 g_value_init(&val, FEATURE_SUPPORT_FLAGS_TYPE);
113 g_value_set_flags(&val,
114 FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
115 FEATURE_SOURCE_DEFAULT);
116 device_property_set(self, PROPERTY_FSF, &val);
118 g_value_set_flags(&val,
119 FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
120 FEATURE_SOURCE_DEFAULT);
121 device_property_set(self, PROPERTY_BSF, &val);
123 g_value_set_flags(&val,
124 FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
125 FEATURE_SOURCE_DEFAULT);
126 device_property_set(self, PROPERTY_FSR, &val);
128 g_value_set_flags(&val,
129 FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
130 FEATURE_SOURCE_DEFAULT);
131 device_property_set(self, PROPERTY_BSR, &val);
133 g_value_set_flags(&val,
134 FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD |
135 FEATURE_SOURCE_DEFAULT);
136 device_property_set(self, PROPERTY_EOM, &val);
138 g_value_unset_init(&val, G_TYPE_UINT);
139 g_value_set_uint(&val, 2);
140 device_property_set(self, PROPERTY_FINAL_FILEMARKS, &val);