Xnamespace: add basic namespace config structures
Adding data structure and initial data for namespace configuration. Built-in namespaces are ROOT and ANONYMOUS. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
f6e190f3a9
commit
bc4c35d045
|
@ -0,0 +1,39 @@
|
|||
#include <dix-config.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <X11/Xdefs.h>
|
||||
|
||||
#include "namespace.h"
|
||||
|
||||
struct Xnamespace ns_root = {
|
||||
.builtin = TRUE,
|
||||
.name = NS_NAME_ROOT,
|
||||
.refcnt = 1,
|
||||
.superPower = TRUE,
|
||||
};
|
||||
|
||||
struct Xnamespace ns_anon = {
|
||||
.builtin = TRUE,
|
||||
.name = NS_NAME_ANONYMOUS,
|
||||
.refcnt = 1,
|
||||
};
|
||||
|
||||
struct xorg_list ns_list = { 0 };
|
||||
|
||||
Bool XnsLoadConfig(void)
|
||||
{
|
||||
xorg_list_init(&ns_list);
|
||||
xorg_list_add(&ns_root.entry, &ns_list);
|
||||
xorg_list_add(&ns_anon.entry, &ns_list);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct Xnamespace *XnsFindByName(const char* name) {
|
||||
struct Xnamespace *walk;
|
||||
xorg_list_for_each_entry(walk, &ns_list, entry) {
|
||||
if (strcmp(walk->name, name)==0)
|
||||
return walk;
|
||||
}
|
||||
return NULL;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
libxserver_namespace = static_library(
|
||||
'libxserver_namespace',
|
||||
[
|
||||
'config.c',
|
||||
'namespace.c',
|
||||
],
|
||||
include_directories: inc,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <dix-config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/Xmd.h>
|
||||
|
||||
#include "include/extinit_priv.h"
|
||||
|
@ -13,4 +14,10 @@ void
|
|||
NamespaceExtensionInit(void)
|
||||
{
|
||||
XNS_LOG("initializing namespace extension ...\n");
|
||||
|
||||
/* load configuration */
|
||||
if (!XnsLoadConfig()) {
|
||||
XNS_LOG("No config file. disabling Xns extension\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,27 @@
|
|||
#include <stdio.h>
|
||||
#include <X11/Xmd.h>
|
||||
|
||||
#include "include/list.h"
|
||||
#include "include/window.h"
|
||||
|
||||
struct Xnamespace {
|
||||
struct xorg_list entry;
|
||||
const char *name;
|
||||
Bool builtin;
|
||||
Bool superPower;
|
||||
size_t refcnt;
|
||||
};
|
||||
|
||||
extern struct xorg_list ns_list;
|
||||
extern struct Xnamespace ns_root;
|
||||
extern struct Xnamespace ns_anon;
|
||||
|
||||
#define NS_NAME_ROOT "root"
|
||||
#define NS_NAME_ANONYMOUS "anon"
|
||||
|
||||
Bool XnsLoadConfig(void);
|
||||
struct Xnamespace *XnsFindByName(const char* name);
|
||||
|
||||
#define XNS_LOG(...) do { printf("XNS "); printf(__VA_ARGS__); } while (0)
|
||||
|
||||
static inline Bool streq(const char *a, const char *b)
|
||||
|
|
Loading…
Reference in New Issue