aboutsummaryrefslogtreecommitdiff
path: root/rt/include
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-01 23:41:11 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-01 23:41:11 -0700
commit418d2b2b0829ed17e523867896ea321fc2b3a79b (patch)
treeda0fad8ae1d46bb30ab2e2ea1fe4fa4f7c51aed6 /rt/include
parent1df0b552f17f15942a350def6736d5535e545d4c (diff)
downloadmontis-418d2b2b0829ed17e523867896ea321fc2b3a79b.tar.gz
montis-418d2b2b0829ed17e523867896ea321fc2b3a79b.tar.bz2
montis-418d2b2b0829ed17e523867896ea321fc2b3a79b.zip
[refactor] Remove the foregin interface.
The plugin will just call c functions through the FFI.
Diffstat (limited to 'rt/include')
-rw-r--r--rt/include/foreign_intf.h33
-rw-r--r--rt/include/plugin.h13
2 files changed, 4 insertions, 42 deletions
diff --git a/rt/include/foreign_intf.h b/rt/include/foreign_intf.h
deleted file mode 100644
index 6558fab..0000000
--- a/rt/include/foreign_intf.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Contains a structure, which contains functions to back-call into
- * the harness code. */
-
-#ifndef __FOREIGN_INTERFACE
-#define __FOREIGN_INTERFACE
-
-#define EXPORT(a) a
-
-typedef void *ctx_t;
-
-typedef struct FOREIGN_INTERFACE {
- /* DO NOT ADD ANY UNEXPORTED VARIABLES HERE */
-
- /* The context, which needs to be passed to each function. This context is
- * opaque to the plugin and should not be changed. */
- EXPORT(ctx_t ctx);
-
- /* Requests the harness hot reload the current plugin. */
- EXPORT(void (*request_hot_reload)(ctx_t ctx));
-
- /* Requests the harness hot reload the current plugin. */
- EXPORT(void (*do_log)(ctx_t ctx, const char *str));
-
- /* Requestes that the whole system exit. Exits with the given return code. */
- EXPORT(void (*request_exit)(ctx_t ctx, int rc));
-
- /* Returns the seat associated with the server. */
- EXPORT(void *(*get_seat)(ctx_t ctx));
-} foreign_interface_t;
-
-#undef EXPORT
-
-#endif /* __FOREIGN_INTERFACE */
diff --git a/rt/include/plugin.h b/rt/include/plugin.h
index 4d69d76..16823e8 100644
--- a/rt/include/plugin.h
+++ b/rt/include/plugin.h
@@ -5,13 +5,11 @@
#include <linux/limits.h>
#include <pthread.h>
#include <stdint.h>
-#include <stdlib.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_pointer.h>
#include "plugin_types.h"
-#include <foreign_intf.h>
/*
* Marker macro to define what functions should be exported. This generates the
@@ -22,7 +20,6 @@
#define EXPORT_INCLUDE(a)
// clang-format off
-EXPORT_INCLUDE(<foreign_intf.h>)
EXPORT_INCLUDE(<wlr/types/wlr_keyboard.h>)
EXPORT_INCLUDE(<wlr/types/wlr_input_device.h>)
EXPORT_INCLUDE(<wlr/types/wlr_pointer.h>)
@@ -61,9 +58,6 @@ typedef struct PLUGIN {
/* Filename the plugin is loaded from. */
char filename[PATH_MAX];
- /* Interface to the harness that this plugin can use. */
- foreign_interface_t foreign_intf;
-
/* Opaque state of this plugin. The state is usually some kind of pointer to
* the plugin state, but all the harness knows is the opaque state is a
* pointer-sized piece of data.
@@ -104,7 +98,7 @@ typedef struct PLUGIN {
/** Intializes the plugin with the given argc/argv. This is the first thing
* called on the plugin and is called immediately after the library is loaded.
*/
- EXPORT(void (*plugin_load)(int argc, char **argv, foreign_interface_t *intf));
+ EXPORT(void (*plugin_load)(int argc, char **argv));
/* Start the plugin with the marshalled state from the previous plugin.
*
@@ -115,13 +109,14 @@ typedef struct PLUGIN {
* hot-reloading can produce incompatibilities between the old state and the
* new state, and this should not cause a failure.
*/
- EXPORT(opqst_t (*plugin_hot_start)(uint8_t *mashalled_state, uint32_t n));
+ EXPORT(opqst_t (*plugin_hot_start)(void *self, uint8_t *mashalled_state,
+ uint32_t n));
/*
* Starts the plugin without a marshalled state. Happens during the first boot
* when there is not state.
*/
- EXPORT(opqst_t (*plugin_cold_start)());
+ EXPORT(opqst_t (*plugin_cold_start)(void* self));
/*
* Marshals the state to a bytestring. The returned pointer should be malloc'd