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
22 #include "glib-util.h"
25 /* Tape operations for AIX systems. Most of this stuff is based on
27 http://publibn.boulder.ibm.com/doc_link/Ja_JP/a_doc_lib/files/aixfiles/rmt.htm */
29 /* Uncomment to test compilation on non-AIX systems. */
35 #define st_count mt_count
44 gboolean tape_rewind(int fd) {
48 return 0 == ioctl(fd, STIOCTOP, &st);
51 gboolean tape_fsf(int fd, guint count) {
55 return 0 == ioctl(fd, STIOCTOP, &st);
58 gboolean tape_bsf(int fd, guint count) {
62 return 0 == ioctl(fd, STIOCTOP, &st);
65 gboolean tape_fsr(int fd, guint count) {
69 return 0 == ioctl(fd, STIOCTOP, &st);
72 gboolean tape_bsr(int fd, guint count) {
76 return 0 == ioctl(fd, STIOCTOP, &st);
79 gint tape_eod(int fd G_GNUC_UNUSED) {
80 g_assert_not_reached();
84 gboolean tape_weof(int fd, guint8 count) {
88 return 0 == ioctl(fd, STIOCTOP, &st);
91 gboolean tape_setcompression(int fd G_GNUC_UNUSED, gboolean on G_GNUC_UNUSED) {
95 DeviceStatusFlags tape_is_tape_device(int fd G_GNUC_UNUSED) {
96 /* AIX doesn't have a no-op, so we'll just assume this is a tape device */
97 return DEVICE_STATUS_SUCCESS;
100 DeviceStatusFlags tape_is_ready(int fd G_GNUC_UNUSED, TapeDevice *t_self G_GNUC_UNUSED) {
101 return DEVICE_STATUS_SUCCESS;
104 void tape_device_detect_capabilities(TapeDevice * t_self) {
105 tape_device_set_capabilities(t_self,
106 TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsf*/
107 TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* bsf*/
108 TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsr*/
109 TRUE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* bsr*/
110 FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* eom*/
111 FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf_after_eom*/
112 2, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT /* final_filemarks*/