From: Juergen Gross Subject: [PATCH 8/9] xenstore: write xenstore domain data to xenstore Date: Fri, 11 Dec 2015 16:47:40 +0100 Message-ID: <1449848861-7700-9-git-send-email-jgross@suse.com> References: <1449848861-7700-1-git-send-email-jgross@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1449848861-7700-1-git-send-email-jgross@suse.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org, Ian.Campbell@citrix.com, ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com, wei.liu2@citrix.com Cc: Juergen Gross List-Id: xen-devel@lists.xenproject.org After starting the xenstore domain write the basic data (domid and name) to the xenstore. Add a new option to init-xenstore-domain to be able to specify the domain's name. Signed-off-by: Juergen Gross --- tools/xenstore/init-xenstore-domain.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/init-xenstore-domain.c b/tools/xenstore/init-xenstore-domain.c index eedcf32..2a8a417 100644 --- a/tools/xenstore/init-xenstore-domain.c +++ b/tools/xenstore/init-xenstore-domain.c @@ -18,6 +18,7 @@ static char *kernel; static char *ramdisk; static char *flask; static char *param; +static char *name = "Xenstore"; static int memory; static struct option options[] = { @@ -26,6 +27,7 @@ static struct option options[] = { { "flask", 1, NULL, 'f' }, { "ramdisk", 1, NULL, 'r' }, { "param", 1, NULL, 'p' }, + { "name", 1, NULL, 'n' }, { NULL, 0, NULL, 0 } }; @@ -42,7 +44,8 @@ static void usage(void) " --memory size of the domain in MB, mandatory\n" " --flask optional flask label of the domain\n" " --ramdisk optional ramdisk file for the domain\n" -" --param optional additional parameters for the domain\n"); +" --param optional additional parameters for the domain\n" +" --name name of the domain (default: Xenstore)\n"); } static int build(xc_interface *xch) @@ -195,6 +198,7 @@ int main(int argc, char** argv) xc_interface *xch; struct xs_handle *xsh; char buf[16]; + char path[64]; int rv, fd; while ((opt = getopt_long(argc, argv, "", options, NULL)) != -1) { @@ -214,6 +218,9 @@ int main(int argc, char** argv) case 'p': param = optarg; break; + case 'n': + name = optarg; + break; } } @@ -243,6 +250,10 @@ int main(int argc, char** argv) xsh = xs_open(0); rv = snprintf(buf, 16, "%d", domid); xs_write(xsh, XBT_NULL, "/tool/xenstored/domid", buf, rv); + snprintf(path, 64, "/local/domain/%d/domid", domid); + xs_write(xsh, XBT_NULL, path, buf, rv); + snprintf(path, 64, "/local/domain/%d/name", domid); + xs_write(xsh, XBT_NULL, path, name, strlen(name)); xs_daemon_close(xsh); fd = creat("/var/run/xenstored.pid", 0666); -- 2.6.2