From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: [RFC 3/9] prd: Add getgeo to block ops Date: Wed, 13 Aug 2014 15:12:42 +0300 Message-ID: <53EB563A.5030805@plexistor.com> References: <53EB5536.8020702@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: Ross Zwisler , linux-fsdevel , Andrew Morton , linux-mm@kvack.org, Matthew Wilcox , Sagi Manole , Yigal Korman Return-path: In-Reply-To: <53EB5536.8020702@gmail.com> Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org From: Ross Zwisler 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 --- 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 #include #include +#include #include #include #include @@ -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@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org