tools/xenstore: drop support for running under SunOS
authorJuergen Gross <jgross@suse.com>
Fri, 17 Dec 2021 07:50:59 +0000 (08:50 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 17 Dec 2021 11:48:52 +0000 (11:48 +0000)
Since several years now xenstored is no longer capable to run under
SunOS, as the needed libxengnttab interfaces are not available there.

Several attempts to let the SunOS maintainers address this situation
didn't change anything in this regard.

For those reasons drop SunOS support in xenstored by removing the SunOS
specific code.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
tools/xenstore/Makefile
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_core.h
tools/xenstore/xenstored_minios.c
tools/xenstore/xenstored_posix.c
tools/xenstore/xenstored_probes.d [deleted file]
tools/xenstore/xenstored_solaris.c [deleted file]

index 292b478fa1ab6fcb99a66c785af1987e509541af..c86278fdb1bef28b475b9cdc51e3e48ecaa8e1ef 100644 (file)
@@ -27,7 +27,6 @@ XENSTORED_OBJS += xenstored_transaction.o xenstored_control.o
 XENSTORED_OBJS += xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
 XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
 XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_FreeBSD) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
@@ -50,18 +49,6 @@ all: $(ALL_TARGETS)
 .PHONY: clients
 clients: xenstore $(CLIENTS) xenstore-control
 
-ifeq ($(CONFIG_SunOS),y)
-xenstored_probes.h: xenstored_probes.d
-       dtrace -C -h -s xenstored_probes.d
-
-xenstored_solaris.o: xenstored_probes.h
-
-xenstored_probes.o: xenstored_solaris.o
-       dtrace -C -G -s xenstored_probes.d xenstored_solaris.o 
-
-CFLAGS += -DHAVE_DTRACE=1
-endif
-
 ifeq ($(CONFIG_SYSTEMD),y)
 $(XENSTORED_OBJS): CFLAGS += $(SYSTEMD_CFLAGS)
 xenstored: LDFLAGS += $(SYSTEMD_LIBS)
@@ -89,7 +76,7 @@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
 
 .PHONY: clean
 clean:
-       rm -f *.a *.o xenstored_probes.h
+       rm -f *.a *.o
        rm -f xenstored
        rm -f xs_tdb_dump xenstore-control init-xenstore-domain
        rm -f xenstore $(CLIENTS)
index 91d093a12ea6840684fa5b85fd9fb0a360480dc7..c386ae6129bdb73f720a5318235cf75f9f164876 100644 (file)
@@ -146,10 +146,6 @@ static void trace_io(const struct connection *conn,
        time_t now;
        struct tm *tm;
 
-#ifdef HAVE_DTRACE
-       dtrace_io(conn, data, out);
-#endif
-
        if (tracefd < 0)
                return;
 
@@ -2337,9 +2333,6 @@ int main(int argc, char *argv[])
        /* Get ready to listen to the tools. */
        initialize_fds(&sock_pollfd_idx, &timeout);
 
-       /* Tell the kernel we're up and running. */
-       xenbus_notify_running();
-
 #if defined(XEN_SYSTEMD_ENABLED)
        if (!live_update) {
                sd_notify(1, "READY=1");
index 07d861d9249952b1b75cbe7aa107bb709ded7b9a..190d2447cd7468b1497376f30ff67b1de102ce35 100644 (file)
@@ -225,7 +225,6 @@ int delay_request(struct connection *conn, struct buffered_data *in,
 void trace_create(const void *data, const char *type);
 void trace_destroy(const void *data, const char *type);
 void trace(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
-void dtrace_io(const struct connection *conn, const struct buffered_data *data, int out);
 void reopen_log(void);
 void close_log(void);
 
@@ -250,9 +249,6 @@ static inline int xenbus_master_domid(void) { return dom0_domid; }
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
 
-/* Tell the kernel xenstored is running. */
-void xenbus_notify_running(void);
-
 /* Write out the pidfile */
 void write_pidfile(const char *pidfile);
 
index c94493e52a5f6f4820228e47e886fe5438b7a395..aa384e50c8fec8297d9870ab3f8c9275fd20babd 100644 (file)
@@ -38,10 +38,6 @@ void init_pipe(int reopen_log_pipe[2])
        reopen_log_pipe[1] = -1;
 }
 
-void xenbus_notify_running(void)
-{
-}
-
 evtchn_port_t xenbus_evtchn(void)
 {
        return dom0_event;
index 48c37ffe3e030627123b9626d982bafde15f3adf..b20504d1b656b004e5d0dd5cc77cef80d24d9f7f 100644 (file)
@@ -111,7 +111,6 @@ void unmap_xenbus(void *interface)
        munmap(interface, getpagesize());
 }
 
-#ifndef __sun__
 evtchn_port_t xenbus_evtchn(void)
 {
        int fd;
@@ -158,8 +157,3 @@ void *xenbus_map(void)
 
        return addr;
 }
-
-void xenbus_notify_running(void)
-{
-}
-#endif /* !__sun__ */
diff --git a/tools/xenstore/xenstored_probes.d b/tools/xenstore/xenstored_probes.d
deleted file mode 100644 (file)
index f72d38f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2 of the License.
- */
-
-#include <sys/types.h>
-
-provider xenstore {
-       /* tx id, dom id, pid, type, msg */
-       probe msg(uint32_t, unsigned int, pid_t, int, const char *);
-       /* tx id, dom id, pid, type, reply */
-       probe reply(uint32_t, unsigned int, pid_t, int, const char *);
-       /* tx id, dom id, pid, reply */
-       probe error(uint32_t, unsigned int, pid_t, const char *);
-       /* dom id, pid, watch details */
-       probe watch_event(unsigned int, pid_t, const char *);
-};
-
-#pragma D attributes Evolving/Evolving/Common provider xenstore provider
-#pragma D attributes Private/Private/Unknown provider xenstore module
-#pragma D attributes Private/Private/Unknown provider xenstore function
-#pragma D attributes Evolving/Evolving/Common provider xenstore name
-#pragma D attributes Evolving/Evolving/Common provider xenstore args
-
diff --git a/tools/xenstore/xenstored_solaris.c b/tools/xenstore/xenstored_solaris.c
deleted file mode 100644 (file)
index 06052d1..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (C) 2005 Rusty Russell IBM Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, version 2 of the
- * License.
- */
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-#include <strings.h>
-#include <ucred.h>
-#include <stdio.h>
-
-#include <xen/sys/xenbus.h>
-
-#include "talloc.h"
-#include "xenstored_core.h"
-#include "xenstored_probes.h"
-
-evtchn_port_t xenbus_evtchn(void)
-{
-       int fd;
-       evtchn_port_t port; 
-
-       fd = open("/dev/xen/xenbus", O_RDONLY); 
-       if (fd == -1)
-               return -1;
-
-       port = ioctl(fd, IOCTL_XENBUS_XENSTORE_EVTCHN);
-
-       close(fd); 
-       return port;
-}
-
-void *xenbus_map(void)
-{
-       int fd;
-       void *addr;
-
-       fd = open("/dev/xen/xenbus", O_RDWR);
-       if (fd == -1)
-               return NULL;
-
-       addr = mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE,
-               MAP_SHARED, fd, 0);
-
-       if (addr == MAP_FAILED)
-               addr = NULL;
-
-       close(fd);
-
-       return addr;
-}
-
-void xenbus_notify_running(void)
-{
-       int fd;
-
-       fd = open("/dev/xen/xenbus", O_RDONLY);
-
-       (void) ioctl(fd, IOCTL_XENBUS_NOTIFY_UP);
-
-       close(fd);
-}
-
-static pid_t cred(const struct connection *conn)
-{
-       ucred_t *ucred = NULL;
-       pid_t pid;
-
-       if (conn->domain)
-               return (0);
-
-       if (getpeerucred(conn->fd, &ucred) == -1)
-               return (0);
-
-       pid = ucred_getpid(ucred);
-
-       ucred_free(ucred);
-       return (pid);
-}
-
-/*
- * The strings are often a number of nil-separated strings. We'll just
- * replace the separators with spaces - not quite right, but good
- * enough.
- */
-static char *
-mangle(const struct connection *conn, const struct buffered_data *in)
-{
-       char *str;
-       int i;
-
-       if (in->hdr.msg.len == 0)
-               return (talloc_strdup(conn, ""));
-
-       if ((str = talloc_zero_size(conn, in->hdr.msg.len + 1)) == NULL)
-               return (NULL);
-
-       memcpy(str, in->buffer, in->hdr.msg.len);
-       
-       /*
-        * The protocol is absurdly inconsistent in whether the length
-        * includes the terminating nil or not; replace all nils that
-        * aren't the last one.
-        */
-       for (i = 0; i < (in->hdr.msg.len - 1); i++) {
-               if (str[i] == '\0')
-                       str[i] = ' ';
-       }
-
-       return (str);
-}
-
-void
-dtrace_io(const struct connection *conn, const struct buffered_data *in,
-    int io_out)
-{
-       if (!io_out) {
-               if (XENSTORE_MSG_ENABLED()) {
-                       char *mangled = mangle(conn, in);
-                       XENSTORE_MSG(in->hdr.msg.tx_id, conn->id, cred(conn),
-                           in->hdr.msg.type, mangled);
-               }
-
-               goto out;
-       }
-
-       switch (in->hdr.msg.type) {
-       case XS_ERROR:
-               if (XENSTORE_ERROR_ENABLED()) {
-                       char *mangled = mangle(conn, in);
-                       XENSTORE_ERROR(in->hdr.msg.tx_id, conn->id,
-                           cred(conn), mangled);
-               }
-               break;
-
-       case XS_WATCH_EVENT:
-               if (XENSTORE_WATCH_EVENT_ENABLED()) {
-                       char *mangled = mangle(conn, in);
-                       XENSTORE_WATCH_EVENT(conn->id, cred(conn), mangled);
-               }
-               break;
-
-       default:
-               if (XENSTORE_REPLY_ENABLED()) {
-                       char *mangled = mangle(conn, in);
-                       XENSTORE_REPLY(in->hdr.msg.tx_id, conn->id, cred(conn),
-                           in->hdr.msg.type, mangled);
-               }
-               break;
-       }
-
-out:
-       /*
-        * 6589130 dtrace -G fails for certain tail-calls on x86
-        */
-       asm("nop");
-}