static int get_geometry(kdev_t dev, struct hd_geometry *hdg)
{
int old_fs = get_fs();
struct file_operations *fops = (struct file_operations *)
get_blkfops(MAJOR(dev));
struct inode dummy_i;
struct inode_operations dummy_iop;
static struct file dummy_f;
int result
dummy_i.i_rdev = dev;
dummy_f.f_inode = &dummy_i;
dummy_f.f_op = dummy_iop.default_file_ops = fops;
dummy_i.i_op = &dummy_iop;
set_fs(get_ds());
if (fops && fops->ioctl)
result = fops->ioctl(&dummy_i, &dummy_f, HDIO_GETGEO,
(unsigned long) hdg);
else
result = -EINVAL;
set_fs(old_fs);
return result;
}
Haven't tested the code, though...
Cheers,
Kris
-- Krzysztof G. Baranowski - President of the Harmless Manyacs' Club "Smith & Wesson - The original point and click interface..." http://www.knm.org.pl/ <prezes@manjak.knm.org.pl>
- 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/