Re: fs/read_write.c : default_llseek() with /dev/hda

Peter T. Breuer (ptb@it.uc3m.es)
Mon, 13 Dec 1999 19:13:16 +0100 (MET)


"A month of sundays ago imel... wrote:"
>
>
>
> that maybe an explanation to why nbd-server fail to find
> out the size of a block device.
> the other methods fail on me too. so is there a method to
> get size of a block device?

The nbd-server ought to use an ioctl on the block device. The driver
ought to cooperate by returning the size ... this is what the server
used to do in my copy ..

if (!size) {
off_t es = 0;
DEBUG("looking for export size with ioctl BLKGETSIZE\n");
if( ! ioctl(fd, BLKGETSIZE, &es) && es != 0) {
es *= 512; /* assume blocksize 512 */
size = es;
}
}
size = ( size / blksize ) * blksize;

and the driver did ..

case BLKGETSIZE:
/* PTB return nr sectors */
#if LINUX_VERSION_CODE > LINUX_VERSION_2_1_0
err = put_user ((unsigned long) (lo->size << 1), (unsigned long *)arg);
if (err < 0)
return -EINVAL;
#else ...

Has that changed?

Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/