From a25ab8432dcf15d7d43adbc429a7cd9b493b3d91 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 4 Feb 2025 08:57:14 -0700 Subject: lib9p: srv: Use a separate pathmap --- lib9p/include/lib9p/srv.h | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'lib9p/include') diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h index d45d9a4..e9d2d7b 100644 --- a/lib9p/include/lib9p/srv.h +++ b/lib9p/include/lib9p/srv.h @@ -37,29 +37,18 @@ int lib9p_srv_acknowledge_flush(struct lib9p_srv_ctx *ctx); struct lib9p_srv_file_vtable; -struct __lib9p_srv_file; -typedef struct __lib9p_srv_file { +typedef struct { 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 - - /* Managed by srv.c, but should be initialized to 0 by ->vtable->clone(). */ - /* 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 { /* all - resource management */ - implements_lib9p_srv_file *(*clone )(implements_lib9p_srv_file *, struct lib9p_srv_ctx *); - void (*free )(implements_lib9p_srv_file *, struct lib9p_srv_ctx *); + void (*free )(implements_lib9p_srv_file *); /* must not error */ + struct lib9p_qid (*qid )(implements_lib9p_srv_file *); /* must not error */ + uint32_t (*chio )(implements_lib9p_srv_file *, struct lib9p_srv_ctx *, + bool rd, bool wr, bool trunc); /* all - syscalls */ - uint32_t (*io )(implements_lib9p_srv_file *, struct lib9p_srv_ctx *, - lib9p_o_t flags); struct lib9p_stat (*stat )(implements_lib9p_srv_file *, struct lib9p_srv_ctx *); void (*wstat )(implements_lib9p_srv_file *, struct lib9p_srv_ctx *, struct lib9p_stat new); -- cgit v1.2.3-2-g168b