linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Lee Duncan <lduncan@suse.com>,
	linux-scsi@vger.kernel.org, nab@linux-iscsi.org,
	target-devel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hch@infradead.org,
	agrover@redhat.com, jxm@netiant.com
Subject: Re: [PATCHv2 1/2] target: make target db location configurable
Date: Thu, 14 Apr 2016 08:10:32 +0200	[thread overview]
Message-ID: <570F3458.8010109@suse.de> (raw)
In-Reply-To: <5f4f1bc2ac2177a37432f0afd22f16ddf65e9e9b.1460577841.git.lduncan@suse.com>

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)

  reply	other threads:[~2016-04-14  6:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 20:25 [PATCHv2 0/2] target: make location of /var/targets configurable Lee Duncan
2016-04-13 20:25 ` [PATCHv2 1/2] target: make target db location configurable Lee Duncan
2016-04-14  6:10   ` Hannes Reinecke [this message]
2016-04-15  0:04     ` Lee Duncan
2016-04-13 20:25 ` [PATCH 2/2] target: use new "dbroot" target attribute Lee Duncan
2016-04-14  6:10   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=570F3458.8010109@suse.de \
    --to=hare@suse.de \
    --cc=agrover@redhat.com \
    --cc=hch@infradead.org \
    --cc=jxm@netiant.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).