Re: [PATCH 3/3] target: use \n as a separator for configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2011-11-23 at 20:53 +0100, Sebastian Andrzej Siewior wrote:
> The command
> | echo rd_pages=32768 > ramdisk/control
> 
> Does not work because it writes "rd_pages=32768\n" and the parser which
> matches for "rd_pages=%d" does not recognize it due to the \n. One way
> of fixing this would be using "echo -n" instead.
> This patch adds \n to the list of separators so we don't have to use the
> -n argument which I find is more convinient.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
>  drivers/target/target_core_configfs.c |    2 +-
>  drivers/target/target_core_file.c     |    2 +-
>  drivers/target/target_core_iblock.c   |    2 +-
>  drivers/target/target_core_pscsi.c    |    2 +-
>  drivers/target/target_core_rd.c       |    2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
> index e0c1e8a..e87eff6 100644
> --- a/drivers/target/target_core_configfs.c
> +++ b/drivers/target/target_core_configfs.c
> @@ -1455,7 +1455,7 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
>  		return -ENOMEM;
>  
>  	orig = opts;
> -	while ((ptr = strsep(&opts, ",")) != NULL) {
> +	while ((ptr = strsep(&opts, ",\n")) != NULL) {
>  		if (!*ptr)
>  			continue;
>  
> diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
> index 67cd6fe..2eea352 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -496,7 +496,7 @@ static ssize_t fd_set_configfs_dev_params(
>  
>  	orig = opts;
>  
> -	while ((ptr = strsep(&opts, ",")) != NULL) {
> +	while ((ptr = strsep(&opts, ",\n")) != NULL) {
>  		if (!*ptr)
>  			continue;
>  
> diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
> index 7698efe..0c7f26e 100644
> --- a/drivers/target/target_core_iblock.c
> +++ b/drivers/target/target_core_iblock.c
> @@ -391,7 +391,7 @@ static ssize_t iblock_set_configfs_dev_params(struct se_hba *hba,
>  
>  	orig = opts;
>  
> -	while ((ptr = strsep(&opts, ",")) != NULL) {
> +	while ((ptr = strsep(&opts, ",\n")) != NULL) {
>  		if (!*ptr)
>  			continue;
>  
> diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
> index ed32e1e..307b307 100644
> --- a/drivers/target/target_core_pscsi.c
> +++ b/drivers/target/target_core_pscsi.c
> @@ -818,7 +818,7 @@ static ssize_t pscsi_set_configfs_dev_params(struct se_hba *hba,
>  
>  	orig = opts;
>  
> -	while ((ptr = strsep(&opts, ",")) != NULL) {
> +	while ((ptr = strsep(&opts, ",\n")) != NULL) {
>  		if (!*ptr)
>  			continue;
>  
> diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
> index 5158d38..a491380 100644
> --- a/drivers/target/target_core_rd.c
> +++ b/drivers/target/target_core_rd.c
> @@ -642,7 +642,7 @@ static ssize_t rd_set_configfs_dev_params(
>  
>  	orig = opts;
>  
> -	while ((ptr = strsep(&opts, ",")) != NULL) {
> +	while ((ptr = strsep(&opts, ",\n")) != NULL) {
>  		if (!*ptr)
>  			continue;
>  

Hi Sebastian,

I think this is a reasonable change for configfs input for device
backends and aptpl input with direct usage  .  After some brief testing
this morning it appears to be fine with existing 'echo -n' usage in
lio-utils.git v4.1 code.  Things also appear as normal with backend
storage object context usage in rtslib v2 code, (Cc'ing Jerome just in
case)

Thanks!

--nab

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux