* [PATCH] nbd: add missing definition of pr_fmt
@ 2022-07-06 9:33 Yu Kuai
2022-07-18 13:52 ` Yu Kuai
0 siblings, 1 reply; 8+ messages in thread
From: Yu Kuai @ 2022-07-06 9:33 UTC (permalink / raw)
To: josef, axboe, houtao1, yukuai3
Cc: linux-block, nbd, linux-kernel, yukuai1, yi.zhang
From: Yu Kuai <yukuai3@huawei.com>
commit 1243172d5894 ("nbd: use pr_err to output error message") tries
to define pr_fmt and use short pr_err() to output error message,
however, the definition is missed.
Fixes: 1243172d5894 ("nbd: use pr_err to output error message")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
drivers/block/nbd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 07f3c139a3d7..94a1602adab5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -44,6 +44,9 @@
#include <linux/nbd-netlink.h>
#include <net/genetlink.h>
+#undef pr_fmt
+#define pr_fmt(fmt) "nbd: " fmt
+
#define CREATE_TRACE_POINTS
#include <trace/events/nbd.h>
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] nbd: add missing definition of pr_fmt
2022-07-06 9:33 [PATCH] nbd: add missing definition of pr_fmt Yu Kuai
@ 2022-07-18 13:52 ` Yu Kuai
2022-07-18 14:32 ` Joe Perches
0 siblings, 1 reply; 8+ messages in thread
From: Yu Kuai @ 2022-07-18 13:52 UTC (permalink / raw)
To: Yu Kuai, josef, axboe, houtao1; +Cc: linux-block, nbd, linux-kernel, yi.zhang
在 2022/07/06 17:33, Yu Kuai 写道:
> From: Yu Kuai <yukuai3@huawei.com>
>
> commit 1243172d5894 ("nbd: use pr_err to output error message") tries
> to define pr_fmt and use short pr_err() to output error message,
> however, the definition is missed.
friendly ping ...
>
> Fixes: 1243172d5894 ("nbd: use pr_err to output error message")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> drivers/block/nbd.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 07f3c139a3d7..94a1602adab5 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -44,6 +44,9 @@
> #include <linux/nbd-netlink.h>
> #include <net/genetlink.h>
>
> +#undef pr_fmt
> +#define pr_fmt(fmt) "nbd: " fmt
> +
> #define CREATE_TRACE_POINTS
> #include <trace/events/nbd.h>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nbd: add missing definition of pr_fmt
2022-07-18 13:52 ` Yu Kuai
@ 2022-07-18 14:32 ` Joe Perches
2022-07-20 11:46 ` Yu Kuai
0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2022-07-18 14:32 UTC (permalink / raw)
To: Yu Kuai, josef, axboe, houtao1; +Cc: linux-block, nbd, linux-kernel, yi.zhang
On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote:
> 在 2022/07/06 17:33, Yu Kuai 写道:
> > From: Yu Kuai <yukuai3@huawei.com>
> >
> > commit 1243172d5894 ("nbd: use pr_err to output error message") tries
> > to define pr_fmt and use short pr_err() to output error message,
> > however, the definition is missed.
>
> friendly ping ...
[]
> > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
[]
> > @@ -44,6 +44,9 @@
> > #include <linux/nbd-netlink.h>
> > #include <net/genetlink.h>
> >
> > +#undef pr_fmt
> > +#define pr_fmt(fmt) "nbd: " fmt
> > +
Typically, this #define is place before all #include lines
so there is no need for an #undef
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nbd: add missing definition of pr_fmt
2022-07-18 14:32 ` Joe Perches
@ 2022-07-20 11:46 ` Yu Kuai
2022-07-23 2:14 ` Yu Kuai
2022-07-23 2:15 ` Yu Kuai
0 siblings, 2 replies; 8+ messages in thread
From: Yu Kuai @ 2022-07-20 11:46 UTC (permalink / raw)
To: Joe Perches, josef, axboe, houtao1
Cc: linux-block, nbd, linux-kernel, yi.zhang
Hi !
在 2022/07/18 22:32, Joe Perches 写道:
> On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote:
>> 在 2022/07/06 17:33, Yu Kuai 写道:
>>> From: Yu Kuai <yukuai3@huawei.com>
>>>
>>> commit 1243172d5894 ("nbd: use pr_err to output error message") tries
>>> to define pr_fmt and use short pr_err() to output error message,
>>> however, the definition is missed.
>> friendly ping ...
> []
>>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> []
>>> @@ -44,6 +44,9 @@
>>> #include <linux/nbd-netlink.h>
>>> #include <net/genetlink.h>
>>>
>>> +#undef pr_fmt
>>> +#define pr_fmt(fmt) "nbd: " fmt
>>> +
> Typically, this #define is place before all #include lines
> so there is no need for an #undef
Thanks for you advice, I'll do that in v2.
Kuai
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nbd: add missing definition of pr_fmt
2022-07-20 11:46 ` Yu Kuai
@ 2022-07-23 2:14 ` Yu Kuai
2022-07-23 2:15 ` Yu Kuai
1 sibling, 0 replies; 8+ messages in thread
From: Yu Kuai @ 2022-07-23 2:14 UTC (permalink / raw)
To: Yu Kuai, Joe Perches, josef, axboe, houtao1
Cc: linux-block, nbd, linux-kernel, yi.zhang
Hi!
在 2022/07/20 19:46, Yu Kuai 写道:
> Hi !
>
> 在 2022/07/18 22:32, Joe Perches 写道:
>> On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote:
>>> 在 2022/07/06 17:33, Yu Kuai 写道:
>>>> From: Yu Kuai <yukuai3@huawei.com>
>>>>
>>>> commit 1243172d5894 ("nbd: use pr_err to output error message") tries
>>>> to define pr_fmt and use short pr_err() to output error message,
>>>> however, the definition is missed.
>>> friendly ping ...
>> []
>>>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>> []
>>>> @@ -44,6 +44,9 @@
>>>> #include <linux/nbd-netlink.h>
>>>> #include <net/genetlink.h>
>>>> +#undef pr_fmt
>>>> +#define pr_fmt(fmt) "nbd: " fmt
>>>> +
I tried to remove the #undef:
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -44,7 +44,6 @@
#include <linux/nbd-netlink.h>
#include <net/genetlink.h>
#define pr_fmt(fmt) "nbd: " fmt
And then following warning is triggered:
drivers/block/nbd.c:47: warning: "pr_fmt" redefined
47 | #define pr_fmt(fmt) "nbd: " fmt
It semms that keeping that #undef is the right thing to do.
Thanks,
Kuai
>> Typically, this #define is place before all #include lines
>> so there is no need for an #undef
>
> Thanks for you advice, I'll do that in v2.
>
> Kuai
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nbd: add missing definition of pr_fmt
2022-07-20 11:46 ` Yu Kuai
2022-07-23 2:14 ` Yu Kuai
@ 2022-07-23 2:15 ` Yu Kuai
2022-07-23 3:12 ` Joe Perches
1 sibling, 1 reply; 8+ messages in thread
From: Yu Kuai @ 2022-07-23 2:15 UTC (permalink / raw)
To: Yu Kuai, Joe Perches, josef, axboe, houtao1
Cc: linux-block, nbd, linux-kernel, yi.zhang
Hi!
在 2022/07/20 19:46, Yu Kuai 写道:
> Hi !
>
> 在 2022/07/18 22:32, Joe Perches 写道:
>> On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote:
>>> 在 2022/07/06 17:33, Yu Kuai 写道:
>>>> From: Yu Kuai <yukuai3@huawei.com>
>>>>
>>>> commit 1243172d5894 ("nbd: use pr_err to output error message") tries
>>>> to define pr_fmt and use short pr_err() to output error message,
>>>> however, the definition is missed.
>>> friendly ping ...
>> []
>>>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>> []
>>>> @@ -44,6 +44,9 @@
>>>> #include <linux/nbd-netlink.h>
>>>> #include <net/genetlink.h>
>>>> +#undef pr_fmt
>>>> +#define pr_fmt(fmt) "nbd: " fmt
>>>> +
>> Typically, this #define is place before all #include lines
>> so there is no need for an #undef
I tried to remove the #undef:
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -44,7 +44,6 @@
#include <linux/nbd-netlink.h>
#include <net/genetlink.h>
#define pr_fmt(fmt) "nbd: " fmt
And then following warning is triggered:
drivers/block/nbd.c:47: warning: "pr_fmt" redefined
47 | #define pr_fmt(fmt) "nbd: " fmt
It semms that keeping that #undef is the right thing to do.
Thanks,
Kuai
>
> Thanks for you advice, I'll do that in v2.
>
> Kuai
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] nbd: add missing definition of pr_fmt
2022-07-23 2:15 ` Yu Kuai
@ 2022-07-23 3:12 ` Joe Perches
2022-07-23 4:08 ` Yu Kuai
0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2022-07-23 3:12 UTC (permalink / raw)
To: Yu Kuai, Yu Kuai, josef, axboe, houtao1
Cc: linux-block, nbd, linux-kernel, yi.zhang
On Sat, 2022-07-23 at 10:15 +0800, Yu Kuai wrote:
> Hi!
Hello.
> 在 2022/07/20 19:46, Yu Kuai 写道:
> > 在 2022/07/18 22:32, Joe Perches 写道:
> > > On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote:
> > > > 在 2022/07/06 17:33, Yu Kuai 写道:
> > > > > From: Yu Kuai <yukuai3@huawei.com>
> > > > >
> > > > > commit 1243172d5894 ("nbd: use pr_err to output error message") tries
> > > > > to define pr_fmt and use short pr_err() to output error message,
> > > > > however, the definition is missed.
> > > > friendly ping ...
> > > []
> > > > > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> > > []
> > > > > @@ -44,6 +44,9 @@
> > > > > #include <linux/nbd-netlink.h>
> > > > > #include <net/genetlink.h>
> > > > > +#undef pr_fmt
> > > > > +#define pr_fmt(fmt) "nbd: " fmt
> > > > > +
> > > Typically, this #define is place before all #include lines
> > > so there is no need for an #undef
>
> I tried to remove the #undef:
I'll repeat my message.
Move the #define before _any_ #include.
Also, there are some message that would need existing "nbd: " output
prefixes removed.
---
drivers/block/nbd.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index f5d098a148cbf..222f26ac5e96a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -11,6 +11,8 @@
* (part of code stolen from loop.c)
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/major.h>
#include <linux/blkdev.h>
@@ -1950,8 +1952,8 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
test_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags)) ||
!refcount_inc_not_zero(&nbd->refs)) {
mutex_unlock(&nbd_index_mutex);
- pr_err("nbd: device at index %d is going down\n",
- index);
+ pr_err("device at index %d is going down\n",
+ index);
return -EINVAL;
}
}
@@ -1961,7 +1963,7 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
if (!nbd) {
nbd = nbd_dev_add(index, 2);
if (IS_ERR(nbd)) {
- pr_err("nbd: failed to add new device\n");
+ pr_err("failed to add new device\n");
return PTR_ERR(nbd);
}
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] nbd: add missing definition of pr_fmt
2022-07-23 3:12 ` Joe Perches
@ 2022-07-23 4:08 ` Yu Kuai
0 siblings, 0 replies; 8+ messages in thread
From: Yu Kuai @ 2022-07-23 4:08 UTC (permalink / raw)
To: Joe Perches, Yu Kuai, josef, axboe, houtao1
Cc: linux-block, nbd, linux-kernel, yi.zhang
Hi!
在 2022/07/23 11:12, Joe Perches 写道:
> On Sat, 2022-07-23 at 10:15 +0800, Yu Kuai wrote:
>> Hi!
>
> Hello.
>
>> 在 2022/07/20 19:46, Yu Kuai 写道:
>>> 在 2022/07/18 22:32, Joe Perches 写道:
>>>> On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote:
>>>>> 在 2022/07/06 17:33, Yu Kuai 写道:
>>>>>> From: Yu Kuai <yukuai3@huawei.com>
>>>>>>
>>>>>> commit 1243172d5894 ("nbd: use pr_err to output error message") tries
>>>>>> to define pr_fmt and use short pr_err() to output error message,
>>>>>> however, the definition is missed.
>>>>> friendly ping ...
>>>> []
>>>>>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>>>> []
>>>>>> @@ -44,6 +44,9 @@
>>>>>> #include <linux/nbd-netlink.h>
>>>>>> #include <net/genetlink.h>
>>>>>> +#undef pr_fmt
>>>>>> +#define pr_fmt(fmt) "nbd: " fmt
>>>>>> +
>>>> Typically, this #define is place before all #include lines
>>>> so there is no need for an #undef
>>
>> I tried to remove the #undef:
>
> I'll repeat my message.
>
> Move the #define before _any_ #include.
>
> Also, there are some message that would need existing "nbd: " output
> prefixes removed.
Thanks for your explanation, I do miss that.
Kuai
> ---
> drivers/block/nbd.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index f5d098a148cbf..222f26ac5e96a 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -11,6 +11,8 @@
> * (part of code stolen from loop.c)
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/major.h>
>
> #include <linux/blkdev.h>
> @@ -1950,8 +1952,8 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
> test_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags)) ||
> !refcount_inc_not_zero(&nbd->refs)) {
> mutex_unlock(&nbd_index_mutex);
> - pr_err("nbd: device at index %d is going down\n",
> - index);
> + pr_err("device at index %d is going down\n",
> + index);
> return -EINVAL;
> }
> }
> @@ -1961,7 +1963,7 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
> if (!nbd) {
> nbd = nbd_dev_add(index, 2);
> if (IS_ERR(nbd)) {
> - pr_err("nbd: failed to add new device\n");
> + pr_err("failed to add new device\n");
> return PTR_ERR(nbd);
> }
> }
>
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-07-23 4:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 9:33 [PATCH] nbd: add missing definition of pr_fmt Yu Kuai
2022-07-18 13:52 ` Yu Kuai
2022-07-18 14:32 ` Joe Perches
2022-07-20 11:46 ` Yu Kuai
2022-07-23 2:14 ` Yu Kuai
2022-07-23 2:15 ` Yu Kuai
2022-07-23 3:12 ` Joe Perches
2022-07-23 4:08 ` Yu Kuai
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.