Message ID | 20240104090055.27323-27-jgross@suse.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | tools: enable xenstore-stubdom to use 9pfs | expand |
On Thu, Jan 4, 2024 at 4:34 AM Juergen Gross <jgross@suse.com> wrote: > > Obtain the own domid when running as stubdom. Maybe "Obtain own domid when running as stubdom."? > > Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
Hi Juergen, On 04/01/2024 09:00, Juergen Gross wrote: > Obtain the own domid when running as stubdom. > > Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Julien Grall <jgrall@amazon.com> Cheers,
diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index 8ff1faccef..edb2ab97b8 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -2559,6 +2559,7 @@ static struct option options[] = { int dom0_domid = 0; int dom0_event = 0; int priv_domid = 0; +domid_t stub_domid = DOMID_INVALID; static unsigned int get_optval_uint(const char *arg) { diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index ddc345050c..a20c7ee3a0 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -363,6 +363,7 @@ do { \ extern int dom0_domid; extern int dom0_event; extern int priv_domid; +extern domid_t stub_domid; extern bool keep_orphans; extern struct pollfd *fds; diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c index 5d59cc90cc..38a51e671a 100644 --- a/tools/xenstored/minios.c +++ b/tools/xenstored/minios.c @@ -20,6 +20,7 @@ #include "core.h" #include "utils.h" #include <xen/grant_table.h> +#include <mini-os/lib.h> void finish_daemonize(void) { @@ -48,6 +49,9 @@ void unmap_xenbus(void *interface) void early_init(bool live_update, bool dofork, const char *pidfile) { + stub_domid = get_domid(); + if (stub_domid == DOMID_INVALID) + barf("could not get own domid"); } void late_init(bool live_update)
Obtain the own domid when running as stubdom. Signed-off-by: Juergen Gross <jgross@suse.com> --- V2: - replacement of V1 patch (Andrew Cooper) V3: - rename called function to get_domid() (Julien Grall) - change stub_domid type to domid_t (Julien Grall) --- tools/xenstored/core.c | 1 + tools/xenstored/core.h | 1 + tools/xenstored/minios.c | 4 ++++ 3 files changed, 6 insertions(+)