Implement the tmpfs_advlock operation. Makes "user-level" file locking
work (aka lockf(3)).
This commit is contained in:
parent
c9b506e88e
commit
b6d141c71c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tmpfs.h,v 1.7 2005/09/28 23:42:14 yamt Exp $ */
|
||||
/* $NetBSD: tmpfs.h,v 1.8 2005/09/29 19:48:21 jmmv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -145,6 +145,9 @@ struct tmpfs_node {
|
|||
struct timespec tn_birthtime;
|
||||
unsigned long tn_gen;
|
||||
|
||||
/* Head of byte-level lock list (used by tmpfs_advlock). */
|
||||
struct lockf * tn_lockf;
|
||||
|
||||
/* As there is a single vnode for each active file within the
|
||||
* system, care has to be taken to avoid allocating more than one
|
||||
* vnode per file. In order to do this, a bidirectional association
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tmpfs_vnops.c,v 1.14 2005/09/28 23:42:14 yamt Exp $ */
|
||||
/* $NetBSD: tmpfs_vnops.c,v 1.15 2005/09/29 19:48:21 jmmv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.14 2005/09/28 23:42:14 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.15 2005/09/29 19:48:21 jmmv Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/dirent.h>
|
||||
|
@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.14 2005/09/28 23:42:14 yamt Exp $"
|
|||
#include <sys/uio.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/lockf.h>
|
||||
|
||||
#include <uvm/uvm.h>
|
||||
|
||||
|
@ -1349,6 +1350,20 @@ tmpfs_pathconf(void *v)
|
|||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tmpfs_advlock(void *v)
|
||||
{
|
||||
struct vnode *vp = ((struct vop_advlock_args *)v)->a_vp;
|
||||
|
||||
struct tmpfs_node *node;
|
||||
|
||||
node = VP_TO_TMPFS_NODE(vp);
|
||||
|
||||
return lf_advlock(v, &node->tn_lockf, node->tn_size);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tmpfs_truncate(void *v)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tmpfs_vnops.h,v 1.4 2005/09/23 15:36:15 jmmv Exp $ */
|
||||
/* $NetBSD: tmpfs_vnops.h,v 1.5 2005/09/29 19:48:21 jmmv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -90,7 +90,7 @@ int tmpfs_reclaim (void *);
|
|||
int tmpfs_print (void *);
|
||||
int tmpfs_pathconf (void *);
|
||||
#define tmpfs_islocked genfs_islocked
|
||||
#define tmpfs_advlock genfs_eopnotsupp
|
||||
int tmpfs_advlock (void *);
|
||||
#define tmpfs_blkatoff genfs_eopnotsupp
|
||||
#define tmpfs_valloc genfs_eopnotsupp
|
||||
#define tmpfs_reallocblks genfs_eopnotsupp
|
||||
|
|
Loading…
Reference in New Issue