X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device-src%2Ftape-xenix.c;h=0d654433185e520ca8936d21b7fcf41545bfc9b2;hb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;hp=1890cd20de66e3109463fd0186f567fd4ca53274;hpb=fb2bd066c2f8b34addafe48d62550e3033a59431;p=debian%2Famanda diff --git a/device-src/tape-xenix.c b/device-src/tape-xenix.c index 1890cd2..0d65443 100644 --- a/device-src/tape-xenix.c +++ b/device-src/tape-xenix.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005 Zmanda, Inc. All Rights Reserved. + * Copyright (c) 2005-2008 Zmanda Inc. All Rights Reserved. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 2.1 as @@ -14,8 +14,8 @@ * along with this library; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120 - * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com + * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300 + * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com */ /* Tape operations for XENIX systems. Most of this stuff is based on @@ -25,6 +25,7 @@ #include #include +#include "glib-util.h" /* Uncomment to test compilation on non-XENIX systems. */ /* --- @@ -41,35 +42,35 @@ gboolean tape_rewind(int fd) { } gboolean tape_fsf(int fd, guint count) { - while (--count >= 0) { + while (count-- > 0) { if (0 != ioctl(fd, T_RFM)) return FALSE; } return TRUE; } -gboolean tape_bsf(int fd, guint count) { +gboolean tape_bsf(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) { g_assert_not_reached(); return FALSE; } -gboolean tape_fsr(int fd, guint count) { +gboolean tape_fsr(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) { g_assert_not_reached(); return FALSE; } -gboolean tape_bsr(int fd, guint count) { +gboolean tape_bsr(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) { g_assert_not_reached(); return FALSE; } -gint tape_eod(int fd) { +gint tape_eod(int fd G_GNUC_UNUSED) { g_assert_not_reached(); return TAPE_OP_ERROR; } gboolean tape_weof(int fd, guint8 count) { - while (count -- > 0) { + while (count-- > 0) { if (0 != ioctl(fd, T_WFM)) return FALSE; } @@ -77,62 +78,32 @@ gboolean tape_weof(int fd, guint8 count) { return TRUE; } -gboolean tape_setcompression(int fd, gboolean on) { +gboolean tape_setcompression(int fd G_GNUC_UNUSED, gboolean on G_GNUC_UNUSED) { return FALSE; } -ReadLabelStatusFlags tape_is_tape_device(int fd) { +DeviceStatusFlags tape_is_tape_device(int fd) { struct tape_info result; if (0 == ioctl(fd, MT_STATUS, &result)) { - return READ_LABEL_STATUS_SUCCESS; + return DEVICE_STATUS_SUCCESS; } else { - dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s", - strerror(errno)); - return READ_LABEL_STATUS_DEVICE_ERROR; + return DEVICE_STATUS_DEVICE_ERROR; } } -TapeCheckResult tape_is_ready(int fd) { +DeviceStatusFlags tape_is_ready(int fd G_GNUC_UNUSED, TapeDevice *t_self G_GNUC_UNUSED) { /* We can probably do better. */ - return TAPE_CHECK_UNKNOWN; + return DEVICE_STATUS_SUCCESS; } -void tape_device_discover_capabilities(TapeDevice * t_self) { - Device * self; - GValue val; - - self = DEVICE(t_self); - g_return_if_fail(self != NULL); - - bzero(&val, sizeof(val)); - g_value_init(&val, FEATURE_SUPPORT_FLAGS_TYPE); - - g_value_set_flags(&val, - FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD | - FEATURE_SOURCE_DEFAULT); - device_property_set(self, PROPERTY_FSF, &val); - - g_value_set_flags(&val, - FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD | - FEATURE_SOURCE_DEFAULT); - device_property_set(self, PROPERTY_BSF, &val); - - g_value_set_flags(&val, - FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD | - FEATURE_SOURCE_DEFAULT); - device_property_set(self, PROPERTY_FSR, &val); - - g_value_set_flags(&val, - FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD | - FEATURE_SOURCE_DEFAULT); - device_property_set(self, PROPERTY_BSR, &val); - - g_value_set_flags(&val, - FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD | - FEATURE_SOURCE_DEFAULT); - device_property_set(self, PROPERTY_EOM, &val); - - g_value_unset_init(&val, G_TYPE_UINT); - g_value_set_uint(&val, 2); - device_property_set(self, PROPERTY_FINAL_FILEMARKS, &val); +void tape_device_detect_capabilities(TapeDevice * t_self) { + tape_device_set_capabilities(t_self, + TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsf*/ + FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf*/ + FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* fsr*/ + FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsr*/ + FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* eom*/ + FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf_after_eom*/ + 2, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT /* final_filemarks*/ + ); }