All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org,
	axboe@kernel.dk, hch@infradead.org, riel@redhat.com
Subject: [PATCH 2/6] pmem: Add support for getgeo()
Date: Mon, 16 Mar 2015 15:12:56 -0600	[thread overview]
Message-ID: <1426540380-24503-3-git-send-email-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <1426540380-24503-1-git-send-email-ross.zwisler@linux.intel.com>

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 <ross.zwisler@linux.intel.com>
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 */
-- 
1.9.3


WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org,
	axboe@kernel.dk, hch@infradead.org, riel@redhat.com
Subject: [PATCH 2/6] pmem: Add support for getgeo()
Date: Mon, 16 Mar 2015 15:12:56 -0600	[thread overview]
Message-ID: <1426540380-24503-3-git-send-email-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <1426540380-24503-1-git-send-email-ross.zwisler@linux.intel.com>

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 <ross.zwisler@linux.intel.com>
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 */
-- 
1.9.3


  parent reply	other threads:[~2015-03-16 21:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 21:12 [PATCH 0/6] Add persistent memory driver Ross Zwisler
2015-03-16 21:12 ` Ross Zwisler
2015-03-16 21:12 ` [PATCH 1/6] pmem: Initial version of " Ross Zwisler
2015-03-16 21:12   ` Ross Zwisler
2015-03-17 18:53   ` Paul Bolle
2015-03-17 18:53     ` Paul Bolle
2015-03-16 21:12 ` Ross Zwisler [this message]
2015-03-16 21:12   ` [PATCH 2/6] pmem: Add support for getgeo() Ross Zwisler
2015-03-16 21:12 ` [PATCH 3/6] pmem: Add support for rw_page() Ross Zwisler
2015-03-16 21:12   ` Ross Zwisler
2015-03-16 21:12 ` [PATCH 4/6] pmem: Add support for direct_access() Ross Zwisler
2015-03-16 21:12   ` Ross Zwisler
2015-03-16 21:12 ` [PATCH 5/6] pmem: Clean up includes Ross Zwisler
2015-03-16 21:12   ` Ross Zwisler
2015-03-16 21:13 ` [PATCH 6/6] pmem: Let each device manage private memory region Ross Zwisler
2015-03-16 21:13   ` Ross Zwisler
2015-03-18 10:57   ` Boaz Harrosh
2015-03-18 10:57     ` Boaz Harrosh
2015-03-18 11:08 ` [Linux-nvdimm] [PATCH 0/6] Add persistent memory driver Boaz Harrosh
2015-03-18 11:08   ` Boaz Harrosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426540380-24503-3-git-send-email-ross.zwisler@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.