loop.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _LINUX_LOOP_H
  2. #define _LINUX_LOOP_H
  3. #include <stdint.h>
  4. #define LO_NAME_SIZE 64
  5. #define LO_KEY_SIZE 32
  6. enum {
  7. LO_FLAGS_READ_ONLY = 1,
  8. LO_FLAGS_USE_AOPS = 2,
  9. LO_FLAGS_AUTOCLEAR = 4,
  10. };
  11. struct loop_info {
  12. int lo_number;
  13. long lo_device;
  14. unsigned long lo_inode;
  15. long lo_rdevice;
  16. int lo_offset;
  17. int lo_encrypt_type;
  18. int lo_encrypt_key_size;
  19. int lo_flags;
  20. char lo_name[LO_NAME_SIZE];
  21. unsigned char lo_encrypt_key[LO_KEY_SIZE];
  22. unsigned long lo_init[2];
  23. char reserved[4];
  24. };
  25. struct loop_info64 {
  26. uint64_t lo_device;
  27. uint64_t lo_inode;
  28. uint64_t lo_rdevice;
  29. uint64_t lo_offset;
  30. uint64_t lo_sizelimit;
  31. uint32_t lo_number;
  32. uint32_t lo_encrypt_type;
  33. uint32_t lo_encrypt_key_size;
  34. uint32_t lo_flags;
  35. uint8_t lo_file_name[LO_NAME_SIZE];
  36. uint8_t lo_crypt_name[LO_NAME_SIZE];
  37. uint8_t lo_encrypt_key[LO_KEY_SIZE];
  38. uint64_t lo_init[2];
  39. };
  40. #define LO_CRYPT_NONE 0
  41. #define LO_CRYPT_XOR 1
  42. #define LO_CRYPT_DES 2
  43. #define LO_CRYPT_FISH2 3
  44. #define LO_CRYPT_BLOW 4
  45. #define LO_CRYPT_CAST128 5
  46. #define LO_CRYPT_IDEA 6
  47. #define LO_CRYPT_DUMMY 9
  48. #define LO_CRYPT_SKIPJACK 10
  49. #define LO_CRYPT_CRYPTOAPI 18
  50. #define MAX_LO_CRYPT 20
  51. #define LOOP_SET_FD 0x4C00
  52. #define LOOP_CLR_FD 0x4C01
  53. #define LOOP_SET_STATUS 0x4C02
  54. #define LOOP_GET_STATUS 0x4C03
  55. #define LOOP_SET_STATUS64 0x4C04
  56. #define LOOP_GET_STATUS64 0x4C05
  57. #define LOOP_CHANGE_FD 0x4C06
  58. #define LOOP_SET_CAPACITY 0x4C07
  59. #endif