aboutsummaryrefslogtreecommitdiff
path: root/libbb/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/loop.c')
-rw-r--r--libbb/loop.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/libbb/loop.c b/libbb/loop.c
index 7dba3e274..4d73dc4cc 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -26,7 +26,40 @@
26#include <unistd.h> 26#include <unistd.h>
27#include <sys/ioctl.h> 27#include <sys/ioctl.h>
28#include "libbb.h" 28#include "libbb.h"
29#include "loop.h" /* Pull in loop device support */ 29
30/* Grumble... The 2.6.x kernel breaks asm/posix_types.h
31 * so we get to try and cope as best we can... */
32#include <linux/version.h>
33#include <asm/posix_types.h>
34#if LINUX_VERSION_CODE >= 132608
35#define __bb_kernel_dev_t __kernel_old_dev_t
36#elif LINUX_VERSION_CODE >= 0x20600
37#define __bb_kernel_dev_t __kernel_dev_t
38#else
39#define __bb_kernel_dev_t unsigned short
40#endif
41
42/* Stuff stolen from linux/loop.h */
43#define LO_NAME_SIZE 64
44#define LO_KEY_SIZE 32
45#define LOOP_SET_FD 0x4C00
46#define LOOP_CLR_FD 0x4C01
47#define LOOP_SET_STATUS 0x4C02
48#define LOOP_GET_STATUS 0x4C03
49struct loop_info {
50 int lo_number;
51 __bb_kernel_dev_t lo_device;
52 unsigned long lo_inode;
53 __bb_kernel_dev_t lo_rdevice;
54 int lo_offset;
55 int lo_encrypt_type;
56 int lo_encrypt_key_size;
57 int lo_flags;
58 char lo_name[LO_NAME_SIZE];
59 unsigned char lo_encrypt_key[LO_KEY_SIZE];
60 unsigned long lo_init[2];
61 char reserved[4];
62};
30 63
31extern int del_loop(const char *device) 64extern int del_loop(const char *device)
32{ 65{