X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device-src%2Ftape-aix.c;h=59c5946b27ada2e9b59b1ff75f605772b8efd662;hb=f62188753ffc49e6b684b288dd9394f71b1e776c;hp=a9665a74f5982c4680681b53bb327e5bd8420fbd;hpb=6ba576375c19b829b2a13dbe6562eedd2716b9ea;p=debian%2Famanda diff --git a/device-src/tape-aix.c b/device-src/tape-aix.c index a9665a7..59c5946 100644 --- a/device-src/tape-aix.c +++ b/device-src/tape-aix.c @@ -1,24 +1,25 @@ /* - * Copyright (c) 2005 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 - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but + * Copyright (c) 2007, 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * 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 + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com */ #include +#include "glib-util.h" #include "tape-ops.h" /* Tape operations for AIX systems. Most of this stuff is based on @@ -38,6 +39,7 @@ #define STFSR MTFSR #define STRSR MTBSR #define STWEOF MTWEOF +#define STOFFL MTOFFL --- */ gboolean tape_rewind(int fd) { @@ -75,7 +77,11 @@ gboolean tape_bsr(int fd, guint count) { return 0 == ioctl(fd, STIOCTOP, &st); } -gint tape_eod(int fd) { +gint tape_fileno(int fd) { + return TAPE_POSITION_UNKNOWN; +} + +gint tape_eod(int fd G_GNUC_UNUSED) { g_assert_not_reached(); return TAPE_OP_ERROR; } @@ -87,55 +93,35 @@ gboolean tape_weof(int fd, guint8 count) { return 0 == ioctl(fd, STIOCTOP, &st); } -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) { - /* AIX doesn't have a no-op. */ - return READ_LABEL_STATUS_SUCCESS; +gboolean tape_offl(int fd) { + struct stop st; + st.st_op = STOFFL; + st.st_count = 1; + return 0 == ioctl(fd, STIOCTOP, &st); +} + +DeviceStatusFlags tape_is_tape_device(int fd G_GNUC_UNUSED) { + /* AIX doesn't have a no-op, so we'll just assume this is a tape device */ + return DEVICE_STATUS_SUCCESS; } -TapeCheckResult tape_is_ready(int fd) { - return TAPE_CHECK_UNKNOWN; +DeviceStatusFlags tape_is_ready(int fd G_GNUC_UNUSED, TapeDevice *t_self G_GNUC_UNUSED) { + 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_ENABLED | FEATURE_SURETY_BAD | - FEATURE_SOURCE_DEFAULT); - device_property_set(self, PROPERTY_BSF, &val); - - g_value_set_flags(&val, - FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD | - FEATURE_SOURCE_DEFAULT); - device_property_set(self, PROPERTY_FSR, &val); - - g_value_set_flags(&val, - FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD | - 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*/ + DEFAULT_FSF_AFTER_FILEMARK, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsf_after_filemark*/ + TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* bsf*/ + TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsr*/ + TRUE, PROPERTY_SURETY_BAD, 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*/ + ); }