libtrivfs/ChangeLog 2019-09-10 Svante Signell * Disable this patch until all problems are solved. * trivfs.h: Don't use trivfs_node, trivfs_peropen. * make-node.c: Return NULL. * make-peropen.c: Return NULL. * file-lock.c: Return EOPNOTSUPP. * file-lock-stat.c: Return EOPNOTSUPP. * file-record-lock.c: Return EOPNOTSUPP. 2019-03-04 Svante Signell * file-lock.c: Make flock work regardless of the mode in which the file was opened. 2019-02-01 Svante Signell * Update copyright years. * file-lock.c(trivfs_S_file_record_lock): Don't set rendezvous to MACH_PORT_NULL. 2018-12-07 Svante Signell * Update copyright years and headers. * file-lock.c(trivfs_S_file_lock): Call fshelp_rlock_tweak() with new last argument rendezvous = MACH_PORT_NULL. * file-record-lock.c(trivfs_S_file_record_lock): Likewise. (trivfs_S_file_record_lock): Add new argument mach_port_t rendezvous. 2018-11-27 Svante Signell * make-peropen.c (trivfs_make_peropen): Initialize po->cntl * Update copyright years. 2015-12-17 Svante Signell * Makefile (OTHERSRCS): Add make-node.c make-peropen.c (FSSRCS): Add file-lock-stat.c * trivfs.h (trivfs_peropen): Add struct rlock_peropen lock_status, add struct trivfs_node *tp, include * make-node.c: New file. Implement init_node and trivfs_make_node. Call fshelp_transbox_init fshelp_rlock_init in init_node. * make-peropen.c: New file. Implement trivfs_make_peropen. Initialize trivfs_peropen lock_status with fshelp_rlock_po_init. * open.c (trivfs_open): Trim off a trailing whitespace. Update copyright header. * Split out file-lock-stat.c (trivfs_S_file_lock_stat) from file-lock.c to a separate file. * file-lock.c (trivfs_S_file_lock): Call trivfs_make_peropen and trivfs_make_node. Implement locking using the new record locking functions. * file-lock-stat.c (trivfs_S_file_lock_stat): Likewise 2001-04-11 Neal H Walfield * file-record-lock.c: New file. Implement trivfs_S_file_record_lock. * Makefile (FSSRCS): Add file-record-lock.c Index: hurd-0.9.git20190331-8.2/libtrivfs/Makefile =================================================================== --- hurd-0.9.git20190331-8.2.orig/libtrivfs/Makefile +++ hurd-0.9.git20190331-8.2/libtrivfs/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003, 2008, 2012 +# Copyright (C) 1994-1997, 1999, 2001-2003, 2008, 2012-2019 # Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or @@ -12,8 +12,7 @@ # 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 . dir := libtrivfs makemode := library @@ -22,7 +21,8 @@ FSSRCS= dir-link.c dir-mkdir.c dir-mkfil dir-rename.c dir-rmdir.c dir-unlink.c file-chauthor.c \ file-chflags.c file-chmod.c file-chown.c file-get-trans.c \ file-get-transcntl.c file-getcontrol.c file-getfh.c \ - file-getlinknode.c file-lock.c file-set-trans.c file-statfs.c \ + file-getlinknode.c file-lock.c file-lock-stat.c file-record-lock.c \ + file-set-trans.c file-statfs.c \ file-sync.c file-syncfs.c file-set-size.c file-utimes.c file-exec.c \ file-access.c dir-chg.c file-chg.c file-get-storage-info.c \ file-get-fs-options.c file-reparent.c \ @@ -38,7 +38,7 @@ FSYSSRCS=fsys-getroot.c fsys-goaway.c fs fsys-get-children.c fsys-get-source.c \ OTHERSRCS=demuxer.c protid-clean.c protid-dup.c cntl-create.c \ - cntl-clean.c times.c startup.c open.c \ + cntl-clean.c times.c startup.c make-node.c make-peropen.c open.c \ runtime-argp.c set-options.c append-args.c dyn-classes.c \ get-source.c Index: hurd-0.9.git20190331-8.2/libtrivfs/trivfs.h =================================================================== --- hurd-0.9.git20190331-8.2.orig/libtrivfs/trivfs.h +++ hurd-0.9.git20190331-8.2/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 . +*/ #ifndef __TRIVFS_H__ #define __TRIVFS_H__ @@ -24,6 +24,7 @@ #include #include #include +#include #include 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 under 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. */ Index: hurd-0.9.git20190331-8.2/libtrivfs/make-node.c =================================================================== --- /dev/null +++ hurd-0.9.git20190331-8.2/libtrivfs/make-node.c @@ -0,0 +1,33 @@ +/* + Copyright (C) 2016-2019 Free Software Foundation, Inc. + Written by Svante Signell + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . +*/ + +#include "priv.h" + +static struct trivfs_node * +init_node (struct trivfs_node *tp) +{ + return NULL; +} + +struct trivfs_node * +trivfs_make_node (struct trivfs_peropen *po) +{ + return NULL; +} Index: hurd-0.9.git20190331-8.2/libtrivfs/make-peropen.c =================================================================== --- /dev/null +++ hurd-0.9.git20190331-8.2/libtrivfs/make-peropen.c @@ -0,0 +1,29 @@ +/* + Copyright (C) 2016-2019 Free Software Foundation, Inc. + Written by Svante Signell + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . +*/ + +#include "priv.h" +#include +#include + +struct trivfs_peropen * +trivfs_make_peropen (struct trivfs_protid *cred) +{ + return NULL; +} Index: hurd-0.9.git20190331-8.2/libtrivfs/open.c =================================================================== --- hurd-0.9.git20190331-8.2.orig/libtrivfs/open.c +++ hurd-0.9.git20190331-8.2/libtrivfs/open.c @@ -1,6 +1,6 @@ /* Make a new trivfs peropen/protid - Copyright (C) 1993, 1994, 1995, 1996, 1999 Free Software Foundation, Inc. + Copyright (C) 1993-1996, 1999, 2018-2019 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -9,14 +9,13 @@ the Free Software Foundation; either version 2, or (at your option) any later version. - The GNU Hurd is distributed in the hope that it will be useful, + The GNU Hurd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with the GNU Hurd; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + along with the GNU Hurd. If not, see . */ #include /* For bcopy() */ Index: hurd-0.9.git20190331-8.2/libtrivfs/file-lock.c =================================================================== --- hurd-0.9.git20190331-8.2.orig/libtrivfs/file-lock.c +++ hurd-0.9.git20190331-8.2/libtrivfs/file-lock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1994,2002 Free Software Foundation, Inc. + Copyright (C) 1994, 2002, 2015-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,12 +12,15 @@ 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 . +*/ #include "priv.h" #include "trivfs_fs_S.h" +#include +#include + kern_return_t trivfs_S_file_lock (struct trivfs_protid *cred, mach_port_t reply, mach_msg_type_name_t reply_type, @@ -25,11 +28,3 @@ trivfs_S_file_lock (struct trivfs_protid { return EOPNOTSUPP; } - -kern_return_t -trivfs_S_file_lock_stat (struct trivfs_protid *cred, - mach_port_t reply, mach_msg_type_name_t reply_type, - int *mystatus, int *otherstat) -{ - return EOPNOTSUPP; -} Index: hurd-0.9.git20190331-8.2/libtrivfs/file-lock-stat.c =================================================================== --- /dev/null +++ hurd-0.9.git20190331-8.2/libtrivfs/file-lock-stat.c @@ -0,0 +1,30 @@ +/* + Copyright (C) 1994, 2002, 2015-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 + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . +*/ + +#include "priv.h" +#include "trivfs_fs_S.h" + +#include +#include + +kern_return_t +trivfs_S_file_lock_stat (struct trivfs_protid *cred, + mach_port_t reply, mach_msg_type_name_t reply_type, + int *mystatus, int *otherstatus) +{ + return EOPNOTSUPP; +} Index: hurd-0.9.git20190331-8.2/libtrivfs/file-record-lock.c =================================================================== --- /dev/null +++ hurd-0.9.git20190331-8.2/libtrivfs/file-record-lock.c @@ -0,0 +1,33 @@ +/* + Copyright (C) 2001, 2014-2019 Free Software Foundation + Written by Neal H Walfield + + This file is part of the GNU Hurd. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see . +*/ + +#include "priv.h" +/* #include "trivfs_fs_S.h" */ +#include + +kern_return_t +trivfs_S_file_record_lock (struct trivfs_protid *cred, + mach_port_t reply, + mach_msg_type_name_t reply_type, + int cmd, struct flock64 *lock, + mach_port_t rendezvous) +{ + return EOPNOTSUPP; +}