[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220519172421.162394-26-kent.overstreet@gmail.com>
Date: Thu, 19 May 2022 13:24:18 -0400
From: Kent Overstreet <kent.overstreet@...il.com>
To: linux-kernel@...r.kernel.org, linux-mm@...r.kernel.org,
pmladek@...e.com, rostedt@...dmis.org, senozhatsky@...omium.org
Cc: Kent Overstreet <kent.overstreet@...il.com>,
andriy.shevchenko@...ux.intel.com, willy@...radead.org,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
nvdimm@...ts.linux.dev
Subject: [PATCH v2 25/28] tools/testing/nvdimm: Convert to printbuf
This converts from seq_buf to printbuf. Here we're using printbuf with
an external buffer, meaning it's a direct conversion.
Signed-off-by: Kent Overstreet <kent.overstreet@...il.com>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: nvdimm@...ts.linux.dev
---
tools/testing/nvdimm/test/ndtest.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index 3ca7c32e93..e9b642f7f8 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -12,7 +12,7 @@
#include <linux/ndctl.h>
#include <nd-core.h>
#include <linux/printk.h>
-#include <linux/seq_buf.h>
+#include <linux/printbuf.h>
#include "../watermark.h"
#include "nfit_test.h"
@@ -797,32 +797,30 @@ static ssize_t flags_show(struct device *dev,
{
struct nvdimm *nvdimm = to_nvdimm(dev);
struct ndtest_dimm *dimm = nvdimm_provider_data(nvdimm);
- struct seq_buf s;
+ struct printbuf s = PRINTBUF_EXTERN(buf, PAGE_SIZE);
u64 flags;
flags = dimm->flags;
- seq_buf_init(&s, buf, PAGE_SIZE);
if (flags & PAPR_PMEM_UNARMED_MASK)
- seq_buf_printf(&s, "not_armed ");
+ pr_buf(&s, "not_armed ");
if (flags & PAPR_PMEM_BAD_SHUTDOWN_MASK)
- seq_buf_printf(&s, "flush_fail ");
+ pr_buf(&s, "flush_fail ");
if (flags & PAPR_PMEM_BAD_RESTORE_MASK)
- seq_buf_printf(&s, "restore_fail ");
+ pr_buf(&s, "restore_fail ");
if (flags & PAPR_PMEM_SAVE_MASK)
- seq_buf_printf(&s, "save_fail ");
+ pr_buf(&s, "save_fail ");
if (flags & PAPR_PMEM_SMART_EVENT_MASK)
- seq_buf_printf(&s, "smart_notify ");
+ pr_buf(&s, "smart_notify ");
+ if (printbuf_written(&s))
+ pr_buf(&s, "\n");
- if (seq_buf_used(&s))
- seq_buf_printf(&s, "\n");
-
- return seq_buf_used(&s);
+ return printbuf_written(&s);
}
static DEVICE_ATTR_RO(flags);
--
2.36.0
Powered by blists - more mailing lists