* [PATCH] xen-blkback: enlarge the array size of blkback name
@ 2015-03-13 15:52 Tao Chen
2015-03-26 11:23 ` Roger Pau Monné
2015-03-26 11:23 ` Roger Pau Monné
0 siblings, 2 replies; 6+ messages in thread
From: Tao Chen @ 2015-03-13 15:52 UTC (permalink / raw)
To: konrad.wilk, roger.pau
Cc: xen-devel, linux-kernel, boby.chen, wu.wubin, rudy.zhangmin
The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
(means larger than 100), then the backmost xvd wouldn't be fully shown.
Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
array size of blkback name, so it will be fully shown in any case.
Signed-off-by: Tao Chen <boby.chen@huawei.com>
---
drivers/block/xen-blkback/xenbus.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index e3afe97..0289e21 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -21,6 +21,9 @@
#include <xen/grant_table.h>
#include "common.h"
+/* Enlarge the array size in order to fully show blkback name. */
+#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)
+
struct backend_info {
struct xenbus_device *dev;
struct xen_blkif *blkif;
@@ -70,7 +73,7 @@ static int blkback_name(struct xen_blkif *blkif, char *buf)
else
devname = devpath;
- snprintf(buf, TASK_COMM_LEN, "blkback.%d.%s", blkif->domid, devname);
+ snprintf(buf, BLKBACK_NAME_LEN, "blkback.%d.%s", blkif->domid, devname);
kfree(devpath);
return 0;
@@ -79,7 +82,7 @@ static int blkback_name(struct xen_blkif *blkif, char *buf)
static void xen_update_blkif_status(struct xen_blkif *blkif)
{
int err;
- char name[TASK_COMM_LEN];
+ char name[BLKBACK_NAME_LEN];
/* Not ready to connect? */
if (!blkif->irq || !blkif->vbd.bdev)
--
1.8.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] xen-blkback: enlarge the array size of blkback name
2015-03-13 15:52 [PATCH] xen-blkback: enlarge the array size of blkback name Tao Chen
@ 2015-03-26 11:23 ` Roger Pau Monné
2015-03-27 4:01 ` Chentao (Boby)
2015-03-27 4:01 ` Chentao (Boby)
2015-03-26 11:23 ` Roger Pau Monné
1 sibling, 2 replies; 6+ messages in thread
From: Roger Pau Monné @ 2015-03-26 11:23 UTC (permalink / raw)
To: Tao Chen, konrad.wilk; +Cc: xen-devel, linux-kernel, wu.wubin, rudy.zhangmin
El 13/03/15 a les 16.52, Tao Chen ha escrit:
> The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
> (means larger than 100), then the backmost xvd wouldn't be fully shown.
>
> Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
> array size of blkback name, so it will be fully shown in any case.
>
> Signed-off-by: Tao Chen <boby.chen@huawei.com>
> ---
> drivers/block/xen-blkback/xenbus.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index e3afe97..0289e21 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -21,6 +21,9 @@
> #include <xen/grant_table.h>
> #include "common.h"
>
> +/* Enlarge the array size in order to fully show blkback name. */
> +#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)
Any reason to use TASK_COMM_LEN instead of just coding it to 17? Or
maybe 20 to be on the safe side?
Roger.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] xen-blkback: enlarge the array size of blkback name
2015-03-13 15:52 [PATCH] xen-blkback: enlarge the array size of blkback name Tao Chen
2015-03-26 11:23 ` Roger Pau Monné
@ 2015-03-26 11:23 ` Roger Pau Monné
1 sibling, 0 replies; 6+ messages in thread
From: Roger Pau Monné @ 2015-03-26 11:23 UTC (permalink / raw)
To: Tao Chen, konrad.wilk; +Cc: xen-devel, rudy.zhangmin, linux-kernel, wu.wubin
El 13/03/15 a les 16.52, Tao Chen ha escrit:
> The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
> (means larger than 100), then the backmost xvd wouldn't be fully shown.
>
> Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
> array size of blkback name, so it will be fully shown in any case.
>
> Signed-off-by: Tao Chen <boby.chen@huawei.com>
> ---
> drivers/block/xen-blkback/xenbus.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index e3afe97..0289e21 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -21,6 +21,9 @@
> #include <xen/grant_table.h>
> #include "common.h"
>
> +/* Enlarge the array size in order to fully show blkback name. */
> +#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)
Any reason to use TASK_COMM_LEN instead of just coding it to 17? Or
maybe 20 to be on the safe side?
Roger.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] xen-blkback: enlarge the array size of blkback name
2015-03-26 11:23 ` Roger Pau Monné
@ 2015-03-27 4:01 ` Chentao (Boby)
2015-03-27 4:01 ` Chentao (Boby)
1 sibling, 0 replies; 6+ messages in thread
From: Chentao (Boby) @ 2015-03-27 4:01 UTC (permalink / raw)
To: Roger Pau Monné, konrad.wilk
Cc: xen-devel, linux-kernel, wu.wubin, rudy.zhangmin
You are right, roger. Thanks.
domid is a u16, it will occupy 5 characters at most. So the biggest
length of blkback name is 8+5+5=18.
At this situation, define BLKBACK_NAME_LEN macro to be 20 is safe.
On 2015/3/26 19:23, Roger Pau Monné wrote:
> El 13/03/15 a les 16.52, Tao Chen ha escrit:
>> The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
>> (means larger than 100), then the backmost xvd wouldn't be fully shown.
>>
>> Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
>> array size of blkback name, so it will be fully shown in any case.
>>
>> Signed-off-by: Tao Chen <boby.chen@huawei.com>
>> ---
>> drivers/block/xen-blkback/xenbus.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
>> index e3afe97..0289e21 100644
>> --- a/drivers/block/xen-blkback/xenbus.c
>> +++ b/drivers/block/xen-blkback/xenbus.c
>> @@ -21,6 +21,9 @@
>> #include <xen/grant_table.h>
>> #include "common.h"
>>
>> +/* Enlarge the array size in order to fully show blkback name. */
>> +#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)
>
> Any reason to use TASK_COMM_LEN instead of just coding it to 17? Or
> maybe 20 to be on the safe side?
>
> Roger.
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] xen-blkback: enlarge the array size of blkback name
2015-03-26 11:23 ` Roger Pau Monné
2015-03-27 4:01 ` Chentao (Boby)
@ 2015-03-27 4:01 ` Chentao (Boby)
1 sibling, 0 replies; 6+ messages in thread
From: Chentao (Boby) @ 2015-03-27 4:01 UTC (permalink / raw)
To: Roger Pau Monné, konrad.wilk
Cc: xen-devel, rudy.zhangmin, linux-kernel, wu.wubin
You are right, roger. Thanks.
domid is a u16, it will occupy 5 characters at most. So the biggest
length of blkback name is 8+5+5=18.
At this situation, define BLKBACK_NAME_LEN macro to be 20 is safe.
On 2015/3/26 19:23, Roger Pau Monné wrote:
> El 13/03/15 a les 16.52, Tao Chen ha escrit:
>> The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
>> (means larger than 100), then the backmost xvd wouldn't be fully shown.
>>
>> Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
>> array size of blkback name, so it will be fully shown in any case.
>>
>> Signed-off-by: Tao Chen <boby.chen@huawei.com>
>> ---
>> drivers/block/xen-blkback/xenbus.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
>> index e3afe97..0289e21 100644
>> --- a/drivers/block/xen-blkback/xenbus.c
>> +++ b/drivers/block/xen-blkback/xenbus.c
>> @@ -21,6 +21,9 @@
>> #include <xen/grant_table.h>
>> #include "common.h"
>>
>> +/* Enlarge the array size in order to fully show blkback name. */
>> +#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)
>
> Any reason to use TASK_COMM_LEN instead of just coding it to 17? Or
> maybe 20 to be on the safe side?
>
> Roger.
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] xen-blkback: enlarge the array size of blkback name
@ 2015-03-13 15:52 Tao Chen
0 siblings, 0 replies; 6+ messages in thread
From: Tao Chen @ 2015-03-13 15:52 UTC (permalink / raw)
To: konrad.wilk, roger.pau
Cc: xen-devel, wu.wubin, rudy.zhangmin, linux-kernel, boby.chen
The blkback name is like blkback.domid.xvd[a-z], if domid has three digits
(means larger than 100), then the backmost xvd wouldn't be fully shown.
Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the
array size of blkback name, so it will be fully shown in any case.
Signed-off-by: Tao Chen <boby.chen@huawei.com>
---
drivers/block/xen-blkback/xenbus.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index e3afe97..0289e21 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -21,6 +21,9 @@
#include <xen/grant_table.h>
#include "common.h"
+/* Enlarge the array size in order to fully show blkback name. */
+#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2)
+
struct backend_info {
struct xenbus_device *dev;
struct xen_blkif *blkif;
@@ -70,7 +73,7 @@ static int blkback_name(struct xen_blkif *blkif, char *buf)
else
devname = devpath;
- snprintf(buf, TASK_COMM_LEN, "blkback.%d.%s", blkif->domid, devname);
+ snprintf(buf, BLKBACK_NAME_LEN, "blkback.%d.%s", blkif->domid, devname);
kfree(devpath);
return 0;
@@ -79,7 +82,7 @@ static int blkback_name(struct xen_blkif *blkif, char *buf)
static void xen_update_blkif_status(struct xen_blkif *blkif)
{
int err;
- char name[TASK_COMM_LEN];
+ char name[BLKBACK_NAME_LEN];
/* Not ready to connect? */
if (!blkif->irq || !blkif->vbd.bdev)
--
1.8.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-27 4:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 15:52 [PATCH] xen-blkback: enlarge the array size of blkback name Tao Chen
2015-03-26 11:23 ` Roger Pau Monné
2015-03-27 4:01 ` Chentao (Boby)
2015-03-27 4:01 ` Chentao (Boby)
2015-03-26 11:23 ` Roger Pau Monné
-- strict thread matches above, loose matches on Subject: below --
2015-03-13 15:52 Tao Chen
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.