loop.h 2.1 KB

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