PREV UP NEXT The Ftape Installation and Usage Guide - Ioctls


8.8.2: MTIOCGET, query the tape drive status

Please read also the man page of the mt program (`mt 1 ftmt')(1). The following is from the standard Linux include file [/usr/src/linux/]include/linux/mtio.h:

/* structure for MTIOCGET - mag tape get status command */

struct  mtget {
        long    mt_type;        /* type of magtape device */
        long    mt_resid;       /* residual count: (not sure)
                                 *      number of bytes ignored, or
                                 *      number of files not skipped, or
                                 *      number of records not skipped.
                                 */
        /* the following registers are device dependent */
        long    mt_dsreg;       /* status register */
        long    mt_gstat;       /* generic (device independent) status */
        long    mt_erreg;       /* error register */
        /* The next two fields are not always used */
        __kernel_daddr_t mt_fileno;     /* number of current file on tape */
        __kernel_daddr_t mt_blkno;      /* current block number */
};

The fields mt_dsreg and mt_erreg were unused by ftape-2.x and sftape whereas ftape-3.04d (and later versions) uses them to store the last queried hardware tape drive status and error code. ftape defines for this purpose the following two unions in [/usr/src/ftape-4.05/]include/linux/ftape.h. The meaning should be quite clear. The components contain the bits returned by the respective QIC report commands (refer to the QIC-117 standard, QIC organisations home page).

/* the following two may be reported when MTIOCGET is requested ... */
typedef union {
        struct {
                __u8 error;
                __u8 command;
        } error;
        long space;
} ft_drive_error;

typedef union {
        struct {
                __u8 drive_status;
                __u8 drive_config;
                __u8 tape_status;
        } status;
        long space;
} ft_drive_status;


(1) You can download it as part of the ftape-tools package from the
Ftape home page
or from ftp://sunsite.unc.edu/pub/Linux/kernel/tapes/


ftape logo Use these buttons to jump to the top menu

TOP (previous node) TOP (parent node) TOP (next node) TOP (this node)