diff mbox series

scsi: target: core: add line break to status show

Message ID 20250114025041.97301-1-kanie@linux.alibaba.com
State New
Headers show
Series scsi: target: core: add line break to status show | expand

Commit Message

Guixin Liu Jan. 14, 2025, 2:50 a.m. UTC
To ensure the output is not tangled with the shell prompt, add a
line break to clearly display the status.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/target/target_core_stat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Guixin Liu Jan. 17, 2025, 5:57 a.m. UTC | #1
gentle ping...

Best Regards,

Guixin Liu

在 2025/1/14 10:50, Guixin Liu 写道:
> To ensure the output is not tangled with the shell prompt, add a
> line break to clearly display the status.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>   drivers/target/target_core_stat.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
> index c42cbde8a31b..210648a0092e 100644
> --- a/drivers/target/target_core_stat.c
> +++ b/drivers/target/target_core_stat.c
> @@ -117,9 +117,9 @@ static ssize_t target_stat_tgt_status_show(struct config_item *item,
>   		char *page)
>   {
>   	if (to_stat_tgt_dev(item)->export_count)
> -		return snprintf(page, PAGE_SIZE, "activated");
> +		return snprintf(page, PAGE_SIZE, "activated\n");
>   	else
> -		return snprintf(page, PAGE_SIZE, "deactivated");
> +		return snprintf(page, PAGE_SIZE, "deactivated\n");
>   }
>   
>   static ssize_t target_stat_tgt_non_access_lus_show(struct config_item *item,
Mike Christie Jan. 17, 2025, 7:43 p.m. UTC | #2
On 1/13/25 8:50 PM, Guixin Liu wrote:
> To ensure the output is not tangled with the shell prompt, add a
> line break to clearly display the status.
> 
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>  drivers/target/target_core_stat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
> index c42cbde8a31b..210648a0092e 100644
> --- a/drivers/target/target_core_stat.c
> +++ b/drivers/target/target_core_stat.c
> @@ -117,9 +117,9 @@ static ssize_t target_stat_tgt_status_show(struct config_item *item,
>  		char *page)
>  {
>  	if (to_stat_tgt_dev(item)->export_count)
> -		return snprintf(page, PAGE_SIZE, "activated");
> +		return snprintf(page, PAGE_SIZE, "activated\n");
>  	else
> -		return snprintf(page, PAGE_SIZE, "deactivated");
> +		return snprintf(page, PAGE_SIZE, "deactivated\n");
>  }
>  
>  static ssize_t target_stat_tgt_non_access_lus_show(struct config_item *item,

Since all the other files have newlines, this will most likely be ok.
targetcli/rtslib work fine.

Reviewed-by: Mike Christie <michael.christie@oracle.com>
diff mbox series

Patch

diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index c42cbde8a31b..210648a0092e 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -117,9 +117,9 @@  static ssize_t target_stat_tgt_status_show(struct config_item *item,
 		char *page)
 {
 	if (to_stat_tgt_dev(item)->export_count)
-		return snprintf(page, PAGE_SIZE, "activated");
+		return snprintf(page, PAGE_SIZE, "activated\n");
 	else
-		return snprintf(page, PAGE_SIZE, "deactivated");
+		return snprintf(page, PAGE_SIZE, "deactivated\n");
 }
 
 static ssize_t target_stat_tgt_non_access_lus_show(struct config_item *item,