patch-2.3.10 linux/drivers/block/loop.c
Next file: linux/drivers/block/nbd.c
Previous file: linux/drivers/block/ll_rw_blk.c
Back to the patch index
Back to the overall index
- Lines: 52
- Date:
Mon Jul 5 20:15:24 1999
- Orig file:
v2.3.9/linux/drivers/block/loop.c
- Orig date:
Sun May 30 10:17:43 1999
diff -u --recursive --new-file v2.3.9/linux/drivers/block/loop.c linux/drivers/block/loop.c
@@ -27,7 +27,13 @@
* - Should use an own CAP_* category instead of CAP_SYS_ADMIN
* - Should use the underlying filesystems/devices read function if possible
* to support read ahead (and for write)
- */
+ *
+ * WARNING/FIXME:
+ * - The block number as IV passing to low level transfer functions is broken:
+ * it passes the underlying device's block number instead of the
+ * offset. This makes it change for a given block when the file is
+ * moved/restored/copied and also doesn't work over NFS.
+ */
#include <linux/module.h>
@@ -107,7 +113,7 @@
static int xor_status(struct loop_device *lo, struct loop_info *info)
{
- if (info->lo_encrypt_key_size < 0)
+ if (info->lo_encrypt_key_size <= 0)
return -EINVAL;
return 0;
}
@@ -369,6 +375,10 @@
a file structure */
lo->lo_backing_file = NULL;
} else if (S_ISREG(inode->i_mode)) {
+ if (!inode->i_op->bmap) {
+ printk(KERN_ERR "loop: device has no block access/not implemented\n");
+ goto out_putf;
+ }
/* Backed by a regular file - we need to hold onto
a file structure for this file. We'll use it to
@@ -391,6 +401,7 @@
lo->lo_backing_file->f_dentry = file->f_dentry;
lo->lo_backing_file->f_op = file->f_op;
lo->lo_backing_file->private_data = file->private_data;
+ file_moveto(lo->lo_backing_file, file);
error = get_write_access(inode);
if (error) {
@@ -504,8 +515,6 @@
if ((unsigned int) info.lo_encrypt_key_size > LO_KEY_SIZE)
return -EINVAL;
type = info.lo_encrypt_type;
- if (info.lo_encrypt_key_size == 0 && type == LO_CRYPT_XOR)
- return -EINVAL;
if (type >= MAX_LO_CRYPT || xfer_funcs[type] == NULL)
return -EINVAL;
err = loop_release_xfer(lo);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)