Skip to content
Snippets Groups Projects
Commit b7549061 authored by Wang Di's avatar Wang Di
Browse files

add loop_device_get_info.patch in snapfs series

parent f907e2f2
No related branches found
No related tags found
No related merge requests found
Index: linux-2.4.20-8/drivers/block/loop.c
===================================================================
--- linux-2.4.20-8.orig/drivers/block/loop.c 2002-11-29 07:53:12.000000000 +0800
+++ linux-2.4.20-8/drivers/block/loop.c 2004-01-10 00:02:33.000000000 +0800
@@ -843,6 +843,31 @@
}
return copy_to_user(arg, &info, sizeof(info)) ? -EFAULT : 0;
}
+static int loop_get_info(struct loop_device *lo, struct loop_info *arg)
+{
+ struct loop_info info;
+ struct file *file = lo->lo_backing_file;
+
+ if (lo->lo_state != Lo_bound)
+ return -ENXIO;
+ if (!arg)
+ return -EINVAL;
+ memset(&info, 0, sizeof(info));
+ info.lo_number = lo->lo_number;
+ info.lo_device = kdev_t_to_nr(file->f_dentry->d_inode->i_dev);
+ info.lo_inode = file->f_dentry->d_inode->i_ino;
+ info.lo_rdevice = kdev_t_to_nr(lo->lo_device);
+ info.lo_offset = lo->lo_offset;
+ info.lo_flags = lo->lo_flags;
+ strncpy(info.lo_name, lo->lo_name, LO_NAME_SIZE);
+ info.lo_encrypt_type = lo->lo_encrypt_type;
+ if (lo->lo_encrypt_key_size && capable(CAP_SYS_ADMIN)) {
+ info.lo_encrypt_key_size = lo->lo_encrypt_key_size;
+ memcpy(info.lo_encrypt_key, lo->lo_encrypt_key,
+ lo->lo_encrypt_key_size);
+ }
+ return memcpy(arg, &info, sizeof(info)) ? -EFAULT : 0;
+}
static int lo_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg)
@@ -875,6 +900,9 @@
case LOOP_GET_STATUS:
err = loop_get_status(lo, (struct loop_info *) arg);
break;
+ case LOOP_GET_INFO:
+ err = loop_get_info(lo, (struct loop_info *) arg);
+ break;
case BLKGETSIZE:
if (lo->lo_state != Lo_bound) {
err = -ENXIO;
Index: linux-2.4.20-8/include/linux/loop.h
===================================================================
--- linux-2.4.20-8.orig/include/linux/loop.h 2001-09-18 04:16:30.000000000 +0800
+++ linux-2.4.20-8/include/linux/loop.h 2004-01-09 23:50:17.000000000 +0800
@@ -151,5 +151,6 @@
#define LOOP_CLR_FD 0x4C01
#define LOOP_SET_STATUS 0x4C02
#define LOOP_GET_STATUS 0x4C03
+#define LOOP_GET_INFO 0x4C04
#endif
......@@ -49,4 +49,5 @@ ext3-trusted_ea-2.4.20.patch
kernel_text_address-2.4.20-vanilla.patch
ext3-xattr-ptr-arith-fix.patch
gfp_memalloc-2.4.22.patch
loop_device_get_info.patch
snapfs_core-2.4.20.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment