linux_loop.h 2.3 KB

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