From 1d1da90042d2ee7a8215dc6291b54bc1ebe59fe4 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 6 May 2014 19:07:13 +0200 Subject: libtrivfs: lock-less reference counting for trivfs_peropen objects * libtrivfs/trivfs.h (struct trivfs_peropen): Use refcount_t for field refcnt. (struct trivfs_control): Remove unused field lock. * libtrivfs/cntl-create.c (trivfs_create_control): Drop the mutex initialization. * libtrivfs/io-reauthenticate.c (trivfs_S_io_reauthenticate): Adjust accordingly. * libtrivfs/io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise. * libtrivfs/open.c (trivfs_open): Initialize refcnt. * libtrivfs/protid-clean.c (trivfs_clean_protid): Likewise. * libtrivfs/protid-dup.c (trivfs_protid_dup): Likewise. --- libtrivfs/trivfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libtrivfs/trivfs.h') diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h index bb456ffa..89023383 100644 --- a/libtrivfs/trivfs.h +++ b/libtrivfs/trivfs.h @@ -24,6 +24,7 @@ #include #include #include +#include struct trivfs_protid { @@ -41,14 +42,13 @@ struct trivfs_peropen { void *hook; /* for user use */ int openmodes; - int refcnt; + refcount_t refcnt; struct trivfs_control *cntl; }; struct trivfs_control { struct port_info pi; - pthread_mutex_t lock; struct port_class *protid_class; struct port_bucket *protid_bucket; mach_port_t filesys_id; -- cgit v1.2.3