[RFC 3/9] prd: Add getgeo to block ops

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

 



From: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>

Some programs require HDIO_GETGEO work, which requires we implement
getgeo.  Based off of the work done to the NVMe driver in this commit:

4cc09e2dc4cb NVMe: Add getgeo to block ops

Signed-off-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>
---
 drivers/block/prd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/block/prd.c b/drivers/block/prd.c
index 4cfc4f8..cc0aabf 100644
--- a/drivers/block/prd.c
+++ b/drivers/block/prd.c
@@ -19,6 +19,7 @@
 #include <linux/bio.h>
 #include <linux/blkdev.h>
 #include <linux/fs.h>
+#include <linux/hdreg.h>
 #include <linux/highmem.h>
 #include <linux/init.h>
 #include <linux/major.h>
@@ -52,6 +53,15 @@ struct prd_device {
 	size_t			size;
 };
 
+static int prd_getgeo(struct block_device *bd, struct hd_geometry *geo)
+{
+	/* some standard values */
+	geo->heads = 1 << 6;
+	geo->sectors = 1 << 5;
+	geo->cylinders = get_capacity(bd->bd_disk) >> 11;
+	return 0;
+}
+
 /*
  * direct translation from (prd,sector) => void*
  * We do not require that sector be page aligned.
@@ -213,6 +223,7 @@ static const struct block_device_operations prd_fops = {
 	.owner =		THIS_MODULE,
 	.rw_page =		prd_rw_page,
 	.direct_access =	prd_direct_access,
+	.getgeo =		prd_getgeo,
 };
 
 /* Kernel module stuff */
-- 
1.9.3


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]