Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378507

Re: [PATCHv2 1/2] target: make target db location configurable

From Hannes Reinecke <hare@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCHv2 1/2] target: make target db location configurable
Date 2016-04-14 08:20 +0200
Message-ID <rnINc-5LS-9@gated-at.bofh.it> (permalink)
References <rnzJU-74K-5@gated-at.bofh.it> <rnzJW-74K-57@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 04/13/2016 10:25 PM, Lee Duncan wrote:
> This commit adds the read-write attribute "dbroot",
> in the top-level CONFIGFS (core) target directory,
> normally /sys/kernel/config/target. This attribute
> defaults to "/var/target" but can be changed by
> writing a new pathname string to it. Changing this
> attribute is only allowed when no fabric drivers
> are loaded and the supplied value specifies an
> existing directory.
> 
> Target modules that care about the target database
> root directory will be modified to use this
> attribute in a future commit.
> 
> Signed-off-by: Lee Duncan <lduncan@suse.com>
> ---
>  drivers/target/target_core_configfs.c | 51 +++++++++++++++++++++++++++++++++++
>  drivers/target/target_core_internal.h |  6 +++++
>  2 files changed, 57 insertions(+)
> 
> diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
> index 713c63d9681b..bfedbd92b77f 100644
> --- a/drivers/target/target_core_configfs.c
> +++ b/drivers/target/target_core_configfs.c
> @@ -99,6 +99,56 @@ static ssize_t target_core_item_version_show(struct config_item *item,
>  
>  CONFIGFS_ATTR_RO(target_core_item_, version);
>  
> +char db_root[DB_ROOT_LEN] = DB_ROOT_DEFAULT;
> +static char db_root_stage[DB_ROOT_LEN];
> +
> +static ssize_t target_core_item_dbroot_show(struct config_item *item,
> +					    char *page)
> +{
> +	return sprintf(page, "%s\n", db_root);
> +}
> +
> +static ssize_t target_core_item_dbroot_store(struct config_item *item,
> +					const char *page, size_t count)
> +{
> +	ssize_t read_bytes;
> +	struct file *fp;
> +
> +	if (!list_empty(&g_tf_list)) {
> +		pr_err("db_root: cannot be changed: target drivers registered");
> +		return -EINVAL;
> +	}
Locking?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/2] target: make location of /var/targets configurable Lee Duncan <lduncan@suse.com> - 2016-04-13 22:40 +0200
  [PATCHv2 1/2] target: make target db location configurable Lee Duncan <lduncan@suse.com> - 2016-04-13 22:40 +0200
    Re: [PATCHv2 1/2] target: make target db location configurable Hannes Reinecke <hare@suse.de> - 2016-04-14 08:20 +0200
      Re: [PATCHv2 1/2] target: make target db location configurable Lee Duncan <lduncan@suse.com> - 2016-04-15 02:10 +0200

csiph-web