summaryrefslogtreecommitdiff
path: root/include/linux/loop.h
diff options
context:
space:
mode:
authorAndries E. Brouwer <andries.brouwer@cwi.nl>2003-04-18 03:18:49 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-04-18 03:18:49 -0700
commitca49321fb6092b9cf73bd76b61a3ebfbbcdf57c9 (patch)
tree13c9fd114825715a64f1a4efb27b3c8d86f19a46 /include/linux/loop.h
parent24ebdc14c92617ab07a7be22946535d4ebb1a841 (diff)
[PATCH] struct loop_info64 with __u64
(i) Replace in struct loop_info the dev_t field by __kernel_old_dev_t, where this type is defined in <asm/posix_types.h>, so that problems with a differently sized dev_t in userspace are avoided. (ii) Introduce a new loop_info64, with __u64 device, inode and offset fields.
Diffstat (limited to 'include/linux/loop.h')
-rw-r--r--include/linux/loop.h71
1 files changed, 37 insertions, 34 deletions
diff --git a/include/linux/loop.h b/include/linux/loop.h
index fe28a0ee8f34..f2e8d775f43a 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -1,8 +1,6 @@
#ifndef _LINUX_LOOP_H
#define _LINUX_LOOP_H
-#include <linux/kdev_t.h>
-
/*
* include/linux/loop.h
*
@@ -74,34 +72,37 @@ typedef int (* transfer_proc_t)(struct loop_device *, int cmd,
#define LO_FLAGS_READ_ONLY 2
#define LO_FLAGS_BH_REMAP 4
-/*
- * Note that this structure gets the wrong offsets when directly used
- * from a glibc program, because glibc has a 32bit dev_t.
- * Prevent people from shooting in their own foot.
- */
-#if __GLIBC__ >= 2 && !defined(dev_t)
-#error "Wrong dev_t in loop.h"
-#endif
-
-/*
- * This uses kdev_t because glibc currently has no appropiate
- * conversion version for the loop ioctls.
- * The situation is very unpleasant
- */
+#include <asm/posix_types.h> /* for __kernel_old_dev_t */
+#include <asm/types.h> /* for __u64 */
+/* Backwards compatibility version */
struct loop_info {
- int lo_number; /* ioctl r/o */
- dev_t lo_device; /* ioctl r/o */
- unsigned long lo_inode; /* ioctl r/o */
- dev_t lo_rdevice; /* ioctl r/o */
- int lo_offset;
- int lo_encrypt_type;
- int lo_encrypt_key_size; /* ioctl w/o */
- int lo_flags; /* ioctl r/o */
- char lo_name[LO_NAME_SIZE];
- unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
- unsigned long lo_init[2];
- char reserved[4];
+ int lo_number; /* ioctl r/o */
+ __kernel_old_dev_t lo_device; /* ioctl r/o */
+ unsigned long lo_inode; /* ioctl r/o */
+ __kernel_old_dev_t lo_rdevice; /* ioctl r/o */
+ int lo_offset;
+ int lo_encrypt_type;
+ int lo_encrypt_key_size; /* ioctl w/o */
+ int lo_flags; /* ioctl r/o */
+ char lo_name[LO_NAME_SIZE];
+ unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
+ unsigned long lo_init[2];
+ char reserved[4];
+};
+
+struct loop_info64 {
+ __u64 lo_device; /* ioctl r/o */
+ __u64 lo_inode; /* ioctl r/o */
+ __u64 lo_rdevice; /* ioctl r/o */
+ __u64 lo_offset;
+ __u32 lo_number; /* ioctl r/o */
+ __u32 lo_encrypt_type;
+ __u32 lo_encrypt_key_size; /* ioctl w/o */
+ __u32 lo_flags; /* ioctl r/o */
+ __u8 lo_name[LO_NAME_SIZE];
+ __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
+ __u64 lo_init[2];
};
/*
@@ -125,7 +126,7 @@ struct loop_func_table {
int number; /* filter type */
int (*transfer)(struct loop_device *lo, int cmd, char *raw_buf,
char *loop_buf, int size, sector_t real_block);
- int (*init)(struct loop_device *, struct loop_info *);
+ int (*init)(struct loop_device *, const struct loop_info64 *);
/* release is called from loop_unregister_transfer or clr_fd */
int (*release)(struct loop_device *);
int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
@@ -134,7 +135,7 @@ struct loop_func_table {
void (*unlock)(struct loop_device *);
};
-int loop_register_transfer(struct loop_func_table *funcs);
+int loop_register_transfer(struct loop_func_table *funcs);
int loop_unregister_transfer(int number);
#endif
@@ -142,9 +143,11 @@ int loop_unregister_transfer(int number);
* IOCTL commands --- we will commandeer 0x4C ('L')
*/
-#define LOOP_SET_FD 0x4C00
-#define LOOP_CLR_FD 0x4C01
-#define LOOP_SET_STATUS 0x4C02
-#define LOOP_GET_STATUS 0x4C03
+#define LOOP_SET_FD 0x4C00
+#define LOOP_CLR_FD 0x4C01
+#define LOOP_SET_STATUS 0x4C02
+#define LOOP_GET_STATUS 0x4C03
+#define LOOP_SET_STATUS64 0x4C04
+#define LOOP_GET_STATUS64 0x4C05
#endif