summaryrefslogtreecommitdiff
path: root/libtrivfs/trivfs.h
diff options
context:
space:
mode:
authorSvante Signell <svante.signell@gmail.com>2019-10-29 23:59:23 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-10-30 00:04:35 +0100
commit14639382938714f07f76abd3d221c6d472710502 (patch)
tree53d96fbfdd7b80bac58f73244267c68a0058fbca /libtrivfs/trivfs.h
parentdd7447b87c6d6d1afaf25553b0f911853dcc6683 (diff)
libnetfs: Support for file record locking
2019-03-04 Svante Signell <svante.signell@gmail.com> * file-lock.c: Make flock work regardless of the mode in which the file was opened. 2019-02-12 Svante Signell <svante.signell@gmail.com> * file-lock.c: Comment out "Make flock work without R or W mode" 2019-02-01 Svante Signell <svante.signell@gmail.com> * Update copyright years. * file-record-lock.c(netfs_S_file_record_lock): Don't set rendezvous to MACH_PORT_NULL. 2017-01-05 Svante Signell <svante.signell@gmail.com> * Update copyright years and headers. * dir-lookup.c (netfs_S_dir_lookup): Call fshelp_rlock_tweak() with new last argument rendezvous = MACH_PORT_NULL. * file-lock.c (netfs_S_file_lock): Likewise. * file-record-lock.c (netfs_S_file_record_lock): Likewise. (netfs_S_file_record_lock): Add new argument mach_port_t rendezvous. 2016-05-23 Svante Signell <svante.signell@gmail.com> * netfs.h (struct peropen): Change the type of rlock_status from an int to a struct rlock_peropen. (struct node): Change the type of userbox from a struct lock_box to a struct rlock_box. * dir-lookup.c (netfs_S_dir_lookup): Use fshelp_rlock_tweak. * file-lock-stat.c (netfs_S_file_lock_stat): Total rewrite around the new record locking functions. * file-lock.c (netfs_S_file_lock): Likewise. * file-record-lock.c (netfs_S_file_record_lock): Likewise. * make-node.c (netfs_make_node): Initialize userbox with fshelp_rlock_init. * make-peropen.c (netfs_make_peropen): Initialize lock_status using fshelp_rlock_po_init. (netfs_make_peropen): Add a comment that po->refcnt starts at zero. * relese-peropen.c (netfs_release_peropen): Release lock_status using fshelp_rlock_drop_peropen. 2001-04-11 Neal H Walfield <neal@cs.uml.edu> * file-record-lock.c: New file. Implement netfs_S_file_record_lock. * Makefile (SRCS): Add file-record-lock.c
Diffstat (limited to 'libtrivfs/trivfs.h')
-rw-r--r--libtrivfs/trivfs.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h
index 1f0c5071..cdb1de8c 100644
--- a/libtrivfs/trivfs.h
+++ b/libtrivfs/trivfs.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994,95,96,97,99,2002,13 Free Software Foundation, Inc.
+ Copyright (C) 1994-1999, 2002, 2013-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -12,8 +12,8 @@
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+ along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>.
+*/
#ifndef __TRIVFS_H__
#define __TRIVFS_H__
@@ -24,6 +24,7 @@
#include <mach/mach.h>
#include <hurd/ports.h>
#include <hurd/iohelp.h>
+#include <hurd/fshelp.h>
#include <refcount.h>
struct trivfs_protid
@@ -45,6 +46,21 @@ struct trivfs_peropen
int openmodes;
refcount_t refcnt;
struct trivfs_control *cntl;
+
+ struct rlock_peropen lock_status;
+ struct trivfs_node *tp;
+};
+
+/* A unique one of these exists for each node currently in use. */
+struct trivfs_node
+{
+ pthread_mutex_t lock;
+
+ /* The number of references to this node. */
+ int references;
+
+ struct transbox transbox;
+ struct rlock_box credlock;
};
struct trivfs_control
@@ -170,9 +186,13 @@ trivfs_create_control (mach_port_t underlying,
void trivfs_clean_protid (void *);
void trivfs_clean_cntl (void *);
-/* This demultiplees messages for trivfs ports. */
+/* This demultiplexes messages for trivfs ports. */
int trivfs_demuxer (mach_msg_header_t *, mach_msg_header_t *);
+/* FIXME: Add descriptions */
+struct trivfs_node *trivfs_make_node (struct trivfs_peropen *po);
+struct trivfs_peropen *trivfs_make_peropen (struct trivfs_protid *cred);
+
/* Return a new protid pointing to a new peropen in CRED, with REALNODE as
the underlying node reference, with the given identity, and open flags in
FLAGS. CNTL is the trivfs control object. */