[lkml]   [1999]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: /dev/loop0 offset doen't work on /dev/scd0
    From: Andi Kleen <>

Harald Koenig <> writes:

> why isn't it possible to use
> # losetup -o 2048 /dev/loop0 /dev/scd0
> ioctl: LOOP_SET_STATUS: Invalid argument
> without `-o 2048' the loopback works fine (but is useless because I need to skip
> the first sector;). strace shows:
> # strace losetup -o 2048 /dev/loop0 /dev/scd0
> ...
> open("/dev/scd0", O_RDWR) = -1 EROFS (Read-only file system)
> open("/dev/scd0", O_RDONLY) = 3
> open("/dev/loop0", O_RDONLY) = 4
> ioctl(4, LOOP_SET_FD, 0x3) = 0
> ioctl(4, LOOP_SET_STATUS, 0xbffff500) = -1 EINVAL (Invalid argument)
> ioctl(4, LOOP_CLR_FD, 0) = 0
> write(2, "ioctl: LOOP_SET_STATUS: Invalid "..., 41ioctl: LOOP_SET_STATUS: Invalid argument) = 41

My guess is that you have a miscompiled losetup utility. Most losetups
compiled with glibc 2.0 are broken, because glibc changed the size of dev_t
without bothering to supply a linux/loop.h replacement (struct loop_info
contains dev_t). Compiled with a 32bit dev_t you really need set
lo_encrypt_type, and the kernel obviously doesn't know how to deal with
lo_encrypt_type 2048.

Unfortunately there is no easy way to fix losetup without introducing
glibc version dependencies, because glibc offers no public function to convert
its dev_t (from its stat wrapper) into a kernel dev_t.

The current code in util-linux does

#include <linux/posix_types.h>
#define dev_t __kernel_dev_t
#include <linux/loop.h>
#undef dev_t

which is not very elegant but as far as I know works on all systems.

Andries -

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:51    [W:0.067 / U:1.796 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site