1*607ca46eSDavid Howells /* 2*607ca46eSDavid Howells * include/linux/loop.h 3*607ca46eSDavid Howells * 4*607ca46eSDavid Howells * Written by Theodore Ts'o, 3/29/93. 5*607ca46eSDavid Howells * 6*607ca46eSDavid Howells * Copyright 1993 by Theodore Ts'o. Redistribution of this file is 7*607ca46eSDavid Howells * permitted under the GNU General Public License. 8*607ca46eSDavid Howells */ 9*607ca46eSDavid Howells #ifndef _UAPI_LINUX_LOOP_H 10*607ca46eSDavid Howells #define _UAPI_LINUX_LOOP_H 11*607ca46eSDavid Howells 12*607ca46eSDavid Howells 13*607ca46eSDavid Howells #define LO_NAME_SIZE 64 14*607ca46eSDavid Howells #define LO_KEY_SIZE 32 15*607ca46eSDavid Howells 16*607ca46eSDavid Howells 17*607ca46eSDavid Howells /* 18*607ca46eSDavid Howells * Loop flags 19*607ca46eSDavid Howells */ 20*607ca46eSDavid Howells enum { 21*607ca46eSDavid Howells LO_FLAGS_READ_ONLY = 1, 22*607ca46eSDavid Howells LO_FLAGS_AUTOCLEAR = 4, 23*607ca46eSDavid Howells LO_FLAGS_PARTSCAN = 8, 24*607ca46eSDavid Howells }; 25*607ca46eSDavid Howells 26*607ca46eSDavid Howells #include <asm/posix_types.h> /* for __kernel_old_dev_t */ 27*607ca46eSDavid Howells #include <linux/types.h> /* for __u64 */ 28*607ca46eSDavid Howells 29*607ca46eSDavid Howells /* Backwards compatibility version */ 30*607ca46eSDavid Howells struct loop_info { 31*607ca46eSDavid Howells int lo_number; /* ioctl r/o */ 32*607ca46eSDavid Howells __kernel_old_dev_t lo_device; /* ioctl r/o */ 33*607ca46eSDavid Howells unsigned long lo_inode; /* ioctl r/o */ 34*607ca46eSDavid Howells __kernel_old_dev_t lo_rdevice; /* ioctl r/o */ 35*607ca46eSDavid Howells int lo_offset; 36*607ca46eSDavid Howells int lo_encrypt_type; 37*607ca46eSDavid Howells int lo_encrypt_key_size; /* ioctl w/o */ 38*607ca46eSDavid Howells int lo_flags; /* ioctl r/o */ 39*607ca46eSDavid Howells char lo_name[LO_NAME_SIZE]; 40*607ca46eSDavid Howells unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ 41*607ca46eSDavid Howells unsigned long lo_init[2]; 42*607ca46eSDavid Howells char reserved[4]; 43*607ca46eSDavid Howells }; 44*607ca46eSDavid Howells 45*607ca46eSDavid Howells struct loop_info64 { 46*607ca46eSDavid Howells __u64 lo_device; /* ioctl r/o */ 47*607ca46eSDavid Howells __u64 lo_inode; /* ioctl r/o */ 48*607ca46eSDavid Howells __u64 lo_rdevice; /* ioctl r/o */ 49*607ca46eSDavid Howells __u64 lo_offset; 50*607ca46eSDavid Howells __u64 lo_sizelimit;/* bytes, 0 == max available */ 51*607ca46eSDavid Howells __u32 lo_number; /* ioctl r/o */ 52*607ca46eSDavid Howells __u32 lo_encrypt_type; 53*607ca46eSDavid Howells __u32 lo_encrypt_key_size; /* ioctl w/o */ 54*607ca46eSDavid Howells __u32 lo_flags; /* ioctl r/o */ 55*607ca46eSDavid Howells __u8 lo_file_name[LO_NAME_SIZE]; 56*607ca46eSDavid Howells __u8 lo_crypt_name[LO_NAME_SIZE]; 57*607ca46eSDavid Howells __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ 58*607ca46eSDavid Howells __u64 lo_init[2]; 59*607ca46eSDavid Howells }; 60*607ca46eSDavid Howells 61*607ca46eSDavid Howells /* 62*607ca46eSDavid Howells * Loop filter types 63*607ca46eSDavid Howells */ 64*607ca46eSDavid Howells 65*607ca46eSDavid Howells #define LO_CRYPT_NONE 0 66*607ca46eSDavid Howells #define LO_CRYPT_XOR 1 67*607ca46eSDavid Howells #define LO_CRYPT_DES 2 68*607ca46eSDavid Howells #define LO_CRYPT_FISH2 3 /* Twofish encryption */ 69*607ca46eSDavid Howells #define LO_CRYPT_BLOW 4 70*607ca46eSDavid Howells #define LO_CRYPT_CAST128 5 71*607ca46eSDavid Howells #define LO_CRYPT_IDEA 6 72*607ca46eSDavid Howells #define LO_CRYPT_DUMMY 9 73*607ca46eSDavid Howells #define LO_CRYPT_SKIPJACK 10 74*607ca46eSDavid Howells #define LO_CRYPT_CRYPTOAPI 18 75*607ca46eSDavid Howells #define MAX_LO_CRYPT 20 76*607ca46eSDavid Howells 77*607ca46eSDavid Howells /* 78*607ca46eSDavid Howells * IOCTL commands --- we will commandeer 0x4C ('L') 79*607ca46eSDavid Howells */ 80*607ca46eSDavid Howells 81*607ca46eSDavid Howells #define LOOP_SET_FD 0x4C00 82*607ca46eSDavid Howells #define LOOP_CLR_FD 0x4C01 83*607ca46eSDavid Howells #define LOOP_SET_STATUS 0x4C02 84*607ca46eSDavid Howells #define LOOP_GET_STATUS 0x4C03 85*607ca46eSDavid Howells #define LOOP_SET_STATUS64 0x4C04 86*607ca46eSDavid Howells #define LOOP_GET_STATUS64 0x4C05 87*607ca46eSDavid Howells #define LOOP_CHANGE_FD 0x4C06 88*607ca46eSDavid Howells #define LOOP_SET_CAPACITY 0x4C07 89*607ca46eSDavid Howells 90*607ca46eSDavid Howells /* /dev/loop-control interface */ 91*607ca46eSDavid Howells #define LOOP_CTL_ADD 0x4C80 92*607ca46eSDavid Howells #define LOOP_CTL_REMOVE 0x4C81 93*607ca46eSDavid Howells #define LOOP_CTL_GET_FREE 0x4C82 94*607ca46eSDavid Howells #endif /* _UAPI_LINUX_LOOP_H */ 95