The loop device

Andries.Brouwer@cwi.nl
Fri, 23 Feb 1996 02:55:21 +0100


Since 1.3.68 (the first kernel version since a long time that
does TCP/IP and SLIP for me - progress!) Ted's loop device is
part of the standard kernel.

I put a version of mount on ftp.win.tue.nl:/pub/linux/util/mount-2.5b.tar.gz
that can handle mounting something over the loop device. For example,
mount -t lo@/dev/loop3 fdimage /mnt -o vfs=msdos:blocksize=1024
will attach the device /dev/loop3 to the file fdimage, and then
mount it as a msdos file system, with blocksize 1024.
(No doubt this syntax should be changed, and the loop device should be
invoked implicitly whenever an ordinary file is mounted, or an
encryption option is given. Later.)
(This mount source is a fragment of util-linux-2.5+, but will
compile if one removes the "include ../MCONFIG" from the Makefile.)

People playing with this will no doubt also want lo.3.5c.tar.gz
(or lo.3.5b.tar.gz), found at your favourite archive site,
in order to have losetup as a separate program, and to try
encryption (I never did that).

Note that the present loop device uses the same buffersize as the
underlying file system - this means that not all combinations are
possible, and that explicit "blocksize=" mount options may be required.

Comments and complaints are welcome - cc them to me (aeb@cwi.nl),
I do not subscribe to this list.

Linus, in case you read this - a compiler warning is fixed by
==========
--- linux-1.3.68/linux/include/linux/blk.h Thu Feb 22 21:07:20 1996
+++ linux-1.3.68a/linux/include/linux/blk.h Thu Feb 22 22:03:43 1996
@@ -72,6 +72,9 @@
#ifdef CONFIG_BLK_DEV_XD
extern int xd_init(void);
#endif
+#ifdef CONFIG_BLK_DEV_LOOP
+extern int loop_init(void);
+#endif

extern void set_device_ro(kdev_t dev,int flag);
void add_blkdev_randomness(int major);
==========

There were already all kinds of reasons why the /proc/mounts as
we have at present is not a satisfactory replacement for /etc/mtab.
For example, mtab has more information on nfs mounts.
The loop device is one more case where mtab contains more info.