/* Description: Reads the first sector from the device and returns %0x42 bytes starting at offset %0x1be. Returns: partition table in kmalloc(GFP_KERNEL) memory, or NULL on error.  */
unsigned char* scsi_bios_ptable(struct block_device *dev)
/* Description: Reads the first sector from the device and returns %0x42 bytes starting at offset %0x1be. Returns: partition table in kmalloc(GFP_KERNEL) memory, or NULL on error.  */
unsigned char* scsi_bios_ptable(struct block_device *dev)
{
	unsigned char *res = kmalloc(66, GFP_KERNEL);
	if (res) {
		struct block_device *bdev = dev->bd_contains;
		Sector sect;
		void *data = read_dev_sector(bdev, 0, &sect);
		if (data) {
			memcpy(res, data + 0x1be, 66);
			put_dev_sector(sect);
		} else {
			kfree(res);
			res = NULL;
		}
	}
	return res;
}