Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*************************************************************************
0003  *
0004  *     enables user programs to display messages and control encryption
0005  *     on s390 tape devices
0006  *
0007  *     Copyright IBM Corp. 2001, 2006
0008  *     Author(s): Michael Holzheu <holzheu@de.ibm.com>
0009  *
0010  *************************************************************************/
0011 
0012 #ifndef _TAPE390_H
0013 #define _TAPE390_H
0014 
0015 #define TAPE390_DISPLAY _IOW('d', 1, struct display_struct)
0016 
0017 /*
0018  * The TAPE390_DISPLAY ioctl calls the Load Display command
0019  * which transfers 17 bytes of data from the channel to the subsystem:
0020  *     - 1 format control byte, and
0021  *     - two 8-byte messages
0022  *
0023  * Format control byte:
0024  *   0-2: New Message Overlay
0025  *     3: Alternate Messages
0026  *     4: Blink Message
0027  *     5: Display Low/High Message
0028  *     6: Reserved
0029  *     7: Automatic Load Request
0030  *
0031  */
0032 
0033 typedef struct display_struct {
0034         char cntrl;
0035         char message1[8];
0036         char message2[8];
0037 } display_struct;
0038 
0039 /*
0040  * Tape encryption support
0041  */
0042 
0043 struct tape390_crypt_info {
0044     char capability;
0045     char status;
0046     char medium_status;
0047 } __attribute__ ((packed));
0048 
0049 
0050 /* Macros for "capable" field */
0051 #define TAPE390_CRYPT_SUPPORTED_MASK 0x01
0052 #define TAPE390_CRYPT_SUPPORTED(x) \
0053     ((x.capability & TAPE390_CRYPT_SUPPORTED_MASK))
0054 
0055 /* Macros for "status" field */
0056 #define TAPE390_CRYPT_ON_MASK 0x01
0057 #define TAPE390_CRYPT_ON(x) (((x.status) & TAPE390_CRYPT_ON_MASK))
0058 
0059 /* Macros for "medium status" field */
0060 #define TAPE390_MEDIUM_LOADED_MASK 0x01
0061 #define TAPE390_MEDIUM_ENCRYPTED_MASK 0x02
0062 #define TAPE390_MEDIUM_ENCRYPTED(x) \
0063     (((x.medium_status) & TAPE390_MEDIUM_ENCRYPTED_MASK))
0064 #define TAPE390_MEDIUM_LOADED(x) \
0065     (((x.medium_status) & TAPE390_MEDIUM_LOADED_MASK))
0066 
0067 /*
0068  * The TAPE390_CRYPT_SET ioctl is used to switch on/off encryption.
0069  * The "encryption_capable" and "tape_status" fields are ignored for this ioctl!
0070  */
0071 #define TAPE390_CRYPT_SET _IOW('d', 2, struct tape390_crypt_info)
0072 
0073 /*
0074  * The TAPE390_CRYPT_QUERY ioctl is used to query the encryption state.
0075  */
0076 #define TAPE390_CRYPT_QUERY _IOR('d', 3, struct tape390_crypt_info)
0077 
0078 /* Values for "kekl1/2_type" and "kekl1/2_type_on_tape" fields */
0079 #define TAPE390_KEKL_TYPE_NONE 0
0080 #define TAPE390_KEKL_TYPE_LABEL 1
0081 #define TAPE390_KEKL_TYPE_HASH 2
0082 
0083 struct tape390_kekl {
0084     unsigned char type;
0085     unsigned char type_on_tape;
0086     char label[65];
0087 } __attribute__ ((packed));
0088 
0089 struct tape390_kekl_pair {
0090     struct tape390_kekl kekl[2];
0091 } __attribute__ ((packed));
0092 
0093 /*
0094  * The TAPE390_KEKL_SET ioctl is used to set Key Encrypting Key labels.
0095  */
0096 #define TAPE390_KEKL_SET _IOW('d', 4, struct tape390_kekl_pair)
0097 
0098 /*
0099  * The TAPE390_KEKL_QUERY ioctl is used to query Key Encrypting Key labels.
0100  */
0101 #define TAPE390_KEKL_QUERY _IOR('d', 5, struct tape390_kekl_pair)
0102 
0103 #endif