mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "shiqiang.deng" <shiqiang.deng213@gmail.com>
To: willy@infradead.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	"shiqiang.deng" <shiqiang.deng213@gmail.com>
Subject: [PATCH] test_ida: Fix compilation errors
Date: Sun, 12 Nov 2023 15:08:40 +0800	[thread overview]
Message-ID: <20231112070840.327190-1-shiqiang.deng213@gmail.com> (raw)

In lib/test_ida.c, we found that IDA_BUG_ON
uses the ida_dump() function. When __ Kernel__ is not defined,
a missing-prototypes error will occur during compilation.
Fix it now.

Signed-off-by: shiqiang.deng <shiqiang.deng213@gmail.com>
---
 include/linux/idr.h | 4 ++++
 lib/idr.c           | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/idr.h b/include/linux/idr.h
index a0dce14090a9..e091efdc0cf7 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -109,6 +109,10 @@ static inline void idr_set_cursor(struct idr *idr, unsigned int val)
 #define idr_unlock_irqrestore(idr, flags) \
 				xa_unlock_irqrestore(&(idr)->idr_rt, flags)
 
+#ifndef __KERNEL__
+void ida_dump(struct ida *ida);
+#endif
+
 void idr_preload(gfp_t gfp_mask);
 
 int idr_alloc(struct idr *, void *ptr, int start, int end, gfp_t);
diff --git a/lib/idr.c b/lib/idr.c
index 13f2758c2377..66d0c6e30588 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -589,7 +589,7 @@ static void ida_dump_entry(void *entry, unsigned long index)
 	}
 }
 
-static void ida_dump(struct ida *ida)
+void ida_dump(struct ida *ida)
 {
 	struct xarray *xa = &ida->xa;
 	pr_debug("ida: %p node %p free %d\n", ida, xa->xa_head,
-- 
2.30.0


             reply	other threads:[~2023-11-12  7:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12  7:08 shiqiang.deng [this message]
2023-11-12 15:31 ` Matthew Wilcox

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=20231112070840.327190-1-shiqiang.deng213@gmail.com \
    --to=shiqiang.deng213@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@infradead.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

all inboxes | Powered by JetHome®