Update to 4.4-Lite fs code, with local changes.

This commit is contained in:
mycroft 1994-06-08 11:38:34 +00:00
parent 0c51ee36cb
commit 28f7af34be
7 changed files with 476 additions and 332 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)dir.h 8.1 (Berkeley) 6/2/93
* $Id: dirent.h,v 1.5 1994/05/23 01:14:59 cgd Exp $
* $Id: dirent.h,v 1.6 1994/06/08 11:38:34 mycroft Exp $
*/
/*
@ -48,12 +48,8 @@
struct dirent {
unsigned long d_fileno; /* file number of entry */
unsigned short d_reclen; /* length of this record */
#ifdef notdef
unsigned char d_type; /* file type, see below */
unsigned char d_namlen; /* length of string in d_name */
#else
unsigned short d_namlen; /* length of string in d_name */
#endif
#ifdef _POSIX_SOURCE
char d_name[255 + 1]; /* name must be no longer than this */
#else
@ -62,7 +58,6 @@ struct dirent {
#endif
};
#ifdef notyet
/*
* File types
*/
@ -80,4 +75,3 @@ struct dirent {
*/
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
#endif

View File

@ -1,6 +1,6 @@
/*-
* Copyright (c) 1983, 1990 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
@ -35,8 +35,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)fcntl.h 5.14 (Berkeley) 7/1/91
* $Id: fcntl.h,v 1.4 1994/05/17 04:25:00 cgd Exp $
* from: @(#)fcntl.h 8.3 (Berkeley) 1/21/94
* $Id: fcntl.h,v 1.5 1994/06/08 11:38:38 mycroft Exp $
*/
#ifndef _SYS_FCNTL_H_
@ -65,11 +65,15 @@
#define O_RDWR 0x0002 /* open for reading and writing */
#define O_ACCMODE 0x0003 /* mask for above modes */
#ifdef KERNEL
/*
* Kernel encoding of open mode; separate read and write bits
* that are independently testable: 1 greater than the above.
* Kernel encoding of open mode; separate read and write bits that are
* independently testable: 1 greater than the above.
*
* XXX
* FREAD and FWRITE are excluded from the #ifdef KERNEL so that TIOCFLUSH,
* which was documented to use FREAD/FWRITE, continues to work.
*/
#ifndef _POSIX_SOURCE
#define FREAD 0x0001
#define FWRITE 0x0002
#endif
@ -154,11 +158,11 @@
* information passed to system by user
*/
struct flock {
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
off_t l_start; /* starting offset */
off_t l_len; /* len = 0 means until end of file */
pid_t l_pid; /* lock owner */
short l_type; /* lock type: read/write, etc. */
short l_whence; /* type of l_start */
};

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: lkm.h,v 1.4 1994/05/05 09:43:58 mycroft Exp $
* $Id: lkm.h,v 1.5 1994/06/08 11:38:41 mycroft Exp $
*/
#ifndef _SYS_LKM_H_
@ -80,7 +80,9 @@ struct lkm_vfs {
int lkm_ver;
char *lkm_name;
u_long lkm_offset;
#if 0
u_long lkm_flags;
#endif
struct vfsops *lkm_vfsops;
};

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -30,12 +30,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)mount.h 7.22 (Berkeley) 6/3/91
* $Id: mount.h,v 1.30 1994/05/11 18:50:39 chopps Exp $
* from: @(#)mount.h 8.13 (Berkeley) 3/27/94
* $Id: mount.h,v 1.31 1994/06/08 11:38:45 mycroft Exp $
*/
#ifndef _SYS_MOUNT_H_
#define _SYS_MOUNT_H_
#ifndef KERNEL
#include <sys/ucred.h>
#endif
#include <sys/queue.h>
typedef struct { long val[2]; } fsid_t; /* file system id type */
@ -79,27 +80,27 @@ struct statfs {
/*
* File system types.
*/
#define MOUNT_EXPORT ((char *)0) /* use this for exporting (mountd) */
#define MOUNT_UFS "ufs" /* UNIX "Fast" Filesystem */
#define MOUNT_NFS "nfs" /* Network Filesystem */
#define MOUNT_MFS "mfs" /* Memory Filesystem */
#define MOUNT_MSDOS "msdos" /* MSDOS Filesystem */
#define MOUNT_ISOFS "isofs" /* iso9660 cdrom */
#define MOUNT_FDESC "fdesc" /* /dev/fd filesystem */
#define MOUNT_KERNFS "kernfs" /* kernel variable filesystem */
/* XXX SLOT 8 IS CURRENTLY EMPTY */
/* XXX SLOT 9 IS CURRENTLY EMPTY */
#define MOUNT_PROCFS "procfs" /* proc filesystem */
#define MOUNT_LOFS "lofs" /* loopback filesystem */
#define MOUNT_PORTAL "portal" /* portal filesystem */
#define MOUNT_ADOSFS "adosfs" /* amigados filesystem */
#define MOUNT_LFS "lfs" /* Log-based Filesystem */
#define MOUNT_LOFS "lofs" /* Loopback filesystem */
#define MOUNT_FDESC "fdesc" /* File Descriptor Filesystem */
#define MOUNT_PORTAL "portal" /* Portal Filesystem */
#define MOUNT_NULL "null" /* Minimal Filesystem Layer */
#define MOUNT_UMAP "umap" /* User/Group Identifier Remapping Filesystem */
#define MOUNT_KERNFS "kernfs" /* Kernel Information Filesystem */
#define MOUNT_PROCFS "procfs" /* /proc Filesystem */
#define MOUNT_AFS "afs" /* Andrew Filesystem */
#define MOUNT_CD9660 "cd9660" /* ISO9660 (aka CDROM) Filesystem */
#define MOUNT_UNION "union" /* Union (translucent) Filesystem */
#define MOUNT_ADOSFS "adosfs" /* AmigaDOS Filesystem */
/*
* Structure per mounted file system.
* Each mounted file system has an array of
* operations and an instance record.
* The file systems are put on a doubly linked list.
* Structure per mounted file system. Each mounted file system has an
* array of operations and an instance record. The file systems are
* put on a doubly linked list.
*/
LIST_HEAD(vnodelst, vnode);
@ -109,7 +110,7 @@ struct mount {
struct vnode *mnt_vnodecovered; /* vnode we mounted on */
struct vnodelst mnt_vnodelist; /* list of vnodes this mount */
int mnt_flag; /* flags */
uid_t mnt_exroot; /* exported mapping for uid 0 */
int mnt_maxsymlinklen; /* max size of short symlink */
struct statfs mnt_stat; /* cache of filesystem stats */
qaddr_t mnt_data; /* private data */
};
@ -125,19 +126,23 @@ struct mount {
#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
#define MNT_NODEV 0x00000010 /* don't interpret special files */
#define MNT_UNION 0x00000020 /* union with underlying filesystem */
#define MNT_NOCREATE 0x00000040 /* don't allow filename creation */
#define MNT_ASYNC 0x00000040 /* file system written asynchronously */
/*
* exported mount flags.
*/
#define MNT_EXRDONLY 0x00000080 /* exported read only */
#define MNT_EXPORTED 0x00000100 /* file system is exported */
#define MNT_EXRDONLY 0x00000200 /* exported read only */
#define MNT_DEFEXPORTED 0x00000200 /* exported to the world */
#define MNT_EXPORTANON 0x00000400 /* use anon uid mapping for everyone */
#define MNT_EXKERB 0x00000800 /* exported with Kerberos uid mapping */
/*
* Flags set by internal operations.
*/
#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
#define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
#define MNT_USER 0x00008000 /* mounted by a user */
/*
@ -153,11 +158,15 @@ struct mount {
* and unmounts.
*/
#define MNT_UPDATE 0x00010000 /* not a real mount, just an update */
#define MNT_DELEXPORT 0x00020000 /* delete export host lists */
#define MNT_RELOAD 0x00040000 /* reload filesystem data */
#define MNT_FORCE 0x00080000 /* force unmount or readonly change */
#define MNT_MLOCK 0x00100000 /* lock so that subtree is stable */
#define MNT_MWAIT 0x00200000 /* someone is waiting for lock */
#define MNT_MPBUSY 0x00400000 /* scan of mount point in progress */
#define MNT_MPWANT 0x00800000 /* waiting for mount point */
#define MNT_UNMOUNT 0x01000000 /* unmount in progress */
#define MNT_WANTRDWR 0x02000000 /* want upgrade to read/write */
/*
* Operations supported on mounted file system.
@ -165,6 +174,7 @@ struct mount {
#ifdef KERNEL
#ifdef __STDC__
struct nameidata;
struct mbuf;
#endif
struct vfsops {
@ -176,16 +186,19 @@ struct vfsops {
int (*vfs_unmount) __P((struct mount *mp, int mntflags,
struct proc *p));
int (*vfs_root) __P((struct mount *mp, struct vnode **vpp));
/* int uid, should be uid_t */
int (*vfs_quotactl) __P((struct mount *mp, int cmds, uid_t uid,
caddr_t arg, struct proc *p));
int (*vfs_statfs) __P((struct mount *mp, struct statfs *sbp,
struct proc *p));
int (*vfs_sync) __P((struct mount *mp, int waitfor));
int (*vfs_fhtovp) __P((struct mount *mp, struct fid *fhp,
int (*vfs_sync) __P((struct mount *mp, int waitfor,
struct ucred *cred, struct proc *p));
int (*vfs_vget) __P((struct mount *mp, ino_t ino,
struct vnode **vpp));
int (*vfs_fhtovp) __P((struct mount *mp, struct fid *fhp,
struct mbuf *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
int (*vfs_vptofh) __P((struct vnode *vp, struct fid *fhp));
int (*vfs_init) __P(());
int (*vfs_init) __P((void));
};
#define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
@ -195,19 +208,18 @@ struct vfsops {
#define VFS_ROOT(MP, VPP) (*(MP)->mnt_op->vfs_root)(MP, VPP)
#define VFS_QUOTACTL(MP,C,U,A,P) (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
#define VFS_STATFS(MP, SBP, P) (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
#define VFS_SYNC(MP, WAITFOR) (*(MP)->mnt_op->vfs_sync)(MP, WAITFOR)
#define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
#define VFS_SYNC(MP, WAIT, C, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
#define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
#define VFS_FHTOVP(MP, FIDP, NAM, VPP, EXFLG, CRED) \
(*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, NAM, VPP, EXFLG, CRED)
#define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
#endif /* KERNEL */
/*
* Flags for various system call interfaces.
*
* forcibly flags for vfs_umount().
* waitfor flags to vfs_sync() and getfsstat()
*/
#define MNT_FORCE 1
#define MNT_NOFORCE 2
#define MNT_WAIT 1
#define MNT_NOWAIT 2
@ -216,33 +228,76 @@ struct vfsops {
*/
struct fhandle {
fsid_t fh_fsid; /* File system id of mount point */
struct fid fh_fid; /* Id of file */
struct fid fh_fid; /* File sys specific id */
};
typedef struct fhandle fhandle_t;
#ifdef KERNEL
#include <net/radix.h>
#include <sys/socket.h> /* XXX for AF_MAX */
/*
* Arguments to export mount
* Network address lookup element
*/
struct export_args {
uid_t exroot; /* mapping for root uid */
struct netcred {
struct radix_node netc_rnodes[2];
int netc_exflags;
struct ucred netc_anon;
};
/*
* Arguments to mount UFS
* Network export information
*/
struct netexport {
struct netcred ne_defexported; /* Default export */
struct radix_node_head *ne_rtable[AF_MAX+1]; /* Individual exports */
};
#endif /* KERNEL */
/*
* Export arguments for local filesystem mount calls.
*/
struct export_args {
int ex_flags; /* export related flags */
uid_t ex_root; /* mapping for root uid */
struct ucred ex_anon; /* mapping for anonymous user */
struct sockaddr *ex_addr; /* net address to which exported */
int ex_addrlen; /* and the net address length */
struct sockaddr *ex_mask; /* mask of valid bits in saddr */
int ex_masklen; /* and the smask length */
};
/*
* Arguments to mount UFS-based filesystems
*/
struct ufs_args {
char *fspec; /* block special device to mount */
char *fspec; /* block special device to mount */
struct export_args export; /* network export information */
};
/*
* Arguments to mount MFS
*/
struct mfs_args {
char *name; /* name to export for statfs */
caddr_t base; /* base address of file system in memory */
u_long size; /* size of file system */
char *fspec; /* name to export for statfs */
struct export_args export; /* if exported MFSes are supported */
caddr_t base; /* base of file system in memory */
u_long size; /* size of file system */
};
/*
* Arguments to mount ISO 9660 filesystems.
*/
struct iso_args {
char *fspec; /* block special device to mount */
struct export_args export; /* network export info */
int flags; /* mounting flags, see below */
};
#define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
#define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */
#define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */
/*
* File Handle (32 bytes for version 2), variable up to 1024 for version 3
*/
@ -257,6 +312,7 @@ typedef union nfsv2fh nfsv2fh_t;
*/
struct nfs_args {
struct sockaddr *addr; /* file server address */
int addrlen; /* length of address */
int sotype; /* Socket type */
int proto; /* and Protocol */
nfsv2fh_t *fh; /* File handle to be mounted */
@ -265,70 +321,84 @@ struct nfs_args {
int rsize; /* read size in bytes */
int timeo; /* initial timeout in .1 secs */
int retrans; /* times to retry send */
int maxgrouplist; /* Max. size of group list */
int readahead; /* # of blocks to readahead */
int leaseterm; /* Term (sec) of lease */
int deadthresh; /* Retrans threshold */
char *hostname; /* server's name */
};
/*
* NFS mount option flags
*/
#define NFSMNT_SOFT 0x0001 /* soft mount (hard is default) */
#define NFSMNT_WSIZE 0x0002 /* set write size */
#define NFSMNT_RSIZE 0x0004 /* set read size */
#define NFSMNT_TIMEO 0x0008 /* set initial timeout */
#define NFSMNT_RETRANS 0x0010 /* set number of request retrys */
#define NFSMNT_HOSTNAME 0x0020 /* set hostname for error printf */
#define NFSMNT_INT 0x0040 /* allow interrupts on hard mount */
#define NFSMNT_NOCONN 0x0080 /* Don't Connect the socket */
#define NFSMNT_SCKLOCK 0x0100 /* Lock socket against others */
#define NFSMNT_WANTSCK 0x0200 /* Want a socket lock */
#define NFSMNT_SPONGY 0x0400 /* spongy mount (soft for stat and lookup) */
#define NFSMNT_COMPRESS 0x0800 /* Compress nfs rpc xdr */
#define NFSMNT_LOCKBITS (NFSMNT_SCKLOCK | NFSMNT_WANTSCK)
/*
* Arguments to mount ISO 9660 filesystems.
*/
struct iso_args {
char *fspec; /* block special holding the fs to mount */
int flags; /* mounting flags, see below */
};
#define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
#define ISOFSMNT_GENS 0x00000002 /* enable usage of generation numbers */
#define ISOFSMNT_EXTATT 0x00000004 /* enable usage of extended attributes */
#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
#define NFSMNT_WSIZE 0x00000002 /* set write size */
#define NFSMNT_RSIZE 0x00000004 /* set read size */
#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */
#define NFSMNT_MYWRITE 0x00000200 /* Assume writes were mine */
#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
#define NFSMNT_RDIRALOOK 0x00001000 /* Do lookup with readdir (nqnfs) */
#define NFSMNT_LEASETERM 0x00002000 /* set lease term (nqnfs) */
#define NFSMNT_READAHEAD 0x00004000 /* set read ahead */
#define NFSMNT_DEADTHRESH 0x00008000 /* set dead server retry thresh */
#define NFSMNT_NQLOOKLEASE 0x00010000 /* Get lease for lookup */
#define NFSMNT_RESVPORT 0x00020000 /* Allocate a reserved port */
#define NFSMNT_INTERNAL 0xffe00000 /* Bits set internally */
#define NFSMNT_MNTD 0x00200000 /* Mnt server for mnt point */
#define NFSMNT_DISMINPROG 0x00400000 /* Dismount in progress */
#define NFSMNT_DISMNT 0x00800000 /* Dismounted */
#define NFSMNT_SNDLOCK 0x01000000 /* Send socket lock */
#define NFSMNT_WANTSND 0x02000000 /* Want above */
#define NFSMNT_RCVLOCK 0x04000000 /* Rcv socket lock */
#define NFSMNT_WANTRCV 0x08000000 /* Want above */
#define NFSMNT_WAITAUTH 0x10000000 /* Wait for authentication */
#define NFSMNT_HASAUTH 0x20000000 /* Has authenticator */
#define NFSMNT_WANTAUTH 0x40000000 /* Wants an authenticator */
#define NFSMNT_AUTHERR 0x80000000 /* Authentication error */
/*
* Arguments to mount MSDOS filesystems.
*/
struct msdosfs_args {
char *fspec; /* blocks special holding the fs to mount */
uid_t uid; /* uid that owns msdosfs files */
gid_t gid; /* gid that owns msdosfs files */
mode_t mask; /* mask to be applied for msdosfs perms */
char *fspec; /* blocks special holding the fs to mount */
struct export_args export; /* network export information */
uid_t uid; /* uid that owns msdosfs files */
gid_t gid; /* gid that owns msdosfs files */
mode_t mask; /* mask to be applied for msdosfs perms */
};
/*
* Arguments to mount amigados filesystems.
*/
struct adosfs_args {
char *fspec; /* blocks special holding the fs to mount */
uid_t uid; /* uid that owns adosfs files */
gid_t gid; /* gid that owns adosfs files */
mode_t mask; /* mask to be applied for msdosfs perms */
char *fspec; /* blocks special holding the fs to mount */
struct export_args export; /* network export information */
uid_t uid; /* uid that owns msdosfs files */
gid_t gid; /* gid that owns msdosfs files */
mode_t mask; /* mask to be applied for msdosfs perms */
};
#ifdef KERNEL
/*
* exported vnode operations
*/
struct mount *getvfs __P((fsid_t *fsid)); /* return vfs given fsid */
void getnewfsid __P((struct mount *mp, int mtype)); /* get a uniqe fsid */
long makefstype __P((char *type)); /* mnt type -> 'unique' number */
void vfs_remove __P((struct mount *mp)); /* remove a vfs from mount list */
int vfs_lock __P((struct mount *mp)); /* lock a vfs */
void vfs_unlock __P((struct mount *mp)); /* unlock a vfs */
struct mount *rootfs; /* ptr to root mount structure */
extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
extern struct vfsops *vfssw[]; /* mount filesystem type table */
extern int nvfssw; /* number of vfssw entries */
struct mount *getvfs __P((fsid_t *)); /* return vfs given fsid */
int vfs_export /* process mount export info */
__P((struct mount *, struct netexport *, struct export_args *));
struct netcred *vfs_export_lookup /* lookup host in fs export list */
__P((struct mount *, struct netexport *, struct mbuf *));
int vfs_lock __P((struct mount *)); /* lock a vfs */
int vfs_mountedon __P((struct vnode *));/* is a vfs mounted on vp */
void vfs_unlock __P((struct mount *)); /* unlock a vfs */
extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
extern struct vfsops *vfssw[]; /* filesystem type table */
extern int nvfssw;
#else /* KERNEL */
@ -345,5 +415,3 @@ int unmount __P((const char *, int));
__END_DECLS
#endif /* KERNEL */
#endif /* !_SYS_MOUNT_H_ */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1985, 1989, 1991 Regents of the University of California.
* All rights reserved.
* Copyright (c) 1985, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -30,57 +30,64 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)namei.h 7.15 (Berkeley) 5/15/91
* $Id: namei.h,v 1.3 1993/05/20 16:22:47 cgd Exp $
* from: @(#)namei.h 8.2 (Berkeley) 1/4/94
* $Id: namei.h,v 1.4 1994/06/08 11:38:48 mycroft Exp $
*/
#ifndef _SYS_NAMEI_H_
#define _SYS_NAMEI_H_
#define _SYS_NAMEI_H_
/*
* Encapsulation of namei parameters.
*/
struct nameidata {
/*
* Arguments to namei.
* Arguments to namei/lookup.
*/
caddr_t ni_dirp; /* pathname pointer */
enum uio_seg ni_segflg; /* location of pathname */
u_long ni_nameiop; /* see below */
/* u_long ni_nameiop; namei operation */
/* u_long ni_flags; flags to namei */
/* struct proc *ni_proc; process requesting lookup */
/*
* Arguments to lookup.
*/
struct ucred *ni_cred; /* credentials */
/* struct ucred *ni_cred; credentials */
struct vnode *ni_startdir; /* starting directory */
struct vnode *ni_rootdir; /* logical root directory */
/*
* Results
* Results: returned from/manipulated by lookup
*/
struct vnode *ni_vp; /* vnode of result */
struct vnode *ni_dvp; /* vnode of intermediate directory */
/*
* Shared between namei, lookup routines, and commit routines.
* Shared between namei and lookup/commit routines.
*/
char *ni_pnbuf; /* pathname buffer */
long ni_pathlen; /* remaining chars in path */
char *ni_ptr; /* current location in pathname */
long ni_namelen; /* length of current component */
char *ni_next; /* next location in pathname */
u_long ni_hash; /* hash value of current component */
u_char ni_loopcnt; /* count of symlinks encountered */
u_char ni_makeentry; /* 1 => add entry to name cache */
u_char ni_isdotdot; /* 1 => current component name is .. */
u_char ni_more; /* 1 => symlink needs interpretation */
u_long ni_loopcnt; /* count of symlinks encountered */
/*
* Side effects.
* Lookup parameters: this structure describes the subset of
* information from the nameidata structure that is passed
* through the VOP interface.
*/
struct ufs_specific { /* saved info for new dir entry */
off_t ufs_endoff; /* end of useful directory contents */
long ufs_offset; /* offset of free space in directory */
long ufs_count; /* size of free slot in directory */
ino_t ufs_ino; /* inode number of found directory */
u_long ufs_reclen; /* size of found directory entry */
} ni_ufs;
struct componentname {
/*
* Arguments to lookup.
*/
u_long cn_nameiop; /* namei operation */
u_long cn_flags; /* flags to namei */
struct proc *cn_proc; /* process requesting lookup */
struct ucred *cn_cred; /* credentials */
/*
* Shared between lookup and commit routines.
*/
char *cn_pnbuf; /* pathname buffer */
char *cn_nameptr; /* pointer to looked up name */
long cn_namelen; /* length of looked up component */
u_long cn_hash; /* hash value of looked up name */
long cn_consume; /* chars to consume in lookup() */
} ni_cnd;
};
#ifdef KERNEL
@ -93,7 +100,7 @@ struct nameidata {
#define RENAME 3 /* setup for file renaming */
#define OPMASK 3 /* mask for operation */
/*
* namei operational modifiers
* namei operational modifier flags, stored in ni_cnd.flags
*/
#define LOCKLEAF 0x0004 /* lock inode on return */
#define LOCKPARENT 0x0008 /* want parent vnode returned locked */
@ -116,12 +123,26 @@ struct nameidata {
* name being sought. The caller is responsible for releasing the
* buffer and for vrele'ing ni_startdir.
*/
#define NOCROSSMOUNT 0x0100 /* do not cross mount points */
#define REMOTE 0x0200 /* lookup for remote filesystem servers */
#define HASBUF 0x0400 /* has allocated pathname buffer */
#define SAVENAME 0x0800 /* save pathanme buffer */
#define SAVESTART 0x1000 /* save starting directory */
#define PARAMASK 0xff00 /* mask of parameter descriptors */
#define NOCROSSMOUNT 0x00100 /* do not cross mount points */
#define RDONLY 0x00200 /* lookup with read-only semantics */
#define HASBUF 0x00400 /* has allocated pathname buffer */
#define SAVENAME 0x00800 /* save pathanme buffer */
#define SAVESTART 0x01000 /* save starting directory */
#define ISDOTDOT 0x02000 /* current component name is .. */
#define MAKEENTRY 0x04000 /* entry is to be added to name cache */
#define ISLASTCN 0x08000 /* this is last component of pathname */
#define ISSYMLINK 0x10000 /* symlink needs interpretation */
#define PARAMASK 0xfff00 /* mask of parameter descriptors */
/*
* Initialization of an nameidata structure.
*/
#define NDINIT(ndp, op, flags, segflg, namep, p) { \
(ndp)->ni_cnd.cn_nameiop = op; \
(ndp)->ni_cnd.cn_flags = flags; \
(ndp)->ni_segflg = segflg; \
(ndp)->ni_dirp = namep; \
(ndp)->ni_cnd.cn_proc = p; \
}
#endif
/*
@ -134,8 +155,8 @@ struct nameidata {
#define NCHNAMLEN 31 /* maximum name segment length we bother with */
struct namecache {
struct namecache *nc_forw; /* hash chain, MUST BE FIRST */
struct namecache *nc_back; /* hash chain, MUST BE FIRST */
struct namecache *nc_forw; /* hash chain */
struct namecache **nc_back; /* hash chain */
struct namecache *nc_nxt; /* LRU chain */
struct namecache **nc_prev; /* LRU chain */
struct vnode *nc_dvp; /* vnode of parent of name */
@ -148,8 +169,10 @@ struct namecache {
#ifdef KERNEL
u_long nextvnodeid;
int namei __P((struct nameidata *ndp, struct proc *p));
int lookup __P((struct nameidata *ndp, struct proc *p));
int namei __P((struct nameidata *ndp));
int lookup __P((struct nameidata *ndp));
int relookup __P((struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp));
#endif
/*
@ -165,5 +188,4 @@ struct nchstats {
long ncs_pass2; /* names found with passes == 2 */
long ncs_2passes; /* number of times we attempt it */
};
#endif /* !_SYS_NAMEI_H_ */

View File

@ -2,12 +2,9 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from: syscalls.master,v 1.19 1994/05/17 00:00:46
* created from: syscalls.master,v 1.18 1994/05/07 00:39:06
*/
#ifndef _SYS_SYSCALL_H
#define _SYS_SYSCALL_H
#define SYS_syscall 0
#define SYS_exit 1
#define SYS_fork 2
@ -159,10 +156,9 @@
/* 149 is old quota */
/* 150 is old getsockname */
#define SYS_nfssvc 155
#define SYS_getdirentries 156
/* 156 is old getdirentries */
#define SYS_statfs 157
#define SYS_fstatfs 158
#define SYS_async_daemon 160
#define SYS_getfh 161
/* 162 is old getdomainname */
/* 163 is old setdomainname */
@ -185,6 +181,7 @@
#define SYS_fpathconf 192
#define SYS_getrlimit 194
#define SYS_setrlimit 195
#define SYS_getdirentries 196
#define SYS_mmap 197
#define SYS___syscall 198
#define SYS_lseek 199
@ -193,5 +190,3 @@
#define SYS___sysctl 202
#define SYS_mlock 203
#define SYS_munlock 204
#endif /* _SYS_SYSCALL_H */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -30,62 +30,55 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)vnode.h 7.39 (Berkeley) 6/27/91
* $Id: vnode.h,v 1.21 1994/05/20 06:38:11 cgd Exp $
* from: @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $Id: vnode.h,v 1.22 1994/06/08 11:38:54 mycroft Exp $
*/
#ifndef _SYS_VNODE_H_
#define _SYS_VNODE_H_
#include <sys/queue.h>
#ifndef KERNEL
#include <machine/endian.h>
#endif
/*
* The vnode is the focus of all file activity in UNIX.
* There is a unique vnode allocated for each active file,
* each current directory, each mounted-on file, text file, and the root.
* The vnode is the focus of all file activity in UNIX. There is a
* unique vnode allocated for each active file, each current directory,
* each mounted-on file, text file, and the root.
*/
/*
* vnode types. VNON means no type.
* Vnode types. VNON means no type.
*/
enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
/*
* Vnode tag types.
* These are for the benefit of external programs only (e.g., pstat)
* and should NEVER be inspected inside the kernel.
* and should NEVER be inspected by the kernel.
*/
enum vtagtype { VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_LFS, VT_MSDOSFS, VT_ISOFS,
VT_KERNFS, VT_FDESC, VT_PROCFS, VT_LOFS, VT_PORTAL,
VT_ADOSFS };
enum vtagtype {
VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS, VT_LFS, VT_LOFS, VT_FDESC,
VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS,
VT_UNION, VT_ADOSFS
};
/*
* This defines the maximum size of the private data area
* permitted for any file system type. A defined constant
* is used rather than a union structure to cut down on the
* number of header files that must be included.
* Each underlying filesystem allocates its own private area and hangs
* it from v_data. If non-null, this area is freed in getnewvnode().
*/
#define VN_MAXPRIVATE roundup(192, sizeof(quad_t))
LIST_HEAD(buflists, buf);
struct vnode {
u_long v_flag; /* vnode flags (see below) */
short v_usecount; /* reference count of users */
short v_writecount; /* reference count of writers */
long v_holdcnt; /* page & buffer references */
off_t v_lastr; /* last read (read-ahead) */
u_long v_id; /* capability identifier */
struct mount *v_mount; /* ptr to vfs we are in */
struct vnodeops *v_op; /* vnode operations */
u_long v_flag; /* vnode flags (see below) */
short v_usecount; /* reference count of users */
short v_writecount; /* reference count of writers */
long v_holdcnt; /* page & buffer references */
daddr_t v_lastr; /* last read (read-ahead) */
u_long v_id; /* capability identifier */
struct mount *v_mount; /* ptr to vfs we are in */
int (**v_op)(); /* vnode operations vector */
TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */
LIST_ENTRY(vnode) v_mntvnodes; /* vnode mountlist */
struct buflists v_cleanblkhd; /* clean blocklist head */
struct buflists v_dirtyblkhd; /* dirty blocklist head */
long v_numoutput; /* num of writes in progress */
enum vtype v_type; /* vnode type */
LIST_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */
struct buflists v_cleanblkhd; /* clean blocklist head */
struct buflists v_dirtyblkhd; /* dirty blocklist head */
long v_numoutput; /* num of writes in progress */
enum vtype v_type; /* vnode type */
union {
struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */
struct socket *vu_socket; /* unix ipc (VSOCK) */
@ -93,8 +86,16 @@ struct vnode {
struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */
struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */
} v_un;
enum vtagtype v_tag; /* type of underlying data */
quad_t v_data[VN_MAXPRIVATE/sizeof(quad_t)]; /* private data for fs */
struct nqlease *v_lease; /* Soft reference to lease */
daddr_t v_lastw; /* last write (write cluster) */
daddr_t v_cstart; /* start block of cluster */
daddr_t v_lasta; /* last allocation */
int v_clen; /* length of current cluster */
int v_ralen; /* Read-ahead length */
daddr_t v_maxra; /* last readahead block */
long v_spare[7]; /* round to 128 bytes */
enum vtagtype v_tag; /* type of underlying data */
void *v_data; /* private data for fs */
};
#define v_mountedhere v_un.vu_mountedhere
#define v_socket v_un.vu_socket
@ -103,7 +104,7 @@ struct vnode {
#define v_fifoinfo v_un.vu_fifoinfo
/*
* vnode flags.
* Vnode flags.
*/
#define VROOT 0x0001 /* root of its file system */
#define VTEXT 0x0002 /* vnode is a pure text prototype */
@ -112,11 +113,11 @@ struct vnode {
#define VXWANT 0x0200 /* process is waiting for vnode */
#define VBWAIT 0x0400 /* waiting for output to complete */
#define VALIASED 0x0800 /* vnode has an alias */
#define VDIROP 0x1000 /* LFS: vnode is involved in a directory op */
/*
* Vnode attributes. A field value of VNOVAL
* represents a field whose value is unavailable
* (getattr) or which is not to be changed (setattr).
* Vnode attributes. A field value of VNOVAL represents a field whose value
* is unavailable (getattr) or which is not to be changed (setattr).
*/
struct vattr {
enum vtype va_type; /* vnode type (for create) */
@ -128,130 +129,26 @@ struct vattr {
long va_fileid; /* file id */
u_quad_t va_size; /* file size in bytes */
long va_blocksize; /* blocksize preferred for i/o */
struct timespec va_atime; /* time of last access */
struct timespec va_mtime; /* time of last modification */
struct timespec va_ctime; /* time file changed */
struct timespec va_atime; /* time of last access */
struct timespec va_mtime; /* time of last modification */
struct timespec va_ctime; /* time file changed */
u_long va_gen; /* generation number of file */
u_long va_flags; /* flags defined for file */
/* XXX should be a dev_t */
u_long va_rdev; /* device the special file represents */
u_quad_t va_bytes; /* bytes of disk space held by file */
u_quad_t va_filerev; /* file modification number */
u_int va_vaflags; /* operations flags, see below */
long va_spare; /* remain quad aligned */
};
/*
* Flags for va_vaflags.
* Flags for va_cflags.
*/
#define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */
/*
* Operations on vnodes.
*/
#ifdef __STDC__
struct flock;
struct nameidata;
#endif
struct vnodeops {
int (*vop_lookup) __P((struct vnode *vp, struct nameidata *ndp,
struct proc *p));
int (*vop_create) __P((struct nameidata *ndp, struct vattr *vap,
struct proc *p));
int (*vop_mknod) __P((struct nameidata *ndp, struct vattr *vap,
struct ucred *cred, struct proc *p));
int (*vop_open) __P((struct vnode *vp, int mode,
struct ucred *cred, struct proc *p));
int (*vop_close) __P((struct vnode *vp, int fflag,
struct ucred *cred, struct proc *p));
int (*vop_access) __P((struct vnode *vp, int mode,
struct ucred *cred, struct proc *p));
int (*vop_getattr) __P((struct vnode *vp, struct vattr *vap,
struct ucred *cred, struct proc *p));
int (*vop_setattr) __P((struct vnode *vp, struct vattr *vap,
struct ucred *cred, struct proc *p));
int (*vop_read) __P((struct vnode *vp, struct uio *uio,
int ioflag, struct ucred *cred));
int (*vop_write) __P((struct vnode *vp, struct uio *uio,
int ioflag, struct ucred *cred));
int (*vop_ioctl) __P((struct vnode *vp, int command,
caddr_t data, int fflag,
struct ucred *cred, struct proc *p));
int (*vop_select) __P((struct vnode *vp, int which, int fflags,
struct ucred *cred, struct proc *p));
int (*vop_mmap) __P((struct vnode *vp, int fflags,
struct ucred *cred, struct proc *p));
int (*vop_fsync) __P((struct vnode *vp, int fflags,
struct ucred *cred, int waitfor,
struct proc *p));
int (*vop_seek) __P((struct vnode *vp, off_t oldoff,
off_t newoff, struct ucred *cred));
int (*vop_remove) __P((struct nameidata *ndp, struct proc *p));
int (*vop_link) __P((struct vnode *vp, struct nameidata *ndp,
struct proc *p));
int (*vop_rename) __P((struct nameidata *fndp,
struct nameidata *tdnp, struct proc *p));
int (*vop_mkdir) __P((struct nameidata *ndp, struct vattr *vap,
struct proc *p));
int (*vop_rmdir) __P((struct nameidata *ndp, struct proc *p));
int (*vop_symlink) __P((struct nameidata *ndp, struct vattr *vap,
char *target, struct proc *p));
int (*vop_readdir) __P((struct vnode *vp, struct uio *uio,
struct ucred *cred, int *eofflagp,
u_int *cookies, int ncookies));
int (*vop_readlink) __P((struct vnode *vp, struct uio *uio,
struct ucred *cred));
int (*vop_abortop) __P((struct nameidata *ndp));
int (*vop_inactive) __P((struct vnode *vp, struct proc *p));
int (*vop_reclaim) __P((struct vnode *vp));
int (*vop_lock) __P((struct vnode *vp));
int (*vop_unlock) __P((struct vnode *vp));
int (*vop_bmap) __P((struct vnode *vp, daddr_t bn,
struct vnode **vpp, daddr_t *bnp));
int (*vop_strategy) __P((struct buf *bp));
int (*vop_print) __P((struct vnode *vp));
int (*vop_islocked) __P((struct vnode *vp));
int (*vop_advlock) __P((struct vnode *vp, caddr_t id, int op,
struct flock *fl, int flags));
};
/* Macros to call the vnode ops */
#define VOP_LOOKUP(v,n,p) (*((v)->v_op->vop_lookup))(v,n,p)
#define VOP_CREATE(n,a,p) (*((n)->ni_dvp->v_op->vop_create))(n,a,p)
#define VOP_MKNOD(n,a,c,p) (*((n)->ni_dvp->v_op->vop_mknod))(n,a,c,p)
#define VOP_OPEN(v,f,c,p) (*((v)->v_op->vop_open))(v,f,c,p)
#define VOP_CLOSE(v,f,c,p) (*((v)->v_op->vop_close))(v,f,c,p)
#define VOP_ACCESS(v,f,c,p) (*((v)->v_op->vop_access))(v,f,c,p)
#define VOP_GETATTR(v,a,c,p) (*((v)->v_op->vop_getattr))(v,a,c,p)
#define VOP_SETATTR(v,a,c,p) (*((v)->v_op->vop_setattr))(v,a,c,p)
#define VOP_READ(v,u,i,c) (*((v)->v_op->vop_read))(v,u,i,c)
#define VOP_WRITE(v,u,i,c) (*((v)->v_op->vop_write))(v,u,i,c)
#define VOP_IOCTL(v,o,d,f,c,p) (*((v)->v_op->vop_ioctl))(v,o,d,f,c,p)
#define VOP_SELECT(v,w,f,c,p) (*((v)->v_op->vop_select))(v,w,f,c,p)
#define VOP_MMAP(v,f,c,p) (*((v)->v_op->vop_mmap))(v,f,c,p)
#define VOP_FSYNC(v,f,c,w,p) (*((v)->v_op->vop_fsync))(v,f,c,w,p)
#define VOP_SEEK(v,p,o,w) (*((v)->v_op->vop_seek))(v,p,o,w)
#define VOP_REMOVE(n,p) (*((n)->ni_dvp->v_op->vop_remove))(n,p)
#define VOP_LINK(v,n,p) (*((n)->ni_dvp->v_op->vop_link))(v,n,p)
#define VOP_RENAME(s,t,p) (*((s)->ni_dvp->v_op->vop_rename))(s,t,p)
#define VOP_MKDIR(n,a,p) (*((n)->ni_dvp->v_op->vop_mkdir))(n,a,p)
#define VOP_RMDIR(n,p) (*((n)->ni_dvp->v_op->vop_rmdir))(n,p)
#define VOP_SYMLINK(n,a,m,p) (*((n)->ni_dvp->v_op->vop_symlink))(n,a,m,p)
#define VOP_READDIR(v,u,c,e,k,n) (*((v)->v_op->vop_readdir))(v,u,c,e,k,n)
#define VOP_READLINK(v,u,c) (*((v)->v_op->vop_readlink))(v,u,c)
#define VOP_ABORTOP(n) (*((n)->ni_dvp->v_op->vop_abortop))(n)
#define VOP_INACTIVE(v,p) (*((v)->v_op->vop_inactive))(v,p)
#define VOP_RECLAIM(v) (*((v)->v_op->vop_reclaim))(v)
#define VOP_LOCK(v) (*((v)->v_op->vop_lock))(v)
#define VOP_UNLOCK(v) (*((v)->v_op->vop_unlock))(v)
#define VOP_BMAP(v,s,p,n) (*((v)->v_op->vop_bmap))(v,s,p,n)
#define VOP_STRATEGY(b) (*((b)->b_vp->v_op->vop_strategy))(b)
#define VOP_PRINT(v) (*((v)->v_op->vop_print))(v)
#define VOP_ISLOCKED(v) (((v)->v_flag & VXLOCK) || \
(*((v)->v_op->vop_islocked))(v))
#define VOP_ADVLOCK(v,p,o,l,f) (*((v)->v_op->vop_advlock))(v,p,o,l,f)
/*
* flags for ioflag
* Flags for ioflag.
*/
#define IO_UNIT 0x01 /* do I/O as atomic unit */
#define IO_APPEND 0x02 /* append write to end */
@ -260,38 +157,56 @@ struct vnodeops {
#define IO_NDELAY 0x10 /* FNDELAY flag set in file table */
/*
* Modes. Some values same as Ixxx entries from inode.h for now
* Modes. Some values same as Ixxx entries from inode.h for now.
*/
#define VSUID 04000 /* set user id on execution */
#define VSGID 02000 /* set group id on execution */
#define VSVTX 01000 /* save swapped text even after use */
#define VREAD 0400 /* read, write, execute permissions */
#define VWRITE 0200
#define VEXEC 0100
#define VREAD 00400 /* read, write, execute permissions */
#define VWRITE 00200
#define VEXEC 00100
/*
* Token indicating no attribute value yet assigned
* Token indicating no attribute value yet assigned.
*/
#define VNOVAL (-1)
#ifdef KERNEL
/*
* Convert between vnode types and inode formats (since POSIX.1
* defines mode word of stat structure in terms of inode formats).
*/
extern enum vtype iftovt_tab[];
extern int vttoif_tab[];
#define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12])
#define VTTOIF(indx) (vttoif_tab[(int)(indx)])
#define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode))
/*
* Flags to various vnode functions.
*/
#define SKIPSYSTEM 0x0001 /* vflush: skip vnodes marked VSYSTEM */
#define FORCECLOSE 0x0002 /* vflush: force file closeure */
#define DOCLOSE 0x0004 /* vclean: close active files */
#define WRITECLOSE 0x0004 /* vflush: only close writeable files */
#define DOCLOSE 0x0008 /* vclean: close active files */
#define V_SAVE 0x0001 /* vinvalbuf: sync file first */
#define V_SAVEMETA 0x0002 /* vinvalbuf: leave indirect blocks */
#ifndef DIAGNOSTIC
#define VREF(vp) (vp)->v_usecount++ /* increase reference */
#define VHOLD(vp) (vp)->v_holdcnt++ /* increase buf or page ref */
#define HOLDRELE(vp) (vp)->v_holdcnt-- /* decrease buf or page ref */
#define VATTR_NULL(vap) (*(vap) = va_null) /* initialize a vattr */
#else /* DIAGNOSTIC */
#define VREF(vp) vref(vp)
#define VHOLD(vp) vhold(vp)
#ifdef DIAGNOSTIC
#define HOLDRELE(vp) holdrele(vp)
#define VATTR_NULL(vap) vattr_null(vap)
#define VHOLD(vp) vhold(vp)
#define VREF(vp) vref(vp)
void holdrele __P((struct vnode *));
void vattr_null __P((struct vattr *));
void vhold __P((struct vnode *));
void vref __P((struct vnode *));
#else
#define HOLDRELE(vp) (vp)->v_holdcnt-- /* decrease buf or page ref */
#define VATTR_NULL(vap) (*(vap) = va_null) /* initialize a vattr */
#define VHOLD(vp) (vp)->v_holdcnt++ /* increase buf or page ref */
#define VREF(vp) (vp)->v_usecount++ /* increase reference */
#endif
#define NULLVP ((struct vnode *)NULL)
@ -300,44 +215,188 @@ struct vnodeops {
* Global vnode data.
*/
extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
extern long desiredvnodes; /* number of vnodes desired */
extern int desiredvnodes; /* number of vnodes desired */
extern struct vattr va_null; /* predefined null vattr structure */
/*
* Macro/function to check for client cache inconsistency w.r.t. leasing.
* XXX Just no-ops for now.
*/
#define LEASE_READ 0x1 /* Check lease for readers */
#define LEASE_WRITE 0x2 /* Check lease for modifiers */
#ifdef NFSCLIENT
void lease_check __P((struct vnode *vp, struct proc *p,
struct ucred *ucred, int flag));
void lease_updatetime __P((int deltat));
#define LEASE_CHECK(vp, p, cred, flag) lease_check((vp), (p), (cred), (flag))
#define LEASE_UPDATETIME(dt) lease_updatetime(dt)
#else
#define LEASE_CHECK(vp, p, cred, flag)
#define LEASE_UPDATETIME(dt)
#endif /* NFSCLIENT */
#endif /* KERNEL */
int bdevvp __P((int dev, struct vnode **vpp));
int cdevvp __P((int dev, struct vnode **vpp));
int getnewvnode __P((enum vtagtype tag, struct mount *mp,
struct vnodeops *vops, struct vnode **vpp));
/*
* Mods for exensibility.
*/
/*
* Flags for vdesc_flags:
*/
#define VDESC_MAX_VPS 16
/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
#define VDESC_VP0_WILLRELE 0x0001
#define VDESC_VP1_WILLRELE 0x0002
#define VDESC_VP2_WILLRELE 0x0004
#define VDESC_VP3_WILLRELE 0x0008
#define VDESC_NOMAP_VPP 0x0100
#define VDESC_VPP_WILLRELE 0x0200
/*
* VDESC_NO_OFFSET is used to identify the end of the offset list
* and in places where no such field exists.
*/
#define VDESC_NO_OFFSET -1
/*
* This structure describes the vnode operation taking place.
*/
struct vnodeop_desc {
int vdesc_offset; /* offset in vector--first for speed */
char *vdesc_name; /* a readable name for debugging */
int vdesc_flags; /* VDESC_* flags */
/*
* These ops are used by bypass routines to map and locate arguments.
* Creds and procs are not needed in bypass routines, but sometimes
* they are useful to (for example) transport layers.
* Nameidata is useful because it has a cred in it.
*/
int *vdesc_vp_offsets; /* list ended by VDESC_NO_OFFSET */
int vdesc_vpp_offset; /* return vpp location */
int vdesc_cred_offset; /* cred location, if any */
int vdesc_proc_offset; /* proc location, if any */
int vdesc_componentname_offset; /* if any */
/*
* Finally, we've got a list of private data (about each operation)
* for each transport layer. (Support to manage this list is not
* yet part of BSD.)
*/
caddr_t *vdesc_transports;
};
#ifdef KERNEL
/*
* A list of all the operation descs.
*/
extern struct vnodeop_desc *vnodeop_descs[];
/*
* This macro is very helpful in defining those offsets in the vdesc struct.
*
* This is stolen from X11R4. I ingored all the fancy stuff for
* Crays, so if you decide to port this to such a serious machine,
* you might want to consult Intrisics.h's XtOffset{,Of,To}.
*/
#define VOPARG_OFFSET(p_type,field) \
((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
#define VOPARG_OFFSETOF(s_type,field) \
VOPARG_OFFSET(s_type*,field)
#define VOPARG_OFFSETTO(S_TYPE,S_OFFSET,STRUCT_P) \
((S_TYPE)(((char*)(STRUCT_P))+(S_OFFSET)))
/*
* This structure is used to configure the new vnodeops vector.
*/
struct vnodeopv_entry_desc {
struct vnodeop_desc *opve_op; /* which operation this is */
int (*opve_impl)(); /* code implementing this operation */
};
struct vnodeopv_desc {
/* ptr to the ptr to the vector where op should go */
int (***opv_desc_vector_p)();
struct vnodeopv_entry_desc *opv_desc_ops; /* null terminated list */
};
/*
* A default routine which just returns an error.
*/
int vn_default_error __P((void));
/*
* A generic structure.
* This can be used by bypass routines to identify generic arguments.
*/
struct vop_generic_args {
struct vnodeop_desc *a_desc;
/* other random data follows, presumably */
};
/*
* VOCALL calls an op given an ops vector. We break it out because BSD's
* vclean changes the ops vector and then wants to call ops with the old
* vector.
*/
#define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP))
/*
* This call works for vnodes in the kernel.
*/
#define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP))
#define VDESC(OP) (& __CONCAT(OP,_desc))
#define VOFFSET(OP) (VDESC(OP)->vdesc_offset)
/*
* Finally, include the default set of vnode operations.
*/
#include <vnode_if.h>
/*
* Public vnode manipulation functions.
*/
struct file;
struct mount;
struct nameidata;
struct proc;
struct stat;
struct ucred;
struct uio;
struct vattr;
struct vnode;
struct vop_bwrite_args;
int bdevvp __P((dev_t dev, struct vnode **vpp));
int cdevvp __P((dev_t dev, struct vnode **vpp));
int getnewvnode __P((enum vtagtype tag,
struct mount *mp, int (**vops)(), struct vnode **vpp));
void vattr_null __P((struct vattr *vap));
int vcount __P((struct vnode *vp));
void vflushbuf __P((struct vnode *vp, int sync));
int vget __P((struct vnode *vp, int lockflag));
void vgone __P((struct vnode *vp));
void vgoneall __P((struct vnode *vp));
int vn_close __P((struct vnode *vp, int flags, struct ucred *cred,
struct proc *p));
int vinvalbuf __P((struct vnode *vp, int save, struct ucred *cred,
struct proc *p, int slpflag, int slptimeo));
void vprint __P((char *label, struct vnode *vp));
int vn_bwrite __P((struct vop_bwrite_args *ap));
int vn_close __P((struct vnode *vp,
int flags, struct ucred *cred, struct proc *p));
int vn_closefile __P((struct file *fp, struct proc *p));
int vn_ioctl __P((struct file *fp, int com, caddr_t data, struct proc *p));
int vn_open __P((struct nameidata *ndp, struct proc *p, int fmode,
int cmode));
int vn_open __P((struct nameidata *ndp, int fmode, int cmode));
int vn_rdwr __P((enum uio_rw rw, struct vnode *vp, caddr_t base,
int len, off_t offset, enum uio_seg segflg, int ioflg,
struct ucred *cred, int *aresid, struct proc *p));
int vn_read __P((struct file *fp, struct uio *uio, struct ucred *cred));
int vn_select __P((struct file *fp, int which, struct proc *p));
int vn_stat __P((struct vnode *vp, struct stat *sb, struct proc *p));
int vn_write __P((struct file *fp, struct uio *uio, struct ucred *cred));
struct vnode *checkalias __P((struct vnode *vp, int nvp_rdev,
struct mount *mp));
struct vnode *
checkalias __P((struct vnode *vp, dev_t nvp_rdev, struct mount *mp));
void vput __P((struct vnode *vp));
void vref __P((struct vnode *vp));
void vrele __P((struct vnode *vp));
#endif
#endif /* !_SYS_VNODE_H_ */
#endif /* KERNEL */