loop.h 2.5 KB

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