From: Ondrej Kozina <okozina@redhat.com>
To: linux-block@vger.kernel.org
Cc: bluca@debian.org, gmazyland@gmail.com, axboe@kernel.dk,
hch@infradead.org, brauner@kernel.org,
jonathan.derrick@linux.dev, Ondrej Kozina <okozina@redhat.com>,
Christoph Hellwig <hch@lst.de>
Subject: [PATCH v2 4/5] sed-opal: add helper to get multiple columns at once.
Date: Wed, 5 Apr 2023 13:12:22 +0200 [thread overview]
Message-ID: <20230405111223.272816-5-okozina@redhat.com> (raw)
In-Reply-To: <20230405111223.272816-1-okozina@redhat.com>
Refactors current code querying single column to use the
new helper. Real multi column usage will be added later.
Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Tested-by: Luca Boccassi <bluca@debian.org>
Tested-by: Milan Broz <gmazyland@gmail.com>
Acked-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
block/sed-opal.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/block/sed-opal.c b/block/sed-opal.c
index 38cc02b708ac..b95560d9c5eb 100644
--- a/block/sed-opal.c
+++ b/block/sed-opal.c
@@ -1149,12 +1149,8 @@ static int finalize_and_send(struct opal_dev *dev, cont_fn cont)
return opal_send_recv(dev, cont);
}
-/*
- * request @column from table @table on device @dev. On success, the column
- * data will be available in dev->resp->tok[4]
- */
-static int generic_get_column(struct opal_dev *dev, const u8 *table,
- u64 column)
+static int generic_get_columns(struct opal_dev *dev, const u8 *table,
+ u64 start_column, u64 end_column)
{
int err;
@@ -1164,12 +1160,12 @@ static int generic_get_column(struct opal_dev *dev, const u8 *table,
add_token_u8(&err, dev, OPAL_STARTNAME);
add_token_u8(&err, dev, OPAL_STARTCOLUMN);
- add_token_u64(&err, dev, column);
+ add_token_u64(&err, dev, start_column);
add_token_u8(&err, dev, OPAL_ENDNAME);
add_token_u8(&err, dev, OPAL_STARTNAME);
add_token_u8(&err, dev, OPAL_ENDCOLUMN);
- add_token_u64(&err, dev, column);
+ add_token_u64(&err, dev, end_column);
add_token_u8(&err, dev, OPAL_ENDNAME);
add_token_u8(&err, dev, OPAL_ENDLIST);
@@ -1180,6 +1176,16 @@ static int generic_get_column(struct opal_dev *dev, const u8 *table,
return finalize_and_send(dev, parse_and_check_status);
}
+/*
+ * request @column from table @table on device @dev. On success, the column
+ * data will be available in dev->resp->tok[4]
+ */
+static int generic_get_column(struct opal_dev *dev, const u8 *table,
+ u64 column)
+{
+ return generic_get_columns(dev, table, column, column);
+}
+
/*
* see TCG SAS 5.3.2.3 for a description of the available columns
*
--
2.31.1
next prev parent reply other threads:[~2023-04-05 11:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 15:15 [PATCH 0/5] sed-opal: add command to read locking range attributes Ondrej Kozina
2023-03-22 15:16 ` [PATCH 1/5] sed-opal: do not add user authority twice in boolean ace Ondrej Kozina
2023-03-29 14:15 ` Christian Brauner
2023-03-29 15:20 ` Ondrej Kozina
2023-04-04 15:23 ` Christoph Hellwig
2023-04-05 8:18 ` Christian Brauner
2023-03-22 15:16 ` [PATCH 2/5] sed-opal: add helper for adding user authorities in ACE Ondrej Kozina
2023-03-29 15:28 ` Christian Brauner
2023-04-04 15:25 ` Christoph Hellwig
2023-03-22 15:16 ` [PATCH 3/5] sed-opal: allow user authority to get locking range attributes Ondrej Kozina
2023-03-29 15:31 ` Christian Brauner
2023-04-04 15:26 ` Christoph Hellwig
2023-03-22 15:16 ` [PATCH 4/5] sed-opal: add helper to get multiple columns at once Ondrej Kozina
2023-03-29 15:32 ` Christian Brauner
2023-04-04 15:26 ` Christoph Hellwig
2023-03-22 15:16 ` [PATCH 5/5] sed-opal: Add command to read locking range parameters Ondrej Kozina
2023-04-04 15:27 ` Christoph Hellwig
2023-04-05 8:27 ` Christian Brauner
2023-04-05 9:39 ` Ondrej Kozina
2023-04-05 10:53 ` Luca Boccassi
2023-04-02 14:49 ` [PATCH 0/5] sed-opal: add command to read locking range attributes Luca Boccassi
2023-04-05 11:12 ` [PATCH v2 " Ondrej Kozina
2023-04-05 11:12 ` [PATCH v2 1/5] sed-opal: do not add same authority twice in boolean ace Ondrej Kozina
2023-04-05 11:12 ` [PATCH v2 2/5] sed-opal: add helper for adding user authorities in ACE Ondrej Kozina
2023-04-05 11:12 ` [PATCH v2 3/5] sed-opal: allow user authority to get locking range attributes Ondrej Kozina
2023-04-05 11:12 ` Ondrej Kozina [this message]
2023-04-05 11:12 ` [PATCH v2 5/5] sed-opal: Add command to read locking range parameters Ondrej Kozina
2023-04-05 13:46 ` [PATCH v2 0/5] sed-opal: add command to read locking range attributes Jens Axboe
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=20230405111223.272816-5-okozina@redhat.com \
--to=okozina@redhat.com \
--cc=axboe@kernel.dk \
--cc=bluca@debian.org \
--cc=brauner@kernel.org \
--cc=gmazyland@gmail.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=jonathan.derrick@linux.dev \
--cc=linux-block@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox