Well I got 2 messages from people with same question:
did ya make /dev/md0?

Well.. I did 8-(

#ls -l /dev/md0
crw-rw---- 1  root disk  9,  0 Jul 21 1998 /dev/md0

#lsmod
Module          Size    Used  By
raid1           6304    0     (unused)

#uname -a
Linux ha1 2.2.6 #1 Tue Jun 1 10:53:09 CEST 1999 i486 unknown

#cat /etc/raidtab
        raid-level              1
        nr-raid-disks           2
        chunk-size              4 (also had 32(this isn't in the text))
        device                  /dev/sda2
        raid-disk               0
        device                  /dev/sdb2
        raid-disk               1
#

As I read some material about kernel modules.. I know that if a device is used
and the major number isn't registered by a module or in the kernel, the kernel
return a error wich can be interpreted as: /dev/<dev>: Invalid argument

So... is this a module problem?
note:
#cat /proc/devices
....
Block devices:
  2 fd
  3 ide0
  8 sd
  9 md
#
So it IS registered... does this mean that the module doesn't accept the
request..? I don't think so.. but..

Let's look at the request:
<somewhere in mkraid.c(function makeOneRaid() at line 45 of 310 (added some
comment)>
...
file = open(cfg->md_name, O_RDONLY);
ret = ioctl(file, SET_ARRAY_INFO, (unsigned long)&cfg->array.param);
...
ret is -1.. and then the program returns with -1 and goes to abort
at the time of the 'crash' strerror(errno); contains:
Invalid argument
that comes from ioctl()... maybe the file didn't open.. let's see..
it did... file contains 4..
then maybe the part unsigned... is wrong..
well.. the var. must be unsigned long, so that's correct..Now.. whats in
&cfg->array.param..
printf("%ld", (unsigned long)&cfg->array.param);
it contains: 134544560
and unsigned long may go to 2^32 (4294967296) so that's ok..
And now.. only one left: SET_ARRAY_INFO..
it's defined as:
#define SET_ARRAY_INFO  _IOW (MD_MAJOR, 0x32, md_array_info_t)
well this is gonna be nice.. real programming!!
lets 'compile' the define:
_IOW (9, 0x32, <config_info>)
_IOW = _IOC (1U, 9, 0x32, sizeof(md_array_info_t)
_IOC (1, 9, 0x32, 72)
and finaly:
_IOC = (((1) << 30) | ((9) << 8) | ((0x32) << 0) | ((72) << 16 ))
so _IOC = 1078462770
And SET_ARRAY_INFO gave me 1078462755.. hmmm did something wrong I think..
But however.. the various request for ioctl (wich SET_ARRAY_INFO is) are in
the for 0x0000 to 0xFFFF so maximal 65535.. so SET_ARRAY_INFO is way out of
line.. I guess..

Could the developper of this nice part of code please explain this ioctl call
to me??
As I cannot find out the request I cannot see the meaning of the call..

Well if your still reading.. Good work!! your a real hacker!!

Hope somone make it this far...
Greetz
Wimpie

Reply via email to