aboutsummaryrefslogtreecommitdiff
path: root/libbb/loop.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-02-06 07:16:36 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-02-06 07:16:36 +0000
commitabfa1e3b269161d6a6791d6ed2c3655d720997f8 (patch)
tree8fb031797cc9e0c0a7c54ba7ef27e0948feab913 /libbb/loop.c
parent5372949efbd19abeba1de0bb3ce84d7c59155cfb (diff)
downloadbusybox-w32-abfa1e3b269161d6a6791d6ed2c3655d720997f8.tar.gz
busybox-w32-abfa1e3b269161d6a6791d6ed2c3655d720997f8.tar.bz2
busybox-w32-abfa1e3b269161d6a6791d6ed2c3655d720997f8.zip
Make the loop support stuff be much less evil, and make it cope
with 2.6.x asm/posix_types.h, which has done singularly evil thing by yanking __kernel_dev_t and renaming it. The loop interface was really poorly designed in the first place. The new 64 bit loop interface looks to be somewhat less horrible, too bad it is only present in 2.6.x kernels. -Erik git-svn-id: svn://busybox.net/trunk/busybox@8418 69ca8d6d-28ef-0310-b511-8ec308f3f277
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{