Message ID | 1465804155-14469-18-git-send-email-wei.liu2@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> On 13 Jun 2016, at 08:49, Wei Liu <wei.liu2@citrix.com> wrote: > > Generate a _paths.h for that and add proper dependency. > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: David Scott <dave@recoil.org> > --- > .gitignore | 1 + > tools/ocaml/xenstored/Makefile | 7 +++++++ > tools/ocaml/xenstored/systemd_stubs.c | 6 ++++-- > 3 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/.gitignore b/.gitignore > index 5914bbe..e019f2e 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -349,6 +349,7 @@ tools/ocaml/libs/xentoollog/_xtl_levels.* > tools/ocaml/libs/xentoollog/xentoollog.ml > tools/ocaml/libs/xentoollog/xentoollog.mli > tools/ocaml/libs/xs/paths.ml > +tools/ocaml/xenstored/_paths.h > tools/ocaml/xenstored/oxenstored > tools/ocaml/xenstored/oxenstored.conf > tools/ocaml/xenstored/paths.ml > diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile > index 939dcaa..1769e55 100644 > --- a/tools/ocaml/xenstored/Makefile > +++ b/tools/ocaml/xenstored/Makefile > @@ -30,6 +30,8 @@ systemd_OBJS = systemd > systemd_C_OBJS = systemd_stubs > OCAML_LIBRARY += systemd > > +$(foreach obj,$(systemd_C_OBJS),$(obj).o): _paths.h > + > LIBS_systemd += $(LDFLAGS-y) > > OBJS = paths \ > @@ -93,3 +95,8 @@ genpath-target = $(call buildmakevars2module,paths.ml) > $(eval $(genpath-target)) > > GENERATED_FILES += paths.ml > + > +genpath-target = $(call buildmakevars2header,_paths.h) > +$(eval $(genpath-target)) > + > +GENERATE_FILES += _paths.h > diff --git a/tools/ocaml/xenstored/systemd_stubs.c b/tools/ocaml/xenstored/systemd_stubs.c > index a78a72b..322f1e0 100644 > --- a/tools/ocaml/xenstored/systemd_stubs.c > +++ b/tools/ocaml/xenstored/systemd_stubs.c > @@ -28,6 +28,8 @@ > #include <sys/socket.h> > #include <systemd/sd-daemon.h> > > +#include "_paths.h" > + > /* Will work regardless of the order systemd gives them to us */ > static int oxen_get_sd_fd(const char *connect_to) > { > @@ -46,8 +48,8 @@ static int oxen_get_sd_fd(const char *connect_to) > > static int oxen_verify_socket_socket(const char *connect_to) > { > - if ((strcmp("/var/run/xenstored/socket_ro", connect_to) != 0) && > - (strcmp("/var/run/xenstored/socket", connect_to) != 0)) { > + if ((strcmp(XEN_RUN_STORED "/socket_ro", connect_to) != 0) && > + (strcmp(XEN_RUN_STORED "/socket", connect_to) != 0)) { > sd_notifyf(0, "STATUS=unexpected socket: %s\n" > "ERRNO=%i", > connect_to, > -- > 2.1.4 > This also looks fine to me Acked-by: David Scott <dave@recoil.org>
diff --git a/.gitignore b/.gitignore index 5914bbe..e019f2e 100644 --- a/.gitignore +++ b/.gitignore @@ -349,6 +349,7 @@ tools/ocaml/libs/xentoollog/_xtl_levels.* tools/ocaml/libs/xentoollog/xentoollog.ml tools/ocaml/libs/xentoollog/xentoollog.mli tools/ocaml/libs/xs/paths.ml +tools/ocaml/xenstored/_paths.h tools/ocaml/xenstored/oxenstored tools/ocaml/xenstored/oxenstored.conf tools/ocaml/xenstored/paths.ml diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile index 939dcaa..1769e55 100644 --- a/tools/ocaml/xenstored/Makefile +++ b/tools/ocaml/xenstored/Makefile @@ -30,6 +30,8 @@ systemd_OBJS = systemd systemd_C_OBJS = systemd_stubs OCAML_LIBRARY += systemd +$(foreach obj,$(systemd_C_OBJS),$(obj).o): _paths.h + LIBS_systemd += $(LDFLAGS-y) OBJS = paths \ @@ -93,3 +95,8 @@ genpath-target = $(call buildmakevars2module,paths.ml) $(eval $(genpath-target)) GENERATED_FILES += paths.ml + +genpath-target = $(call buildmakevars2header,_paths.h) +$(eval $(genpath-target)) + +GENERATE_FILES += _paths.h diff --git a/tools/ocaml/xenstored/systemd_stubs.c b/tools/ocaml/xenstored/systemd_stubs.c index a78a72b..322f1e0 100644 --- a/tools/ocaml/xenstored/systemd_stubs.c +++ b/tools/ocaml/xenstored/systemd_stubs.c @@ -28,6 +28,8 @@ #include <sys/socket.h> #include <systemd/sd-daemon.h> +#include "_paths.h" + /* Will work regardless of the order systemd gives them to us */ static int oxen_get_sd_fd(const char *connect_to) { @@ -46,8 +48,8 @@ static int oxen_get_sd_fd(const char *connect_to) static int oxen_verify_socket_socket(const char *connect_to) { - if ((strcmp("/var/run/xenstored/socket_ro", connect_to) != 0) && - (strcmp("/var/run/xenstored/socket", connect_to) != 0)) { + if ((strcmp(XEN_RUN_STORED "/socket_ro", connect_to) != 0) && + (strcmp(XEN_RUN_STORED "/socket", connect_to) != 0)) { sd_notifyf(0, "STATUS=unexpected socket: %s\n" "ERRNO=%i", connect_to,
Generate a _paths.h for that and add proper dependency. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: David Scott <dave@recoil.org> --- .gitignore | 1 + tools/ocaml/xenstored/Makefile | 7 +++++++ tools/ocaml/xenstored/systemd_stubs.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-)