Skip to contentSkip to conversation

target:tcmu:add '\n' when return user space

PATCH Mike Christie 1 participant 1 message Mar 11, 2019 SCSI target

lore
Share & tools
lore
#0 lore raw
Quoted 13 lines · David Disseldorp

Hi,

Quoted 1 line · tangwenji

In function tcmu_get_global_max_data_area return string should include '\n'.

Why? Please describe the motivation for your changes.

Quoted 5 lines
---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/target/target_core_user.c static int tcmu_set_global_max_data_area(const char *str, · line 247

Quoted 10 lines
drivers/target/target_core_user.c +1 -1
index 5831e0e..50229c1 100644
@@ -244,7 +244,7 @@ static int tcmu_set_global_max_data_area(const char *str,
 static int tcmu_get_global_max_data_area(char *buffer,
 					 const struct kernel_param *kp)
 {
-	return sprintf(buffer, "%d", TCMU_BLOCKS_TO_MBS(tcmu_global_max_blocks));
+	return sprintf(buffer, "%d\n", TCMU_BLOCKS_TO_MBS(tcmu_global_max_blocks));

Although minor, this is still a modification to a released API so probably can't be done without potentially breaking user-space.

I think the lack of newline is breaking some tools, because they were looking for newlines due to the other files having it.