From patchwork Mon Mar 16 21:12:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 6025481 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 353EBBF90F for ; Mon, 16 Mar 2015 21:13:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E8A620454 for ; Mon, 16 Mar 2015 21:13:14 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 821F9203E9 for ; Mon, 16 Mar 2015 21:13:13 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 787558100C; Mon, 16 Mar 2015 14:13:13 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ml01.01.org (Postfix) with ESMTP id 08D178100D for ; Mon, 16 Mar 2015 14:13:12 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 16 Mar 2015 14:07:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,411,1422950400"; d="scan'208";a="541751268" Received: from theros.lm.intel.com ([10.232.112.52]) by orsmga003.jf.intel.com with ESMTP; 16 Mar 2015 14:12:06 -0700 From: Ross Zwisler To: linux-kernel@vger.kernel.org Date: Mon, 16 Mar 2015 15:12:56 -0600 Message-Id: <1426540380-24503-3-git-send-email-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1426540380-24503-1-git-send-email-ross.zwisler@linux.intel.com> References: <1426540380-24503-1-git-send-email-ross.zwisler@linux.intel.com> Cc: axboe@kernel.dk, riel@redhat.com, linux-nvdimm@lists.01.org, hch@infradead.org, linux-fsdevel@vger.kernel.org Subject: [Linux-nvdimm] [PATCH 2/6] pmem: Add support for getgeo() X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some programs require HDIO_GETGEO work, which requires we implement getgeo. Based off of the work done to the NVMe driver in this commit: commit 4cc09e2dc4cb ("NVMe: Add getgeo to block ops") Signed-off-by: Ross Zwisler Cc: linux-nvdimm@lists.01.org Cc: linux-fsdevel@vger.kernel.org Cc: axboe@kernel.dk Cc: hch@infradead.org Cc: riel@redhat.com --- drivers/block/pmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c index d366b9b..60bbe0d 100644 --- a/drivers/block/pmem.c +++ b/drivers/block/pmem.c @@ -50,6 +50,15 @@ struct pmem_device { size_t size; }; +static int pmem_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 (pmem,sector) => void* * We do not require that sector be page aligned. @@ -176,6 +185,7 @@ out: static const struct block_device_operations pmem_fops = { .owner = THIS_MODULE, + .getgeo = pmem_getgeo, }; /* Kernel module stuff */