sizeof(dev_t) between lomount.c and loop.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, everyone, I have a problem when I use the loop
device. I compiled and built the loop.o and losetup.o.
Then I used the insmod loop.o to load the loop.o into
the kernel. Up to now everything is OK. Then I used
the following command to connect the loop0 with the
floppy disk device.

losetup -e xor /dev/loop0 /dev/fd0

It succeeded. Then I used "mke2fs /dev/loop0" and
"mount /dev/loop0 /floppy" to format and mount the
loop device. Then I copied some files to the loop
device. But I found that the data on the floppy was
never encrypted. After tracing the code I found that
the loop.o always called the transfer_none() function.
That means that it doesn't use the transfer_xor(). 

At last I found the exact reason. Both losetup and
loop use the loop.h header file. In this header file
there is a struct loop_info which contains 2
parameters, dev_t	loop_device and dev_t loop_rdevice.
I print the size of this structure and the size of the
dev_t variable type both is losetup and loop. The
following is the output.
In losetup:
The sizeof(struct loop_info) is 148.
The sizeof(dev_t) is 8.

In loop:
The sizeof(struct loop_info) is 136.
The sizeof(dev_t) is 2.

You see that means that the definition of dev_t in
losetup and loop is different. So I couldn't get the
correct result. I know that losetup runs in user space
while loop runs in kernel space. Is that the reason of
this? After I omitted these two parameters in the
loop_info structure, then everything is OK.

What is the problem? Thanks in advance.

Michael


______________________________________________________________________ 
Web-hosting solutions for home and business! http://website.yahoo.ca
-
Linux-crypto:  cryptography in and on the Linux system
Archive:       http://mail.nl.linux.org/linux-crypto/



[Index of Archives]     [Kernel]     [Linux Crypto]     [Gnu Crypto]     [Gnu Classpath]     [Netfilter]     [Bugtraq]
  Powered by Linux