summaryrefslogtreecommitdiff
path: root/lib9p
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-29 01:02:02 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-29 01:40:02 -0600
commit7ff738390e55d57a0f513c467a9da3b08c6902ab (patch)
tree384bd03462a9790c9c747b895cf5de0677659db7 /lib9p
parentaffe77a2b068a9de236f0d7703092dbfafacff5e (diff)
Add a way to make private object members
Diffstat (limited to 'lib9p')
-rw-r--r--lib9p/include/lib9p/srv.h20
-rw-r--r--lib9p/srv.c16
2 files changed, 25 insertions, 11 deletions
diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h
index 0617e57..ab7ec43 100644
--- a/lib9p/include/lib9p/srv.h
+++ b/lib9p/include/lib9p/srv.h
@@ -11,6 +11,7 @@
#include <libcr_ipc/rpc.h>
#include <libcr_ipc/chan.h>
#include <libhw/generic/net.h>
+#include <libmisc/private.h>
#include <lib9p/9p.h>
@@ -23,21 +24,14 @@ struct lib9p_srv_ctx {
uint32_t uid;
char *uname;
+ BEGIN_PRIVATE(LIB9P_SRV_H)
_lib9p_srv_flushch_t _flushch;
+ END_PRIVATE(LIB9P_SRV_H)
};
-static inline bool lib9p_srv_flush_requested(struct lib9p_srv_ctx *ctx) {
- assert(ctx);
- return _lib9p_srv_flushch_can_send(&ctx->_flushch);
-}
+bool lib9p_srv_flush_requested(struct lib9p_srv_ctx *ctx);
-static inline int lib9p_srv_acknowledge_flush(struct lib9p_srv_ctx *ctx) {
- assert(ctx);
- assert(_lib9p_srv_flushch_can_send(&ctx->_flushch));
- lib9p_error(&ctx->basectx, LINUX_ECANCELED, "request canceled by flush");
- _lib9p_srv_flushch_send(&ctx->_flushch, true);
- return -1;
-}
+int lib9p_srv_acknowledge_flush(struct lib9p_srv_ctx *ctx);
/* interface definitions ******************************************************/
@@ -47,6 +41,7 @@ struct __lib9p_srv_file;
typedef struct __lib9p_srv_file {
struct lib9p_srv_file_vtable *vtable;
+ BEGIN_PRIVATE(LIB9P_SRV_H)
/* Managed by srv.c, but should be cloned by ->vtable->clone(). */
struct __lib9p_srv_file *_parent_dir; /* clone this
@@ -54,6 +49,7 @@ typedef struct __lib9p_srv_file {
/* ref type 1: an entry in fidmap
* ref type 2: ->_parent_dir of another file */
unsigned int _refcount;
+ END_PRIVATE(LIB9P_SRV_H)
} implements_lib9p_srv_file;
struct lib9p_srv_file_vtable {
@@ -103,7 +99,9 @@ struct lib9p_srv {
implements_lib9p_srv_file *(*rootdir)(struct lib9p_srv_ctx *, char *treename);
/* For internal use */
+ BEGIN_PRIVATE(LIB9P_SRV_H)
_lib9p_srv_reqch_t _reqch;
+ END_PRIVATE(LIB9P_SRV_H)
};
/**
diff --git a/lib9p/srv.c b/lib9p/srv.c
index 3a3807c..9192794 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -16,9 +16,25 @@
#include <libcr_ipc/select.h>
#include <libmisc/vcall.h>
+#define IMPLEMENTATION_FOR_LIB9P_SRV_H YES
#include <lib9p/srv.h>
#include "internal.h"
+/* context ********************************************************************/
+
+bool lib9p_srv_flush_requested(struct lib9p_srv_ctx *ctx) {
+ assert(ctx);
+ return _lib9p_srv_flushch_can_send(&ctx->_flushch);
+}
+
+int lib9p_srv_acknowledge_flush(struct lib9p_srv_ctx *ctx) {
+ assert(ctx);
+ assert(_lib9p_srv_flushch_can_send(&ctx->_flushch));
+ lib9p_error(&ctx->basectx, LINUX_ECANCELED, "request canceled by flush");
+ _lib9p_srv_flushch_send(&ctx->_flushch, true);
+ return -1;
+}
+
/* structs ********************************************************************/
#define FIDFLAG_OPEN_R (1<<0)