2 * Copyright (c) 2005-2008 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., 465 S Mathlida Ave, Suite 300
18 * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
21 /* Tape operations for XENIX systems. Most of this stuff is based on
23 http://www.ifthenfi.nl:8080/cgi-bin/ssl_getmanpage?tape+HW+XNX234+tape
28 #include "glib-util.h"
30 /* Uncomment to test compilation on non-XENIX systems. */
40 gboolean tape_rewind(int fd) {
41 return 0 == ioctl(fd, MT_REWIND);
44 gboolean tape_fsf(int fd, guint count) {
46 if (0 != ioctl(fd, T_RFM))
52 gboolean tape_bsf(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) {
53 g_assert_not_reached();
57 gboolean tape_fsr(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) {
58 g_assert_not_reached();
62 gboolean tape_bsr(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) {
63 g_assert_not_reached();
67 gint tape_eod(int fd G_GNUC_UNUSED) {
68 g_assert_not_reached();
72 gboolean tape_weof(int fd, guint8 count) {
74 if (0 != ioctl(fd, T_WFM))
81 gboolean tape_setcompression(int fd G_GNUC_UNUSED, gboolean on G_GNUC_UNUSED) {
85 DeviceStatusFlags tape_is_tape_device(int fd) {
86 struct tape_info result;
87 if (0 == ioctl(fd, MT_STATUS, &result)) {
88 return DEVICE_STATUS_SUCCESS;
90 return DEVICE_STATUS_DEVICE_ERROR;
94 DeviceStatusFlags tape_is_ready(int fd G_GNUC_UNUSED, TapeDevice *t_self G_GNUC_UNUSED) {
95 /* We can probably do better. */
96 return DEVICE_STATUS_SUCCESS;
99 void tape_device_detect_capabilities(TapeDevice * t_self) {
100 tape_device_set_capabilities(t_self,
101 TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsf*/
102 FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf*/
103 FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* fsr*/
104 FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsr*/
105 FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* eom*/
106 FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf_after_eom*/
107 2, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT /* final_filemarks*/