summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-09-07 07:43:10 +0000
committertjr <tjr@FreeBSD.org>2003-09-07 07:43:10 +0000
commitffc45a6f38ccebcfc3c288c480c7d4b50ce07097 (patch)
treec3cf2ae6864b0278a40f0dfa5991f2f8900c75eb
parent0e8da904ef6c53f55935dad56701ad688b7b737c (diff)
downloadFreeBSD-src-ffc45a6f38ccebcfc3c288c480c7d4b50ce07097.zip
FreeBSD-src-ffc45a6f38ccebcfc3c288c480c7d4b50ce07097.tar.gz
Add support for the Coda 6.x venus<->kernel interface. This extends
FIDs to be 128-bits wide and adds support for realms. Add a new CODA_COMPAT_5 option, which requests support for the old Coda 5.x interface instead of the new one. Create a new coda5.ko module that supports the 5.x interface, and make the existing coda.ko module use the new 6.x interface. These modules cannot both be loaded at the same time. Obtained from: Jan Harkes & the coda-6.0.2 distribution, NetBSD (drochner) (CODA_COMPAT_5 option).
-rw-r--r--sys/coda/cnode.h4
-rw-r--r--sys/coda/coda.h298
-rw-r--r--sys/coda/coda_namecache.c46
-rw-r--r--sys/coda/coda_namecache.h8
-rw-r--r--sys/coda/coda_subr.c89
-rw-r--r--sys/coda/coda_subr.h2
-rw-r--r--sys/coda/coda_venus.c103
-rw-r--r--sys/coda/coda_venus.h46
-rw-r--r--sys/coda/coda_vfsops.c29
-rw-r--r--sys/coda/coda_vfsops.h2
-rw-r--r--sys/coda/coda_vnops.c103
-rw-r--r--sys/conf/NOTES3
-rw-r--r--sys/conf/options1
-rw-r--r--sys/fs/coda/cnode.h4
-rw-r--r--sys/fs/coda/coda.h298
-rw-r--r--sys/fs/coda/coda_namecache.c46
-rw-r--r--sys/fs/coda/coda_namecache.h8
-rw-r--r--sys/fs/coda/coda_subr.c89
-rw-r--r--sys/fs/coda/coda_subr.h2
-rw-r--r--sys/fs/coda/coda_venus.c103
-rw-r--r--sys/fs/coda/coda_venus.h46
-rw-r--r--sys/fs/coda/coda_vfsops.c29
-rw-r--r--sys/fs/coda/coda_vfsops.h2
-rw-r--r--sys/fs/coda/coda_vnops.c103
-rw-r--r--sys/modules/Makefile1
-rw-r--r--sys/modules/coda/Makefile8
-rw-r--r--sys/modules/coda5/Makefile19
27 files changed, 806 insertions, 686 deletions
diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h
index 450adc3..540831c 100644
--- a/sys/coda/cnode.h
+++ b/sys/coda/cnode.h
@@ -101,7 +101,7 @@ do { \
struct cnode {
struct vnode *c_vnode;
u_short c_flags; /* flags (see below) */
- ViceFid c_fid; /* file handle */
+ CodaFid c_fid; /* file handle */
struct lock c_lock; /* new lock protocol */
struct vnode *c_ovp; /* open vnode pointer */
u_short c_ocount; /* count of openers */
@@ -197,7 +197,7 @@ extern void coda_unmounting(struct mount *whoIam);
extern int coda_vmflush(struct cnode *cp);
/* cfs_vnodeops.h */
-extern struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type);
+extern struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
extern int coda_vnodeopstats_init(void);
/* coda_vfsops.h */
diff --git a/sys/coda/coda.h b/sys/coda/coda.h
index 2e59cfc..e7f1e0d 100644
--- a/sys/coda/coda.h
+++ b/sys/coda/coda.h
@@ -41,7 +41,7 @@
#ifndef _CODA_HEADER_
#define _CODA_HEADER_
-
+#include "opt_coda.h" /* for COMPAT_CODA_5 option */
/* Catch new _KERNEL defn for NetBSD */
#ifdef __NetBSD__
@@ -162,59 +162,70 @@ struct venus_dirent {
#endif
-#ifndef _FID_T_
-#define _FID_T_ 1
-typedef u_long VolumeId;
-typedef u_long VnodeId;
-typedef u_long Unique_t;
-typedef u_long FileVersion;
-#endif
-
-#ifndef _VICEFID_T_
-#define _VICEFID_T_ 1
-typedef struct ViceFid {
- VolumeId Volume;
- VnodeId Vnode;
- Unique_t Unique;
-} ViceFid;
-#endif /* VICEFID */
+#ifdef CODA_COMPAT_5
+typedef struct {
+ u_long Volume;
+ u_long Vnode;
+ u_long Unique;
+} CodaFid;
-#ifdef __linux__
-static __inline__ ino_t coda_f2i(struct ViceFid *fid)
+static __inline__ ino_t coda_f2i(CodaFid *fid)
{
- if ( ! fid )
- return 0;
- if (fid->Vnode == 0xfffffffe || fid->Vnode == 0xffffffff)
- return ((fid->Volume << 20) | (fid->Unique & 0xfffff));
- else
- return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20));
+ if (!fid) return 0;
+ return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20));
}
-
-#else
-#define coda_f2i(fid)\
- ((fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0)
-#endif
+static __inline__ char * coda_f2s(CodaFid *fid)
+{
+ static char fid_str [35];
+ snprintf (fid_str, 35, "[%lx.%lx.%lx]", fid->Volume,
+ fid->Vnode, fid->Unique);
+ return fid_str;
+}
+
+static __inline__ int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
+{
+ return (fid1->Volume == fid2->Volume &&
+ fid1->Vnode == fid2->Vnode &&
+ fid1->Unique == fid2->Unique);
+}
+
+struct coda_cred {
+ u_int32_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
+ u_int32_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
+};
-#ifndef __BIT_TYPES_DEFINED__
-#define u_int32_t unsigned int
-#endif
+#else /* CODA_COMPAT_5 */
+typedef struct {
+ u_int32_t opaque[4];
+} CodaFid;
-#ifndef _VUID_T_
-#define _VUID_T_
-typedef u_int32_t vuid_t;
-typedef u_int32_t vgid_t;
-#endif /*_VUID_T_ */
+static __inline__ ino_t coda_f2i(CodaFid *fid)
+{
+ if ( ! fid )
+ return 0;
+ return (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]);
+}
+
+static __inline__ char * coda_f2s(CodaFid *fid)
+ {
+ static char fid_str [35];
+ snprintf (fid_str, 35, "[%x.%x.%x.%x]", fid->opaque[0],
+ fid->opaque[1], fid->opaque[2], fid->opaque[3]);
+ return fid_str;
+ }
+
+static __inline__ int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
+{
+ return (fid1->opaque[0] == fid2->opaque[0] &&
+ fid1->opaque[1] == fid2->opaque[1] &&
+ fid1->opaque[2] == fid2->opaque[2] &&
+ fid1->opaque[3] == fid2->opaque[3]);
+}
-#ifndef _CODACRED_T_
-#define _CODACRED_T_
-struct coda_cred {
- vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
- vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
-};
-#endif
+#endif /* CODA_COMPAT_5 */
#ifndef _VENUS_VATTR_T_
#define _VENUS_VATTR_T_
@@ -227,8 +238,8 @@ struct coda_vattr {
int va_type; /* vnode type (for create) */
u_short va_mode; /* files access mode and type */
short va_nlink; /* number of references to file */
- vuid_t va_uid; /* owner user id */
- vgid_t va_gid; /* owner group id */
+ uid_t va_uid; /* owner user id */
+ gid_t va_gid; /* owner group id */
long va_fileid; /* file id */
u_quad_t va_size; /* file size in bytes */
long va_blocksize; /* blocksize preferred for i/o */
@@ -244,12 +255,21 @@ struct coda_vattr {
#endif
+/* structure used by CODA_STATFS for getting cache information from venus */
+struct coda_statfs {
+ int32_t f_blocks;
+ int32_t f_bfree;
+ int32_t f_bavail;
+ int32_t f_files;
+ int32_t f_ffree;
+};
+
/*
* Kernel <--> Venus communications.
*/
#define CODA_ROOT 2
-#define CODA_SYNC 3
+#define CODA_OPEN_BY_FD 3
#define CODA_OPEN 4
#define CODA_CLOSE 5
#define CODA_IOCTL 6
@@ -279,7 +299,8 @@ struct coda_vattr {
#define CODA_OPEN_BY_PATH 31
#define CODA_RESOLVE 32
#define CODA_REINTEGRATE 33
-#define CODA_NCALLS 34
+#define CODA_STATFS 34
+#define CODA_NCALLS 35
#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
@@ -293,21 +314,36 @@ struct coda_vattr {
#define CODA_KERNEL_VERSION 0
/* The old venus 4.6 compatible interface */
#define CODA_KERNEL_VERSION 1
-#endif
+#endif /* realms/cells */
+#ifdef CODA_COMPAT_5
/* venus_lookup gets an extra parameter to aid windows.*/
#define CODA_KERNEL_VERSION 2
+#else
+ /* 128-bit fids for realms */
+#define CODA_KERNEL_VERSION 3
+#endif
/*
* Venus <-> Coda RPC arguments
*/
+#ifdef CODA_COMPAT_5
struct coda_in_hdr {
unsigned long opcode;
- unsigned long unique; /* Keep multiple outstanding msgs distinct */
- u_short pid; /* Common to all */
- u_short pgid; /* Common to all */
+ unsigned long unique; /* Keep multiple outstanding msgs distinct */
+ u_short pid; /* Common to all */
+ u_short pgid; /* Common to all */
u_short sid; /* Common to all */
- struct coda_cred cred; /* Common to all */
+ struct coda_cred cred; /* Common to all */
};
+#else
+struct coda_in_hdr {
+ u_int32_t opcode;
+ u_int32_t unique; /* Keep multiple outstanding msgs distinct */
+ pid_t pid; /* Common to all */
+ pid_t pgid; /* Common to all */
+ uid_t uid; /* Common to all */
+};
+#endif
/* Really important that opcode and unique are 1st two fields! */
struct coda_out_hdr {
@@ -319,7 +355,7 @@ struct coda_out_hdr {
/* coda_root: NO_IN */
struct coda_root_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_root_in {
@@ -332,7 +368,7 @@ struct coda_root_in {
/* coda_open: */
struct coda_open_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
@@ -346,7 +382,7 @@ struct coda_open_out {
/* coda_close: */
struct coda_close_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
@@ -357,7 +393,7 @@ struct coda_close_out {
/* coda_ioctl: */
struct coda_ioctl_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int cmd;
int len;
int rwflag;
@@ -374,7 +410,7 @@ struct coda_ioctl_out {
/* coda_getattr: */
struct coda_getattr_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_getattr_out {
@@ -386,7 +422,7 @@ struct coda_getattr_out {
/* coda_setattr: NO_OUT */
struct coda_setattr_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
};
@@ -397,7 +433,7 @@ struct coda_setattr_out {
/* coda_access: NO_OUT */
struct coda_access_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
@@ -413,14 +449,14 @@ struct coda_access_out {
/* coda_lookup: */
struct coda_lookup_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int name; /* Place holder for data. */
int flags;
};
struct coda_lookup_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
int vtype;
};
@@ -428,7 +464,7 @@ struct coda_lookup_out {
/* coda_create: */
struct coda_create_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
int excl;
int mode;
@@ -437,7 +473,7 @@ struct coda_create_in {
struct coda_create_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
};
@@ -445,7 +481,7 @@ struct coda_create_out {
/* coda_remove: NO_OUT */
struct coda_remove_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int name; /* Place holder for data. */
};
@@ -456,8 +492,8 @@ struct coda_remove_out {
/* coda_link: NO_OUT */
struct coda_link_in {
struct coda_in_hdr ih;
- ViceFid sourceFid; /* cnode to link *to* */
- ViceFid destFid; /* Directory in which to place link */
+ CodaFid sourceFid; /* cnode to link *to* */
+ CodaFid destFid; /* Directory in which to place link */
int tname; /* Place holder for data. */
};
@@ -469,9 +505,9 @@ struct coda_link_out {
/* coda_rename: NO_OUT */
struct coda_rename_in {
struct coda_in_hdr ih;
- ViceFid sourceFid;
+ CodaFid sourceFid;
int srcname;
- ViceFid destFid;
+ CodaFid destFid;
int destname;
};
@@ -482,14 +518,14 @@ struct coda_rename_out {
/* coda_mkdir: */
struct coda_mkdir_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
int name; /* Place holder for data. */
};
struct coda_mkdir_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
};
@@ -497,7 +533,7 @@ struct coda_mkdir_out {
/* coda_rmdir: NO_OUT */
struct coda_rmdir_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int name; /* Place holder for data. */
};
@@ -508,7 +544,7 @@ struct coda_rmdir_out {
/* coda_readdir: */
struct coda_readdir_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int count;
int offset;
};
@@ -522,7 +558,7 @@ struct coda_readdir_out {
/* coda_symlink: NO_OUT */
struct coda_symlink_in {
struct coda_in_hdr ih;
- ViceFid VFid; /* Directory to put symlink in */
+ CodaFid Fid; /* Directory to put symlink in */
int srcname;
struct coda_vattr attr;
int tname;
@@ -535,7 +571,7 @@ struct coda_symlink_out {
/* coda_readlink: */
struct coda_readlink_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_readlink_out {
@@ -548,7 +584,7 @@ struct coda_readlink_out {
/* coda_fsync: NO_OUT */
struct coda_fsync_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_fsync_out {
@@ -558,18 +594,18 @@ struct coda_fsync_out {
/* coda_inactive: NO_OUT */
struct coda_inactive_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
/* coda_vget: */
struct coda_vget_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_vget_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
int vtype;
};
@@ -582,75 +618,85 @@ struct coda_vget_out {
/* CODA_PURGEUSER is a venus->kernel call */
struct coda_purgeuser_out {
struct coda_out_hdr oh;
+#ifdef CODA_COMPAT_5
struct coda_cred cred;
+#else
+ uid_t uid;
+#endif
};
/* coda_zapfile: */
/* CODA_ZAPFILE is a venus->kernel call */
struct coda_zapfile_out {
struct coda_out_hdr oh;
- ViceFid CodaFid;
+ CodaFid Fid;
};
/* coda_zapdir: */
/* CODA_ZAPDIR is a venus->kernel call */
struct coda_zapdir_out {
struct coda_out_hdr oh;
- ViceFid CodaFid;
+ CodaFid Fid;
};
/* coda_zapnode: */
/* CODA_ZAPVNODE is a venus->kernel call */
struct coda_zapvnode_out {
struct coda_out_hdr oh;
+#ifdef CODA_COMPAT_5
struct coda_cred cred;
- ViceFid VFid;
+#endif
+ CodaFid Fid;
};
/* coda_purgefid: */
/* CODA_PURGEFID is a venus->kernel call */
struct coda_purgefid_out {
struct coda_out_hdr oh;
- ViceFid CodaFid;
+ CodaFid Fid;
};
-/* coda_rdwr: */
-struct coda_rdwr_in {
- struct coda_in_hdr ih;
- ViceFid VFid;
- int rwflag;
- int count;
- int offset;
- int ioflag;
- caddr_t data; /* Place holder for data. */
+/* coda_replace: */
+/* CODA_REPLACE is a venus->kernel call */
+struct coda_replace_out { /* coda_replace is a venus->kernel call */
+ struct coda_out_hdr oh;
+ CodaFid NewFid;
+ CodaFid OldFid;
};
-struct coda_rdwr_out {
- struct coda_out_hdr oh;
- int rwflag;
- int count;
- caddr_t data; /* Place holder for data. */
+/* coda_open_by_fd: */
+struct coda_open_by_fd_in {
+ struct coda_in_hdr ih;
+ CodaFid Fid;
+ int flags;
};
-
-/* coda_replace: */
-/* CODA_REPLACE is a venus->kernel call */
-struct coda_replace_out { /* coda_replace is a venus->kernel call */
+struct coda_open_by_fd_out {
struct coda_out_hdr oh;
- ViceFid NewFid;
- ViceFid OldFid;
+ int fd;
+ struct file *fh;
};
/* coda_open_by_path: */
struct coda_open_by_path_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
struct coda_open_by_path_out {
struct coda_out_hdr oh;
- int path;
+ int path;
+};
+
+/* coda_statfs: NO_IN */
+struct coda_statfs_in {
+ struct coda_in_hdr ih;
+};
+
+struct coda_statfs_out {
+ struct coda_out_hdr oh;
+ struct coda_statfs stat;
};
/*
@@ -679,10 +725,10 @@ union inputArgs {
struct coda_symlink_in coda_symlink;
struct coda_readlink_in coda_readlink;
struct coda_fsync_in coda_fsync;
- struct coda_inactive_in coda_inactive;
struct coda_vget_in coda_vget;
- struct coda_rdwr_in coda_rdwr;
- struct coda_open_by_path_in coda_open_by_path;
+ struct coda_open_by_fd_in coda_open_by_fd;
+ struct coda_open_by_path_in coda_open_by_path;
+ struct coda_statfs_in coda_statfs;
};
union outputArgs {
@@ -702,9 +748,10 @@ union outputArgs {
struct coda_zapdir_out coda_zapdir;
struct coda_zapvnode_out coda_zapvnode;
struct coda_purgefid_out coda_purgefid;
- struct coda_rdwr_out coda_rdwr;
struct coda_replace_out coda_replace;
- struct coda_open_by_path_out coda_open_by_path;
+ struct coda_open_by_fd_out coda_open_by_fd;
+ struct coda_open_by_path_out coda_open_by_path;
+ struct coda_statfs_out coda_statfs;
};
union coda_downcalls {
@@ -747,15 +794,32 @@ struct PioctlData {
#define CODA_CONTROL ".CONTROL"
#define CODA_CONTROLLEN 8
-#define CTL_VOL -1
-#define CTL_VNO -1
-#define CTL_UNI -1
#define CTL_INO -1
#define CTL_FILE "/coda/.CONTROL"
+#ifdef CODA_COMPAT_5
+#define CTL_FID { -1, -1, -1 }
+#define IS_CTL_FID(fidp) ((fidp)->Volume == -1 &&\
+ (fidp)->Vnode == -1 &&\
+ (fidp)->Unique == -1)
+#define INVAL_FID { 0, 0, 0 }
+#else
+#define CTL_FID { { -1, -1, -1, -1 } }
+#define IS_CTL_FID(fidp) ((fidp)->opaque[0] == -1 &&\
+ (fidp)->opaque[1] == -1 &&\
+ (fidp)->opaque[2] == -1 &&\
+ (fidp)->opaque[3] == -1)
+#define INVAL_FID { { 0, 0, 0, 0 } }
+#endif
+
+/* Data passed to mount */
+
+#define CODA_MOUNT_VERSION 1
+
+struct coda_mount_data {
+ int version;
+ int fd; /* Opened device */
+};
-#define IS_CTL_FID(fidp) ((fidp)->Volume == CTL_VOL &&\
- (fidp)->Vnode == CTL_VNO &&\
- (fidp)->Unique == CTL_UNI)
#endif
diff --git a/sys/coda/coda_namecache.c b/sys/coda/coda_namecache.c
index 9c54119..5f8106a 100644
--- a/sys/coda/coda_namecache.c
+++ b/sys/coda/coda_namecache.c
@@ -354,10 +354,8 @@ coda_nc_remove(cncp, dcstat)
* place it at the head of the lru list.
*/
CODA_NC_DEBUG(CODA_NC_REMOVE,
- myprintf(("coda_nc_remove %s from parent %lx.%lx.%lx\n",
- cncp->name, (cncp->dcp)->c_fid.Volume,
- (cncp->dcp)->c_fid.Vnode, (cncp->dcp)->c_fid.Unique));)
-
+ myprintf(("coda_nc_remove %s from parent %s\n",
+ cncp->name, coda_f2s(&cncp->dcp->c_fid))); )
CODA_NC_HSHREM(cncp);
CODA_NC_HSHNUL(cncp); /* have it be a null chain */
@@ -385,7 +383,7 @@ coda_nc_remove(cncp, dcstat)
*/
void
coda_nc_zapParentfid(fid, dcstat)
- ViceFid *fid;
+ CodaFid *fid;
enum dc_status dcstat;
{
/* To get to a specific fid, we might either have another hashing
@@ -397,11 +395,10 @@ coda_nc_zapParentfid(fid, dcstat)
int i;
if (coda_nc_use == 0) /* Cache is off */
- return;
+ return;
CODA_NC_DEBUG(CODA_NC_ZAPPFID,
- myprintf(("ZapParent: fid 0x%lx, 0x%lx, 0x%lx \n",
- fid->Volume, fid->Vnode, fid->Unique)); )
+ myprintf(("ZapParent: fid %s\n", coda_f2s(fid))); )
coda_nc_stat.zapPfids++;
@@ -416,9 +413,7 @@ coda_nc_zapParentfid(fid, dcstat)
cncp != (struct coda_cache *)&coda_nc_hash[i];
cncp = ncncp) {
ncncp = cncp->hash_next;
- if ((cncp->dcp->c_fid.Volume == fid->Volume) &&
- (cncp->dcp->c_fid.Vnode == fid->Vnode) &&
- (cncp->dcp->c_fid.Unique == fid->Unique)) {
+ if (coda_fid_eq(&(cncp->dcp->c_fid), fid)) {
coda_nc_hash[i].length--; /* Used for tuning */
coda_nc_remove(cncp, dcstat);
}
@@ -432,7 +427,7 @@ coda_nc_zapParentfid(fid, dcstat)
*/
void
coda_nc_zapfid(fid, dcstat)
- ViceFid *fid;
+ CodaFid *fid;
enum dc_status dcstat;
{
/* See comment for zapParentfid. This routine will be used
@@ -445,8 +440,7 @@ coda_nc_zapfid(fid, dcstat)
return;
CODA_NC_DEBUG(CODA_NC_ZAPFID,
- myprintf(("Zapfid: fid 0x%lx, 0x%lx, 0x%lx \n",
- fid->Volume, fid->Vnode, fid->Unique)); )
+ myprintf(("Zapfid: fid %s\n", coda_f2s(fid))); )
coda_nc_stat.zapFids++;
@@ -455,11 +449,9 @@ coda_nc_zapfid(fid, dcstat)
cncp != (struct coda_cache *)&coda_nc_hash[i];
cncp = ncncp) {
ncncp = cncp->hash_next;
- if ((cncp->cp->c_fid.Volume == fid->Volume) &&
- (cncp->cp->c_fid.Vnode == fid->Vnode) &&
- (cncp->cp->c_fid.Unique == fid->Unique)) {
- coda_nc_hash[i].length--; /* Used for tuning */
- coda_nc_remove(cncp, dcstat);
+ if (coda_fid_eq(&cncp->cp->c_fid, fid)) {
+ coda_nc_hash[i].length--; /* Used for tuning */
+ coda_nc_remove(cncp, dcstat);
}
}
}
@@ -470,7 +462,7 @@ coda_nc_zapfid(fid, dcstat)
*/
void
coda_nc_zapvnode(fid, cred, dcstat)
- ViceFid *fid;
+ CodaFid *fid;
struct ucred *cred;
enum dc_status dcstat;
{
@@ -478,12 +470,15 @@ coda_nc_zapvnode(fid, cred, dcstat)
want to zap a file with a specific cred from the kernel.
We'll leave this one unimplemented.
*/
+
if (coda_nc_use == 0) /* Cache is off */
return;
- CODA_NC_DEBUG(CODA_NC_ZAPVNODE,
- myprintf(("Zapvnode: fid 0x%lx, 0x%lx, 0x%lx cred %p\n",
- fid->Volume, fid->Vnode, fid->Unique, cred)); )
+ CODA_NC_DEBUG(CODA_NC_ZAPVNODE,
+ myprintf(("Zapvnode: fid %s cred %p\n",
+ coda_f2s(fid), cred)); )
+
+
}
@@ -533,7 +528,7 @@ coda_nc_zapfile(dcp, name, namelen)
*/
void
coda_nc_purge_user(uid, dcstat)
- vuid_t uid;
+ uid_t uid;
enum dc_status dcstat;
{
/*
@@ -616,7 +611,8 @@ coda_nc_flush(dcstat)
if (CTOV(cncp->cp)->v_vflag & VV_TEXT) {
if (coda_vmflush(cncp->cp))
CODADEBUG(CODA_FLUSH,
- myprintf(("coda_nc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); )
+ myprintf(("coda_nc_flush: %s busy\n",
+ coda_f2s(&cncp->cp->c_fid))); )
}
if ((dcstat == IS_DOWNCALL)
diff --git a/sys/coda/coda_namecache.h b/sys/coda/coda_namecache.h
index fb9ae8c..13bb99d 100644
--- a/sys/coda/coda_namecache.h
+++ b/sys/coda/coda_namecache.h
@@ -140,11 +140,11 @@ extern void coda_nc_init(void);
extern void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *);
-extern void coda_nc_zapParentfid(ViceFid *, enum dc_status);
-extern void coda_nc_zapfid(ViceFid *, enum dc_status);
-extern void coda_nc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
+extern void coda_nc_zapParentfid(CodaFid *, enum dc_status);
+extern void coda_nc_zapfid(CodaFid *, enum dc_status);
+extern void coda_nc_zapvnode(CodaFid *, struct ucred *, enum dc_status);
extern void coda_nc_zapfile(struct cnode *, const char *, int);
-extern void coda_nc_purge_user(vuid_t, enum dc_status);
+extern void coda_nc_purge_user(uid_t, enum dc_status);
extern void coda_nc_flush(enum dc_status);
extern void print_coda_nc(void);
diff --git a/sys/coda/coda_subr.c b/sys/coda/coda_subr.c
index 36df51d..f9e0f56 100644
--- a/sys/coda/coda_subr.c
+++ b/sys/coda/coda_subr.c
@@ -74,9 +74,16 @@ int coda_new = 0;
struct cnode *coda_freelist = NULL;
struct cnode *coda_cache[CODA_CACHESIZE];
-#define coda_hash(fid) (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1))
#define CNODE_NEXT(cp) ((cp)->c_next)
-#define ODD(vnode) ((vnode) & 0x1)
+
+#ifdef CODA_COMPAT_5
+#define coda_hash(fid) \
+ (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1))
+#define IS_DIR(cnode) (cnode.Vnode & 0x1)
+#else
+#define coda_hash(fid) (coda_f2i(fid) & (CODA_CACHESIZE-1))
+#define IS_DIR(cnode) (cnode.opaque[2] & 0x1)
+#endif
/*
* Allocate a cnode.
@@ -161,15 +168,13 @@ coda_unsave(cp)
*/
struct cnode *
coda_find(fid)
- ViceFid *fid;
+ CodaFid *fid;
{
struct cnode *cp;
cp = coda_cache[coda_hash(fid)];
while (cp) {
- if ((cp->c_fid.Vnode == fid->Vnode) &&
- (cp->c_fid.Volume == fid->Volume) &&
- (cp->c_fid.Unique == fid->Unique) &&
+ if (coda_fid_eq(&(cp->c_fid), fid) &&
(!IS_UNMOUNTING(cp)))
{
coda_active++;
@@ -218,12 +223,10 @@ coda_kill(whoIam, dcstat)
#endif
count++;
CODADEBUG(CODA_FLUSH,
- myprintf(("Live cnode fid %lx.%lx.%lx flags %d count %d\n",
- (cp->c_fid).Volume,
- (cp->c_fid).Vnode,
- (cp->c_fid).Unique,
- cp->c_flags,
- vrefcnt(CTOV(cp)))); );
+ myprintf(("Live cnode fid %s flags %d count %d\n",
+ coda_f2s(&cp->c_fid),
+ cp->c_flags,
+ vrefcnt(CTOV(cp)))); );
}
}
}
@@ -248,7 +251,7 @@ coda_flush(dcstat)
for (hash = 0; hash < CODA_CACHESIZE; hash++) {
for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
- if (!ODD(cp->c_fid.Vnode)) /* only files can be executed */
+ if (!IS_DIR(cp->c_fid)) /* only files can be executed */
coda_vmflush(cp);
}
}
@@ -268,9 +271,8 @@ coda_testflush(void)
for (cp = coda_cache[hash];
cp != NULL;
cp = CNODE_NEXT(cp)) {
- myprintf(("Live cnode fid %lx.%lx.%lx count %d\n",
- (cp->c_fid).Volume,(cp->c_fid).Vnode,
- (cp->c_fid).Unique, vrefcnt(CTOV(cp))));
+ myprintf(("Live cnode fid %s count %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount));
}
}
}
@@ -373,7 +375,7 @@ coda_cacheprint(whoIam)
* The sixth allows Venus to replace local fids with global ones
* during reintegration.
*
- * CODA_REPLACE -- replace one ViceFid with another throughout the name cache
+ * CODA_REPLACE -- replace one CodaFid with another throughout the name cache
*/
int handleDownCall(opcode, out)
@@ -396,7 +398,11 @@ int handleDownCall(opcode, out)
coda_clstat.reqs[CODA_PURGEUSER]++;
/* XXX - need to prevent fsync's */
+#ifdef CODA_COMPAT_5
coda_nc_purge_user(out->coda_purgeuser.cred.cr_uid, IS_DOWNCALL);
+#else
+ coda_nc_purge_user(out->coda_purgeuser.uid, IS_DOWNCALL);
+#endif
return(0);
}
@@ -407,7 +413,7 @@ int handleDownCall(opcode, out)
coda_clstat.ncalls++;
coda_clstat.reqs[CODA_ZAPFILE]++;
- cp = coda_find(&out->coda_zapfile.CodaFid);
+ cp = coda_find(&out->coda_zapfile.Fid);
if (cp != NULL) {
vref(CTOV(cp));
@@ -415,11 +421,10 @@ int handleDownCall(opcode, out)
ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall");
if (CTOV(cp)->v_vflag & VV_TEXT)
error = coda_vmflush(cp);
- CODADEBUG(CODA_ZAPFILE, myprintf((
-"zapfile: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique,
- vrefcnt(CTOV(cp)) - 1, error)););
- if (vrefcnt(CTOV(cp)) == 1) {
+ CODADEBUG(CODA_ZAPFILE,
+ myprintf(("zapfile: fid = %s, refcnt = %d, error = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1, error)););
+ if (vrefcnt(CTOV(cp)) == 1) {
cp->c_flags |= C_PURGING;
}
vrele(CTOV(cp));
@@ -434,17 +439,16 @@ int handleDownCall(opcode, out)
coda_clstat.ncalls++;
coda_clstat.reqs[CODA_ZAPDIR]++;
- cp = coda_find(&out->coda_zapdir.CodaFid);
+ cp = coda_find(&out->coda_zapdir.Fid);
if (cp != NULL) {
vref(CTOV(cp));
cp->c_flags &= ~C_VATTR;
- coda_nc_zapParentfid(&out->coda_zapdir.CodaFid, IS_DOWNCALL);
+ coda_nc_zapParentfid(&out->coda_zapdir.Fid, IS_DOWNCALL);
CODADEBUG(CODA_ZAPDIR, myprintf((
-"zapdir: fid = (%lx.%lx.%lx), refcnt = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique,
- vrefcnt(CTOV(cp)) - 1)););
+ "zapdir: fid = %s, refcnt = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1)););
if (vrefcnt(CTOV(cp)) == 1) {
cp->c_flags |= C_PURGING;
}
@@ -461,25 +465,23 @@ int handleDownCall(opcode, out)
coda_clstat.ncalls++;
coda_clstat.reqs[CODA_PURGEFID]++;
- cp = coda_find(&out->coda_purgefid.CodaFid);
+ cp = coda_find(&out->coda_purgefid.Fid);
if (cp != NULL) {
vref(CTOV(cp));
- if (ODD(out->coda_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */
- coda_nc_zapParentfid(&out->coda_purgefid.CodaFid,
- IS_DOWNCALL);
+ if (IS_DIR(out->coda_purgefid.Fid)) { /* Vnode is a directory */
+ coda_nc_zapParentfid(&out->coda_purgefid.Fid,IS_DOWNCALL);
}
cp->c_flags &= ~C_VATTR;
- coda_nc_zapfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL);
+ coda_nc_zapfid(&out->coda_purgefid.Fid, IS_DOWNCALL);
ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall");
- if (!(ODD(out->coda_purgefid.CodaFid.Vnode))
+ if (!(IS_DIR(out->coda_purgefid.Fid))
&& (CTOV(cp)->v_vflag & VV_TEXT)) {
error = coda_vmflush(cp);
}
- CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique,
- vrefcnt(CTOV(cp)) - 1, error)););
+ CODADEBUG(CODA_PURGEFID, myprintf((
+ "purgefid: fid = %s, refcnt = %d, error = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1, error)););
if (vrefcnt(CTOV(cp)) == 1) {
cp->c_flags |= C_PURGING;
}
@@ -502,13 +504,10 @@ int handleDownCall(opcode, out)
cp->c_fid = out->coda_replace.NewFid;
coda_save(cp);
- CODADEBUG(CODA_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n",
- out->coda_replace.OldFid.Volume,
- out->coda_replace.OldFid.Vnode,
- out->coda_replace.OldFid.Unique,
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique, cp));)
- vrele(CTOV(cp));
+ CODADEBUG(CODA_REPLACE, myprintf((
+ "replace: oldfid = %s, newfid = %s, cp = %p\n",
+ coda_f2s(&out->coda_replace.OldFid),
+ coda_f2s(&cp->c_fid), cp));) vrele(CTOV(cp));
}
return (0);
}
diff --git a/sys/coda/coda_subr.h b/sys/coda/coda_subr.h
index 71c8a3d..2b026eb 100644
--- a/sys/coda/coda_subr.h
+++ b/sys/coda/coda_subr.h
@@ -33,7 +33,7 @@
struct cnode *coda_alloc(void);
void coda_free(struct cnode *cp);
-struct cnode *coda_find(ViceFid *fid);
+struct cnode *coda_find(CodaFid *fid);
void coda_flush(enum dc_status dcstat);
void coda_testflush(void);
void coda_checkunmounting(struct mount *mp);
diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c
index f1eac62..8067226 100644
--- a/sys/coda/coda_venus.c
+++ b/sys/coda/coda_venus.c
@@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$");
((char*)inp + (int)inp->struc)[len++] = 0; \
Isize += len
+#ifdef CODA_COMPAT_5
#define INIT_IN(in, op, ident, p) \
(in)->opcode = (op); \
sx_slock(&proctree_lock); \
@@ -107,8 +108,18 @@ __FBSDID("$FreeBSD$");
bzero(&((in)->cred),sizeof(struct coda_cred)); \
(in)->cred.cr_uid = -1; \
(in)->cred.cr_groupid = -1; \
- } \
-
+ }
+#else
+#define INIT_IN(in, op, ident, p) \
+ (in)->opcode = (op); \
+ (in)->pid = p ? p->p_pid : -1; \
+ (in)->pgid = p ? p->p_pgid : -1; \
+ if (ident != NOCRED) { \
+ (in)->uid = ident->cr_uid; \
+ } else { \
+ (in)->uid = -1; \
+ }
+#endif
#define CNV_OFLAG(to, from) \
do { \
to = 0; \
@@ -168,7 +179,7 @@ int coda_kernel_version = CODA_KERNEL_VERSION;
int
venus_root(void *mdp,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid)
+/*out*/ CodaFid *VFid)
{
DECL_NO_IN(coda_root); /* sets Isize & Osize */
ALLOC_NO_IN(coda_root); /* sets inp & outp */
@@ -178,14 +189,14 @@ venus_root(void *mdp,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error)
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
CODA_FREE(inp, coda_root_size);
return error;
}
int
-venus_open(void *mdp, ViceFid *fid, int flag,
+venus_open(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p,
/*out*/ dev_t *dev, ino_t *inode)
{
@@ -195,7 +206,7 @@ venus_open(void *mdp, ViceFid *fid, int flag,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_OPEN, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_OFLAG(cflag, flag);
inp->flags = cflag;
@@ -211,7 +222,7 @@ venus_open(void *mdp, ViceFid *fid, int flag,
}
int
-venus_close(void *mdp, ViceFid *fid, int flag,
+venus_close(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p)
{
int cflag;
@@ -219,7 +230,7 @@ venus_close(void *mdp, ViceFid *fid, int flag,
ALLOC_NO_OUT(coda_close); /* sets inp & outp */
INIT_IN(&inp->ih, CODA_CLOSE, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_OFLAG(cflag, flag);
inp->flags = cflag;
@@ -248,7 +259,7 @@ venus_write(void)
* normal files.
*/
int
-venus_ioctl(void *mdp, ViceFid *fid,
+venus_ioctl(void *mdp, CodaFid *fid,
int com, int flag, caddr_t data,
struct ucred *cred, struct proc *p)
{
@@ -260,7 +271,7 @@ venus_ioctl(void *mdp, ViceFid *fid,
ALLOC(coda_ioctl); /* sets inp & outp */
INIT_IN(&inp->ih, CODA_IOCTL, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
/* command was mutated by increasing its size field to reflect the
* path and follow args. we need to subtract that out before sending
@@ -299,7 +310,7 @@ venus_ioctl(void *mdp, ViceFid *fid,
}
int
-venus_getattr(void *mdp, ViceFid *fid,
+venus_getattr(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ struct vattr *vap)
{
@@ -308,7 +319,7 @@ venus_getattr(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_GETATTR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
@@ -320,7 +331,7 @@ venus_getattr(void *mdp, ViceFid *fid,
}
int
-venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
+venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap,
struct ucred *cred, struct proc *p)
{
DECL_NO_OUT(coda_setattr); /* sets Isize & Osize */
@@ -328,7 +339,7 @@ venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_SETATTR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_V2VV_ATTR(&inp->attr, vap);
error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -338,7 +349,7 @@ venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
}
int
-venus_access(void *mdp, ViceFid *fid, int mode,
+venus_access(void *mdp, CodaFid *fid, int mode,
struct ucred *cred, struct proc *p)
{
DECL_NO_OUT(coda_access); /* sets Isize & Osize */
@@ -346,7 +357,7 @@ venus_access(void *mdp, ViceFid *fid, int mode,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_ACCESS, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
/* NOTE:
* NetBSD and Venus internals use the "data" in the low 3 bits.
* Hence, the conversion.
@@ -360,7 +371,7 @@ venus_access(void *mdp, ViceFid *fid, int mode,
}
int
-venus_readlink(void *mdp, ViceFid *fid,
+venus_readlink(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ char **str, int *len)
{
@@ -370,7 +381,7 @@ venus_readlink(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_READLINK, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
Osize += CODA_MAXPATHLEN;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -385,7 +396,7 @@ venus_readlink(void *mdp, ViceFid *fid,
}
int
-venus_fsync(void *mdp, ViceFid *fid,
+venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p)
{
DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */
@@ -393,7 +404,7 @@ venus_fsync(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_FSYNC, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -402,10 +413,10 @@ venus_fsync(void *mdp, ViceFid *fid,
}
int
-venus_lookup(void *mdp, ViceFid *fid,
+venus_lookup(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype)
+/*out*/ CodaFid *VFid, int *vtype)
{
DECL(coda_lookup); /* sets Isize & Osize */
coda_lookup_size += len + 1;
@@ -413,7 +424,7 @@ venus_lookup(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_LOOKUP, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
/* NOTE:
* Between version 1 and version 2 we have added an extra flag field
@@ -430,7 +441,7 @@ venus_lookup(void *mdp, ViceFid *fid,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
*vtype = outp->vtype;
}
@@ -439,10 +450,10 @@ venus_lookup(void *mdp, ViceFid *fid,
}
int
-venus_create(void *mdp, ViceFid *fid,
+venus_create(void *mdp, CodaFid *fid,
const char *nm, int len, int exclusive, int mode, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *attr)
+/*out*/ CodaFid *VFid, struct vattr *attr)
{
DECL(coda_create); /* sets Isize & Osize */
coda_create_size += len + 1;
@@ -450,7 +461,7 @@ venus_create(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_CREATE, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->excl = exclusive ? C_O_EXCL : 0;
inp->mode = mode;
CNV_V2VV_ATTR(&inp->attr, va);
@@ -460,7 +471,7 @@ venus_create(void *mdp, ViceFid *fid,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
CNV_VV2V_ATTR(attr, &outp->attr);
}
@@ -469,7 +480,7 @@ venus_create(void *mdp, ViceFid *fid,
}
int
-venus_remove(void *mdp, ViceFid *fid,
+venus_remove(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p)
{
@@ -479,7 +490,7 @@ venus_remove(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_REMOVE, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->name = Isize;
STRCPY(name, nm, len); /* increments Isize */
@@ -491,7 +502,7 @@ venus_remove(void *mdp, ViceFid *fid,
}
int
-venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_link(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len,
struct ucred *cred, struct proc *p)
{
@@ -514,7 +525,7 @@ venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
}
int
-venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_rename(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len, const char *tnm, int tlen,
struct ucred *cred, struct proc *p)
{
@@ -540,10 +551,10 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
}
int
-venus_mkdir(void *mdp, ViceFid *fid,
+venus_mkdir(void *mdp, CodaFid *fid,
const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *ova)
+/*out*/ CodaFid *VFid, struct vattr *ova)
{
DECL(coda_mkdir); /* sets Isize & Osize */
coda_mkdir_size += len + 1;
@@ -551,7 +562,7 @@ venus_mkdir(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_MKDIR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_V2VV_ATTR(&inp->attr, va);
inp->name = Isize;
@@ -559,7 +570,7 @@ venus_mkdir(void *mdp, ViceFid *fid,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
CNV_VV2V_ATTR(ova, &outp->attr);
}
@@ -568,7 +579,7 @@ venus_mkdir(void *mdp, ViceFid *fid,
}
int
-venus_rmdir(void *mdp, ViceFid *fid,
+venus_rmdir(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p)
{
@@ -578,7 +589,7 @@ venus_rmdir(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_RMDIR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->name = Isize;
STRCPY(name, nm, len); /* increments Isize */
@@ -590,7 +601,7 @@ venus_rmdir(void *mdp, ViceFid *fid,
}
int
-venus_symlink(void *mdp, ViceFid *fid,
+venus_symlink(void *mdp, CodaFid *fid,
const char *lnm, int llen, const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p)
{
@@ -600,7 +611,7 @@ venus_symlink(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_SYMLINK, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_V2VV_ATTR(&inp->attr, va);
inp->srcname = Isize;
@@ -616,7 +627,7 @@ venus_symlink(void *mdp, ViceFid *fid,
}
int
-venus_readdir(void *mdp, ViceFid *fid,
+venus_readdir(void *mdp, CodaFid *fid,
int count, int offset,
struct ucred *cred, struct proc *p,
/*out*/ char *buffer, int *len)
@@ -627,7 +638,7 @@ venus_readdir(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_READDIR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->count = count;
inp->offset = offset;
@@ -643,20 +654,20 @@ venus_readdir(void *mdp, ViceFid *fid,
}
int
-venus_fhtovp(void *mdp, ViceFid *fid,
+venus_fhtovp(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype)
+/*out*/ CodaFid *VFid, int *vtype)
{
DECL(coda_vget); /* sets Isize & Osize */
ALLOC(coda_vget); /* sets inp & outp */
/* Send the open to Venus. */
INIT_IN(&inp->ih, CODA_VGET, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
*vtype = outp->vtype;
}
diff --git a/sys/coda/coda_venus.h b/sys/coda/coda_venus.h
index 392a73f..b506b5b 100644
--- a/sys/coda/coda_venus.h
+++ b/sys/coda/coda_venus.h
@@ -34,15 +34,15 @@
int
venus_root(void *mdp,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid);
+/*out*/ CodaFid *VFid);
int
-venus_open(void *mdp, ViceFid *fid, int flag,
+venus_open(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p,
/*out*/ dev_t *dev, ino_t *inode);
int
-venus_close(void *mdp, ViceFid *fid, int flag,
+venus_close(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p);
void
@@ -52,82 +52,82 @@ void
venus_write(void);
int
-venus_ioctl(void *mdp, ViceFid *fid,
+venus_ioctl(void *mdp, CodaFid *fid,
int com, int flag, caddr_t data,
struct ucred *cred, struct proc *p);
int
-venus_getattr(void *mdp, ViceFid *fid,
+venus_getattr(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ struct vattr *vap);
int
-venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
+venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap,
struct ucred *cred, struct proc *p);
int
-venus_access(void *mdp, ViceFid *fid, int mode,
+venus_access(void *mdp, CodaFid *fid, int mode,
struct ucred *cred, struct proc *p);
int
-venus_readlink(void *mdp, ViceFid *fid,
+venus_readlink(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ char **str, int *len);
int
-venus_fsync(void *mdp, ViceFid *fid,
+venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p);
int
-venus_lookup(void *mdp, ViceFid *fid,
+venus_lookup(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype);
+/*out*/ CodaFid *VFid, int *vtype);
int
-venus_create(void *mdp, ViceFid *fid,
+venus_create(void *mdp, CodaFid *fid,
const char *nm, int len, int exclusive, int mode, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *attr);
+/*out*/ CodaFid *VFid, struct vattr *attr);
int
-venus_remove(void *mdp, ViceFid *fid,
+venus_remove(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p);
int
-venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_link(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len,
struct ucred *cred, struct proc *p);
int
-venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_rename(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len, const char *tnm, int tlen,
struct ucred *cred, struct proc *p);
int
-venus_mkdir(void *mdp, ViceFid *fid,
+venus_mkdir(void *mdp, CodaFid *fid,
const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *ova);
+/*out*/ CodaFid *VFid, struct vattr *ova);
int
-venus_rmdir(void *mdp, ViceFid *fid,
+venus_rmdir(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p);
int
-venus_symlink(void *mdp, ViceFid *fid,
+venus_symlink(void *mdp, CodaFid *fid,
const char *lnm, int llen, const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p);
int
-venus_readdir(void *mdp, ViceFid *fid,
+venus_readdir(void *mdp, CodaFid *fid,
int count, int offset,
struct ucred *cred, struct proc *p,
/*out*/ char *buffer, int *len);
int
-venus_fhtovp(void *mdp, ViceFid *fid,
+venus_fhtovp(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype);
+/*out*/ CodaFid *VFid, int *vtype);
diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c
index 3c326bd..fff32303 100644
--- a/sys/coda/coda_vfsops.c
+++ b/sys/coda/coda_vfsops.c
@@ -117,8 +117,8 @@ coda_mount(vfsp, path, data, ndp, td)
dev_t dev;
struct coda_mntinfo *mi;
struct vnode *rootvp;
- ViceFid rootfid;
- ViceFid ctlfid;
+ CodaFid rootfid = INVAL_FID;
+ CodaFid ctlfid = CTL_FID;
int error;
ENTRY;
@@ -187,16 +187,10 @@ coda_mount(vfsp, path, data, ndp, td)
* actually make the CODA_ROOT call to venus until the first call
* to coda_root in case a server is down while venus is starting.
*/
- rootfid.Volume = 0;
- rootfid.Vnode = 0;
- rootfid.Unique = 0;
cp = make_coda_node(&rootfid, vfsp, VDIR);
rootvp = CTOV(cp);
rootvp->v_vflag |= VV_ROOT;
- ctlfid.Volume = CTL_VOL;
- ctlfid.Vnode = CTL_VNO;
- ctlfid.Unique = CTL_UNI;
/* cp = make_coda_node(&ctlfid, vfsp, VCHR);
The above code seems to cause a loop in the cnode links.
I don't totally understand when it happens, it is caught
@@ -255,7 +249,6 @@ coda_unmount(vfsp, mntflags, td)
printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp));
#endif
vrele(mi->mi_rootvp);
-
active = coda_kill(vfsp, NOT_DOWNCALL);
ASSERT_VOP_LOCKED(mi->mi_rootvp, "coda_unmount");
mi->mi_rootvp->v_vflag &= ~VV_ROOT;
@@ -294,7 +287,8 @@ coda_root(vfsp, vpp)
int error;
struct thread *td = curthread; /* XXX - bnoble */
struct proc *p = td->td_proc;
- ViceFid VFid;
+ CodaFid VFid;
+ static const CodaFid invalfid = INVAL_FID;
ENTRY;
MARK_ENTRY(CODA_ROOT_STATS);
@@ -312,10 +306,8 @@ coda_root(vfsp, vpp)
* node to avoid a deadlock. This bug is fixed in the Coda CVS
* repository but not in any released versions as of 6 Mar 2003.
*/
- if ((VTOC(mi->mi_rootvp)->c_fid.Volume != 0) ||
- (VTOC(mi->mi_rootvp)->c_fid.Vnode != 0) ||
- (VTOC(mi->mi_rootvp)->c_fid.Unique != 0) ||
- mi->mi_started == 0)
+ if (memcmp(&VTOC(mi->mi_rootvp)->c_fid, &invalfid,
+ sizeof(CodaFid)) != 0 || mi->mi_started == 0)
{ /* Found valid root. */
*vpp = mi->mi_rootvp;
/* On Mach, this is vref. On NetBSD, VOP_LOCK */
@@ -469,7 +461,7 @@ coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
int error;
struct thread *td = curthread; /* XXX -mach */
struct proc *p = td->td_proc;
- ViceFid VFid;
+ CodaFid VFid;
int vtype;
ENTRY;
@@ -490,9 +482,8 @@ coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
*vpp = (struct vnode *)0;
} else {
CODADEBUG(CODA_VGET,
- myprintf(("vget: vol %lx vno %lx uni %lx type %d result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); )
-
+ myprintf(("vget: %s type %d result %d\n",
+ coda_f2s(&VFid), vtype, error)); )
cp = make_coda_node(&VFid, vfsp, vtype);
*vpp = CTOV(cp);
}
@@ -514,7 +505,7 @@ getNewVnode(vpp)
ENTRY;
- cfid.cfid_len = (short)sizeof(ViceFid);
+ cfid.cfid_len = (short)sizeof(CodaFid);
cfid.cfid_fid = VTOC(*vpp)->c_fid; /* Structure assignment. */
/* XXX ? */
diff --git a/sys/coda/coda_vfsops.h b/sys/coda/coda_vfsops.h
index fbbcec4..6d36232 100644
--- a/sys/coda/coda_vfsops.h
+++ b/sys/coda/coda_vfsops.h
@@ -40,7 +40,7 @@
struct cfid {
u_short cfid_len;
u_short padding;
- ViceFid cfid_fid;
+ CodaFid cfid_fid;
};
struct mbuf;
diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c
index 8e44455..a1d24e9 100644
--- a/sys/coda/coda_vnops.c
+++ b/sys/coda/coda_vnops.c
@@ -489,10 +489,8 @@ printf("coda_rdwr: Internally Opening %p\n", vp);
}
/* Have UFS handle the call. */
- CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique, vrefcnt(CTOV(cp)))); )
-
+ CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = %s, refcnt = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount)); )
if (rw == UIO_READ) {
error = VOP_READ(cfvp, uiop, ioflag, cred);
} else {
@@ -639,10 +637,8 @@ coda_getattr(v)
/* Check to see if the attributes have already been cached */
if (VALID_VATTR(cp)) {
- CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n",
- cp->c_fid.Volume,
- cp->c_fid.Vnode,
- cp->c_fid.Unique));});
+ CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: %s\n",
+ coda_f2s(&cp->c_fid)));});
CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR))
print_vattr(&cp->c_vattr); );
@@ -654,11 +650,8 @@ coda_getattr(v)
error = venus_getattr(vtomi(vp), &cp->c_fid, cred, td->td_proc, vap);
if (!error) {
- CODADEBUG(CODA_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n",
- cp->c_fid.Volume,
- cp->c_fid.Vnode,
- cp->c_fid.Unique,
- error)); )
+ CODADEBUG(CODA_GETATTR, myprintf(("getattr miss %s: result %d\n",
+ coda_f2s(&cp->c_fid), error)); )
CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR))
print_vattr(vap); );
@@ -905,10 +898,9 @@ coda_inactive(v)
return 0;
}
- CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n",
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique, vp->v_mount));)
-
+ CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %s, vfsp %p\n",
+ coda_f2s(&cp->c_fid), vp->v_mount));)
+
/* If an array has been allocated to hold the symlink, deallocate it */
if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) {
if (cp->c_symlink == NULL)
@@ -980,15 +972,14 @@ coda_lookup(v)
struct cnode *cp;
const char *nm = cnp->cn_nameptr;
int len = cnp->cn_namelen;
- ViceFid VFid;
+ CodaFid VFid;
int vtype;
int error = 0;
MARK_ENTRY(CODA_LOOKUP_STATS);
- CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n",
- nm, dcp->c_fid.Volume,
- dcp->c_fid.Vnode, dcp->c_fid.Unique)););
+ CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %s\n",
+ nm, coda_f2s(&dcp->c_fid))););
/* Check for lookup of control object. */
if (IS_CTL_NAME(dvp, nm, len)) {
@@ -1000,9 +991,9 @@ coda_lookup(v)
if (len+1 > CODA_MAXNAMLEN) {
MARK_INT_FAIL(CODA_LOOKUP_STATS);
- CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n",
- dcp->c_fid.Volume, dcp->c_fid.Vnode,
- dcp->c_fid.Unique, nm)););
+
+ CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %s (%s)\n",
+ coda_f2s(&dcp->c_fid), nm)););
*vpp = (struct vnode *)0;
error = EINVAL;
goto exit;
@@ -1022,16 +1013,15 @@ coda_lookup(v)
if (error) {
MARK_INT_FAIL(CODA_LOOKUP_STATS);
- CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n",
- dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm, error));)
+
+ CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %s (%s)%d\n",
+ coda_f2s(&dcp->c_fid), nm, error));)
*vpp = (struct vnode *)0;
} else {
MARK_INT_SAT(CODA_LOOKUP_STATS);
CODADEBUG(CODA_LOOKUP,
- myprintf(("lookup: vol %lx vno %lx uni %lx type %o result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, vtype,
- error)); )
-
+ myprintf(("lookup: %s type %o result %d\n",
+ coda_f2s(&VFid), vtype, error)); )
cp = make_coda_node(&VFid, dvp->v_mount, vtype);
*vpp = CTOV(cp);
@@ -1141,7 +1131,7 @@ coda_create(v)
struct cnode *cp;
const char *nm = cnp->cn_nameptr;
int len = cnp->cn_namelen;
- ViceFid VFid;
+ CodaFid VFid;
struct vattr attr;
MARK_ENTRY(CODA_CREATE_STATS);
@@ -1186,8 +1176,8 @@ coda_create(v)
coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp));
CODADEBUG(CODA_CREATE,
- myprintf(("create: (%lx.%lx.%lx), result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, error)); )
+ myprintf(("create: %s, result %d\n",
+ coda_f2s(&VFid), error)); )
} else {
*vpp = (struct vnode *)0;
CODADEBUG(CODA_CREATE, myprintf(("create error %d\n", error));)
@@ -1228,10 +1218,8 @@ coda_remove(v)
MARK_ENTRY(CODA_REMOVE_STATS);
- CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n",
- nm, cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique)););
-
+ CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %s\n",
+ nm, coda_f2s(&cp->c_fid))););
/* Remove the file's entry from the CODA Name Cache */
/* We're being conservative here, it might be that this person
* doesn't really have sufficient access to delete the file
@@ -1290,19 +1278,16 @@ coda_link(v)
MARK_ENTRY(CODA_LINK_STATS);
if (codadebug & CODADBGMSK(CODA_LINK)) {
-
- myprintf(("nb_link: vp fid: (%lx.%lx.%lx)\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
- myprintf(("nb_link: tdvp fid: (%lx.%lx.%lx)\n",
- tdcp->c_fid.Volume, tdcp->c_fid.Vnode, tdcp->c_fid.Unique));
-
+ myprintf(("nb_link: vp fid: %s\n",
+ coda_f2s(&cp->c_fid)));
+ myprintf(("nb_link: tdvp fid: %s)\n",
+ coda_f2s(&tdcp->c_fid)));
}
if (codadebug & CODADBGMSK(CODA_LINK)) {
- myprintf(("link: vp fid: (%lx.%lx.%lx)\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
- myprintf(("link: tdvp fid: (%lx.%lx.%lx)\n",
- tdcp->c_fid.Volume, tdcp->c_fid.Vnode, tdcp->c_fid.Unique));
-
+ myprintf(("link: vp fid: %s\n",
+ coda_f2s(&cp->c_fid)));
+ myprintf(("link: tdvp fid: %s\n",
+ coda_f2s(&tdcp->c_fid)));
}
/* Check for link to/from control object. */
@@ -1435,7 +1420,7 @@ coda_mkdir(v)
const char *nm = cnp->cn_nameptr;
int len = cnp->cn_namelen;
struct cnode *cp;
- ViceFid VFid;
+ CodaFid VFid;
struct vattr ova;
MARK_ENTRY(CODA_MKDIR_STATS);
@@ -1478,9 +1463,9 @@ coda_mkdir(v)
/* Invalidate the parent's attr cache, the modification time has changed */
VTOC(dvp)->c_flags &= ~C_VATTR;
- CODADEBUG( CODA_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, error)); )
- } else {
+ CODADEBUG( CODA_MKDIR, myprintf(("mkdir: %s result %d\n",
+ coda_f2s(&VFid), error)); )
+ } else {
*vpp = (struct vnode *)0;
CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));)
}
@@ -1663,7 +1648,7 @@ printf("coda_readdir: Internally Opening %p\n", vp);
}
/* Have UFS handle the call. */
- CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vrefcnt(vp))); )
+ CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = %s, refcnt = %d\n", coda_f2s(&cp->c_fid), vp->v_usecount)); )
error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies,
cookies);
@@ -1774,8 +1759,8 @@ coda_lock(v)
ENTRY;
if (coda_lockdebug) {
- myprintf(("Attempting lock on %lx.%lx.%lx\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
+ myprintf(("Attempting lock on %s\n",
+ coda_f2s(&cp->c_fid)));
}
#ifndef DEBUG_LOCKS
@@ -1800,8 +1785,8 @@ coda_unlock(v)
ENTRY;
if (coda_lockdebug) {
- myprintf(("Attempting unlock on %lx.%lx.%lx\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
+ myprintf(("Attempting unlock on %s\n",
+ coda_f2s(&cp->c_fid)));
}
return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, td));
@@ -1920,14 +1905,14 @@ print_cred(cred)
/*
* Return a vnode for the given fid.
* If no cnode exists for this fid create one and put it
- * in a table hashed by fid.Volume and fid.Vnode. If the cnode for
+ * in a table hashed by coda_f2i(). If the cnode for
* this fid is already in the table return it (ref count is
* incremented by coda_find. The cnode will be flushed from the
* table when coda_inactive calls coda_unsave.
*/
struct cnode *
make_coda_node(fid, vfsp, type)
- ViceFid *fid; struct mount *vfsp; short type;
+ CodaFid *fid; struct mount *vfsp; short type;
{
struct cnode *cp;
int err;
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index f822fbc..d2b934a 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -761,6 +761,9 @@ options NFS_DEBUG # Enable NFS Debugging
# Coda stuff:
options CODA #CODA filesystem.
device vcoda 4 #coda minicache <-> venus comm.
+# Use the old Coda 5.x venus<->kernel interface instead of the new
+# realms-aware 6.x protocol.
+#options CODA_COMPAT_5
#
# Add support for the EXT2FS filesystem of Linux fame. Be a bit
diff --git a/sys/conf/options b/sys/conf/options
index 29fc475..0992646 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -74,6 +74,7 @@ ADW_ALLOW_MEMIO opt_adw.h # Allow PCI devices to use memory
# Miscellaneous options.
ADAPTIVE_MUTEXES
ALQ
+CODA_COMPAT_5 opt_coda.h
COMPAT_43 opt_compat.h
COMPAT_FREEBSD4 opt_compat.h
COMPAT_SUNOS opt_compat.h
diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h
index 450adc3..540831c 100644
--- a/sys/fs/coda/cnode.h
+++ b/sys/fs/coda/cnode.h
@@ -101,7 +101,7 @@ do { \
struct cnode {
struct vnode *c_vnode;
u_short c_flags; /* flags (see below) */
- ViceFid c_fid; /* file handle */
+ CodaFid c_fid; /* file handle */
struct lock c_lock; /* new lock protocol */
struct vnode *c_ovp; /* open vnode pointer */
u_short c_ocount; /* count of openers */
@@ -197,7 +197,7 @@ extern void coda_unmounting(struct mount *whoIam);
extern int coda_vmflush(struct cnode *cp);
/* cfs_vnodeops.h */
-extern struct cnode *make_coda_node(ViceFid *fid, struct mount *vfsp, short type);
+extern struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
extern int coda_vnodeopstats_init(void);
/* coda_vfsops.h */
diff --git a/sys/fs/coda/coda.h b/sys/fs/coda/coda.h
index 2e59cfc..e7f1e0d 100644
--- a/sys/fs/coda/coda.h
+++ b/sys/fs/coda/coda.h
@@ -41,7 +41,7 @@
#ifndef _CODA_HEADER_
#define _CODA_HEADER_
-
+#include "opt_coda.h" /* for COMPAT_CODA_5 option */
/* Catch new _KERNEL defn for NetBSD */
#ifdef __NetBSD__
@@ -162,59 +162,70 @@ struct venus_dirent {
#endif
-#ifndef _FID_T_
-#define _FID_T_ 1
-typedef u_long VolumeId;
-typedef u_long VnodeId;
-typedef u_long Unique_t;
-typedef u_long FileVersion;
-#endif
-
-#ifndef _VICEFID_T_
-#define _VICEFID_T_ 1
-typedef struct ViceFid {
- VolumeId Volume;
- VnodeId Vnode;
- Unique_t Unique;
-} ViceFid;
-#endif /* VICEFID */
+#ifdef CODA_COMPAT_5
+typedef struct {
+ u_long Volume;
+ u_long Vnode;
+ u_long Unique;
+} CodaFid;
-#ifdef __linux__
-static __inline__ ino_t coda_f2i(struct ViceFid *fid)
+static __inline__ ino_t coda_f2i(CodaFid *fid)
{
- if ( ! fid )
- return 0;
- if (fid->Vnode == 0xfffffffe || fid->Vnode == 0xffffffff)
- return ((fid->Volume << 20) | (fid->Unique & 0xfffff));
- else
- return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20));
+ if (!fid) return 0;
+ return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20));
}
-
-#else
-#define coda_f2i(fid)\
- ((fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0)
-#endif
+static __inline__ char * coda_f2s(CodaFid *fid)
+{
+ static char fid_str [35];
+ snprintf (fid_str, 35, "[%lx.%lx.%lx]", fid->Volume,
+ fid->Vnode, fid->Unique);
+ return fid_str;
+}
+
+static __inline__ int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
+{
+ return (fid1->Volume == fid2->Volume &&
+ fid1->Vnode == fid2->Vnode &&
+ fid1->Unique == fid2->Unique);
+}
+
+struct coda_cred {
+ u_int32_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
+ u_int32_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
+};
-#ifndef __BIT_TYPES_DEFINED__
-#define u_int32_t unsigned int
-#endif
+#else /* CODA_COMPAT_5 */
+typedef struct {
+ u_int32_t opaque[4];
+} CodaFid;
-#ifndef _VUID_T_
-#define _VUID_T_
-typedef u_int32_t vuid_t;
-typedef u_int32_t vgid_t;
-#endif /*_VUID_T_ */
+static __inline__ ino_t coda_f2i(CodaFid *fid)
+{
+ if ( ! fid )
+ return 0;
+ return (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]);
+}
+
+static __inline__ char * coda_f2s(CodaFid *fid)
+ {
+ static char fid_str [35];
+ snprintf (fid_str, 35, "[%x.%x.%x.%x]", fid->opaque[0],
+ fid->opaque[1], fid->opaque[2], fid->opaque[3]);
+ return fid_str;
+ }
+
+static __inline__ int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
+{
+ return (fid1->opaque[0] == fid2->opaque[0] &&
+ fid1->opaque[1] == fid2->opaque[1] &&
+ fid1->opaque[2] == fid2->opaque[2] &&
+ fid1->opaque[3] == fid2->opaque[3]);
+}
-#ifndef _CODACRED_T_
-#define _CODACRED_T_
-struct coda_cred {
- vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
- vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
-};
-#endif
+#endif /* CODA_COMPAT_5 */
#ifndef _VENUS_VATTR_T_
#define _VENUS_VATTR_T_
@@ -227,8 +238,8 @@ struct coda_vattr {
int va_type; /* vnode type (for create) */
u_short va_mode; /* files access mode and type */
short va_nlink; /* number of references to file */
- vuid_t va_uid; /* owner user id */
- vgid_t va_gid; /* owner group id */
+ uid_t va_uid; /* owner user id */
+ gid_t va_gid; /* owner group id */
long va_fileid; /* file id */
u_quad_t va_size; /* file size in bytes */
long va_blocksize; /* blocksize preferred for i/o */
@@ -244,12 +255,21 @@ struct coda_vattr {
#endif
+/* structure used by CODA_STATFS for getting cache information from venus */
+struct coda_statfs {
+ int32_t f_blocks;
+ int32_t f_bfree;
+ int32_t f_bavail;
+ int32_t f_files;
+ int32_t f_ffree;
+};
+
/*
* Kernel <--> Venus communications.
*/
#define CODA_ROOT 2
-#define CODA_SYNC 3
+#define CODA_OPEN_BY_FD 3
#define CODA_OPEN 4
#define CODA_CLOSE 5
#define CODA_IOCTL 6
@@ -279,7 +299,8 @@ struct coda_vattr {
#define CODA_OPEN_BY_PATH 31
#define CODA_RESOLVE 32
#define CODA_REINTEGRATE 33
-#define CODA_NCALLS 34
+#define CODA_STATFS 34
+#define CODA_NCALLS 35
#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
@@ -293,21 +314,36 @@ struct coda_vattr {
#define CODA_KERNEL_VERSION 0
/* The old venus 4.6 compatible interface */
#define CODA_KERNEL_VERSION 1
-#endif
+#endif /* realms/cells */
+#ifdef CODA_COMPAT_5
/* venus_lookup gets an extra parameter to aid windows.*/
#define CODA_KERNEL_VERSION 2
+#else
+ /* 128-bit fids for realms */
+#define CODA_KERNEL_VERSION 3
+#endif
/*
* Venus <-> Coda RPC arguments
*/
+#ifdef CODA_COMPAT_5
struct coda_in_hdr {
unsigned long opcode;
- unsigned long unique; /* Keep multiple outstanding msgs distinct */
- u_short pid; /* Common to all */
- u_short pgid; /* Common to all */
+ unsigned long unique; /* Keep multiple outstanding msgs distinct */
+ u_short pid; /* Common to all */
+ u_short pgid; /* Common to all */
u_short sid; /* Common to all */
- struct coda_cred cred; /* Common to all */
+ struct coda_cred cred; /* Common to all */
};
+#else
+struct coda_in_hdr {
+ u_int32_t opcode;
+ u_int32_t unique; /* Keep multiple outstanding msgs distinct */
+ pid_t pid; /* Common to all */
+ pid_t pgid; /* Common to all */
+ uid_t uid; /* Common to all */
+};
+#endif
/* Really important that opcode and unique are 1st two fields! */
struct coda_out_hdr {
@@ -319,7 +355,7 @@ struct coda_out_hdr {
/* coda_root: NO_IN */
struct coda_root_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_root_in {
@@ -332,7 +368,7 @@ struct coda_root_in {
/* coda_open: */
struct coda_open_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
@@ -346,7 +382,7 @@ struct coda_open_out {
/* coda_close: */
struct coda_close_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
@@ -357,7 +393,7 @@ struct coda_close_out {
/* coda_ioctl: */
struct coda_ioctl_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int cmd;
int len;
int rwflag;
@@ -374,7 +410,7 @@ struct coda_ioctl_out {
/* coda_getattr: */
struct coda_getattr_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_getattr_out {
@@ -386,7 +422,7 @@ struct coda_getattr_out {
/* coda_setattr: NO_OUT */
struct coda_setattr_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
};
@@ -397,7 +433,7 @@ struct coda_setattr_out {
/* coda_access: NO_OUT */
struct coda_access_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
@@ -413,14 +449,14 @@ struct coda_access_out {
/* coda_lookup: */
struct coda_lookup_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int name; /* Place holder for data. */
int flags;
};
struct coda_lookup_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
int vtype;
};
@@ -428,7 +464,7 @@ struct coda_lookup_out {
/* coda_create: */
struct coda_create_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
int excl;
int mode;
@@ -437,7 +473,7 @@ struct coda_create_in {
struct coda_create_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
};
@@ -445,7 +481,7 @@ struct coda_create_out {
/* coda_remove: NO_OUT */
struct coda_remove_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int name; /* Place holder for data. */
};
@@ -456,8 +492,8 @@ struct coda_remove_out {
/* coda_link: NO_OUT */
struct coda_link_in {
struct coda_in_hdr ih;
- ViceFid sourceFid; /* cnode to link *to* */
- ViceFid destFid; /* Directory in which to place link */
+ CodaFid sourceFid; /* cnode to link *to* */
+ CodaFid destFid; /* Directory in which to place link */
int tname; /* Place holder for data. */
};
@@ -469,9 +505,9 @@ struct coda_link_out {
/* coda_rename: NO_OUT */
struct coda_rename_in {
struct coda_in_hdr ih;
- ViceFid sourceFid;
+ CodaFid sourceFid;
int srcname;
- ViceFid destFid;
+ CodaFid destFid;
int destname;
};
@@ -482,14 +518,14 @@ struct coda_rename_out {
/* coda_mkdir: */
struct coda_mkdir_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
int name; /* Place holder for data. */
};
struct coda_mkdir_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
struct coda_vattr attr;
};
@@ -497,7 +533,7 @@ struct coda_mkdir_out {
/* coda_rmdir: NO_OUT */
struct coda_rmdir_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int name; /* Place holder for data. */
};
@@ -508,7 +544,7 @@ struct coda_rmdir_out {
/* coda_readdir: */
struct coda_readdir_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int count;
int offset;
};
@@ -522,7 +558,7 @@ struct coda_readdir_out {
/* coda_symlink: NO_OUT */
struct coda_symlink_in {
struct coda_in_hdr ih;
- ViceFid VFid; /* Directory to put symlink in */
+ CodaFid Fid; /* Directory to put symlink in */
int srcname;
struct coda_vattr attr;
int tname;
@@ -535,7 +571,7 @@ struct coda_symlink_out {
/* coda_readlink: */
struct coda_readlink_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_readlink_out {
@@ -548,7 +584,7 @@ struct coda_readlink_out {
/* coda_fsync: NO_OUT */
struct coda_fsync_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_fsync_out {
@@ -558,18 +594,18 @@ struct coda_fsync_out {
/* coda_inactive: NO_OUT */
struct coda_inactive_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
/* coda_vget: */
struct coda_vget_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
};
struct coda_vget_out {
struct coda_out_hdr oh;
- ViceFid VFid;
+ CodaFid Fid;
int vtype;
};
@@ -582,75 +618,85 @@ struct coda_vget_out {
/* CODA_PURGEUSER is a venus->kernel call */
struct coda_purgeuser_out {
struct coda_out_hdr oh;
+#ifdef CODA_COMPAT_5
struct coda_cred cred;
+#else
+ uid_t uid;
+#endif
};
/* coda_zapfile: */
/* CODA_ZAPFILE is a venus->kernel call */
struct coda_zapfile_out {
struct coda_out_hdr oh;
- ViceFid CodaFid;
+ CodaFid Fid;
};
/* coda_zapdir: */
/* CODA_ZAPDIR is a venus->kernel call */
struct coda_zapdir_out {
struct coda_out_hdr oh;
- ViceFid CodaFid;
+ CodaFid Fid;
};
/* coda_zapnode: */
/* CODA_ZAPVNODE is a venus->kernel call */
struct coda_zapvnode_out {
struct coda_out_hdr oh;
+#ifdef CODA_COMPAT_5
struct coda_cred cred;
- ViceFid VFid;
+#endif
+ CodaFid Fid;
};
/* coda_purgefid: */
/* CODA_PURGEFID is a venus->kernel call */
struct coda_purgefid_out {
struct coda_out_hdr oh;
- ViceFid CodaFid;
+ CodaFid Fid;
};
-/* coda_rdwr: */
-struct coda_rdwr_in {
- struct coda_in_hdr ih;
- ViceFid VFid;
- int rwflag;
- int count;
- int offset;
- int ioflag;
- caddr_t data; /* Place holder for data. */
+/* coda_replace: */
+/* CODA_REPLACE is a venus->kernel call */
+struct coda_replace_out { /* coda_replace is a venus->kernel call */
+ struct coda_out_hdr oh;
+ CodaFid NewFid;
+ CodaFid OldFid;
};
-struct coda_rdwr_out {
- struct coda_out_hdr oh;
- int rwflag;
- int count;
- caddr_t data; /* Place holder for data. */
+/* coda_open_by_fd: */
+struct coda_open_by_fd_in {
+ struct coda_in_hdr ih;
+ CodaFid Fid;
+ int flags;
};
-
-/* coda_replace: */
-/* CODA_REPLACE is a venus->kernel call */
-struct coda_replace_out { /* coda_replace is a venus->kernel call */
+struct coda_open_by_fd_out {
struct coda_out_hdr oh;
- ViceFid NewFid;
- ViceFid OldFid;
+ int fd;
+ struct file *fh;
};
/* coda_open_by_path: */
struct coda_open_by_path_in {
struct coda_in_hdr ih;
- ViceFid VFid;
+ CodaFid Fid;
int flags;
};
struct coda_open_by_path_out {
struct coda_out_hdr oh;
- int path;
+ int path;
+};
+
+/* coda_statfs: NO_IN */
+struct coda_statfs_in {
+ struct coda_in_hdr ih;
+};
+
+struct coda_statfs_out {
+ struct coda_out_hdr oh;
+ struct coda_statfs stat;
};
/*
@@ -679,10 +725,10 @@ union inputArgs {
struct coda_symlink_in coda_symlink;
struct coda_readlink_in coda_readlink;
struct coda_fsync_in coda_fsync;
- struct coda_inactive_in coda_inactive;
struct coda_vget_in coda_vget;
- struct coda_rdwr_in coda_rdwr;
- struct coda_open_by_path_in coda_open_by_path;
+ struct coda_open_by_fd_in coda_open_by_fd;
+ struct coda_open_by_path_in coda_open_by_path;
+ struct coda_statfs_in coda_statfs;
};
union outputArgs {
@@ -702,9 +748,10 @@ union outputArgs {
struct coda_zapdir_out coda_zapdir;
struct coda_zapvnode_out coda_zapvnode;
struct coda_purgefid_out coda_purgefid;
- struct coda_rdwr_out coda_rdwr;
struct coda_replace_out coda_replace;
- struct coda_open_by_path_out coda_open_by_path;
+ struct coda_open_by_fd_out coda_open_by_fd;
+ struct coda_open_by_path_out coda_open_by_path;
+ struct coda_statfs_out coda_statfs;
};
union coda_downcalls {
@@ -747,15 +794,32 @@ struct PioctlData {
#define CODA_CONTROL ".CONTROL"
#define CODA_CONTROLLEN 8
-#define CTL_VOL -1
-#define CTL_VNO -1
-#define CTL_UNI -1
#define CTL_INO -1
#define CTL_FILE "/coda/.CONTROL"
+#ifdef CODA_COMPAT_5
+#define CTL_FID { -1, -1, -1 }
+#define IS_CTL_FID(fidp) ((fidp)->Volume == -1 &&\
+ (fidp)->Vnode == -1 &&\
+ (fidp)->Unique == -1)
+#define INVAL_FID { 0, 0, 0 }
+#else
+#define CTL_FID { { -1, -1, -1, -1 } }
+#define IS_CTL_FID(fidp) ((fidp)->opaque[0] == -1 &&\
+ (fidp)->opaque[1] == -1 &&\
+ (fidp)->opaque[2] == -1 &&\
+ (fidp)->opaque[3] == -1)
+#define INVAL_FID { { 0, 0, 0, 0 } }
+#endif
+
+/* Data passed to mount */
+
+#define CODA_MOUNT_VERSION 1
+
+struct coda_mount_data {
+ int version;
+ int fd; /* Opened device */
+};
-#define IS_CTL_FID(fidp) ((fidp)->Volume == CTL_VOL &&\
- (fidp)->Vnode == CTL_VNO &&\
- (fidp)->Unique == CTL_UNI)
#endif
diff --git a/sys/fs/coda/coda_namecache.c b/sys/fs/coda/coda_namecache.c
index 9c54119..5f8106a 100644
--- a/sys/fs/coda/coda_namecache.c
+++ b/sys/fs/coda/coda_namecache.c
@@ -354,10 +354,8 @@ coda_nc_remove(cncp, dcstat)
* place it at the head of the lru list.
*/
CODA_NC_DEBUG(CODA_NC_REMOVE,
- myprintf(("coda_nc_remove %s from parent %lx.%lx.%lx\n",
- cncp->name, (cncp->dcp)->c_fid.Volume,
- (cncp->dcp)->c_fid.Vnode, (cncp->dcp)->c_fid.Unique));)
-
+ myprintf(("coda_nc_remove %s from parent %s\n",
+ cncp->name, coda_f2s(&cncp->dcp->c_fid))); )
CODA_NC_HSHREM(cncp);
CODA_NC_HSHNUL(cncp); /* have it be a null chain */
@@ -385,7 +383,7 @@ coda_nc_remove(cncp, dcstat)
*/
void
coda_nc_zapParentfid(fid, dcstat)
- ViceFid *fid;
+ CodaFid *fid;
enum dc_status dcstat;
{
/* To get to a specific fid, we might either have another hashing
@@ -397,11 +395,10 @@ coda_nc_zapParentfid(fid, dcstat)
int i;
if (coda_nc_use == 0) /* Cache is off */
- return;
+ return;
CODA_NC_DEBUG(CODA_NC_ZAPPFID,
- myprintf(("ZapParent: fid 0x%lx, 0x%lx, 0x%lx \n",
- fid->Volume, fid->Vnode, fid->Unique)); )
+ myprintf(("ZapParent: fid %s\n", coda_f2s(fid))); )
coda_nc_stat.zapPfids++;
@@ -416,9 +413,7 @@ coda_nc_zapParentfid(fid, dcstat)
cncp != (struct coda_cache *)&coda_nc_hash[i];
cncp = ncncp) {
ncncp = cncp->hash_next;
- if ((cncp->dcp->c_fid.Volume == fid->Volume) &&
- (cncp->dcp->c_fid.Vnode == fid->Vnode) &&
- (cncp->dcp->c_fid.Unique == fid->Unique)) {
+ if (coda_fid_eq(&(cncp->dcp->c_fid), fid)) {
coda_nc_hash[i].length--; /* Used for tuning */
coda_nc_remove(cncp, dcstat);
}
@@ -432,7 +427,7 @@ coda_nc_zapParentfid(fid, dcstat)
*/
void
coda_nc_zapfid(fid, dcstat)
- ViceFid *fid;
+ CodaFid *fid;
enum dc_status dcstat;
{
/* See comment for zapParentfid. This routine will be used
@@ -445,8 +440,7 @@ coda_nc_zapfid(fid, dcstat)
return;
CODA_NC_DEBUG(CODA_NC_ZAPFID,
- myprintf(("Zapfid: fid 0x%lx, 0x%lx, 0x%lx \n",
- fid->Volume, fid->Vnode, fid->Unique)); )
+ myprintf(("Zapfid: fid %s\n", coda_f2s(fid))); )
coda_nc_stat.zapFids++;
@@ -455,11 +449,9 @@ coda_nc_zapfid(fid, dcstat)
cncp != (struct coda_cache *)&coda_nc_hash[i];
cncp = ncncp) {
ncncp = cncp->hash_next;
- if ((cncp->cp->c_fid.Volume == fid->Volume) &&
- (cncp->cp->c_fid.Vnode == fid->Vnode) &&
- (cncp->cp->c_fid.Unique == fid->Unique)) {
- coda_nc_hash[i].length--; /* Used for tuning */
- coda_nc_remove(cncp, dcstat);
+ if (coda_fid_eq(&cncp->cp->c_fid, fid)) {
+ coda_nc_hash[i].length--; /* Used for tuning */
+ coda_nc_remove(cncp, dcstat);
}
}
}
@@ -470,7 +462,7 @@ coda_nc_zapfid(fid, dcstat)
*/
void
coda_nc_zapvnode(fid, cred, dcstat)
- ViceFid *fid;
+ CodaFid *fid;
struct ucred *cred;
enum dc_status dcstat;
{
@@ -478,12 +470,15 @@ coda_nc_zapvnode(fid, cred, dcstat)
want to zap a file with a specific cred from the kernel.
We'll leave this one unimplemented.
*/
+
if (coda_nc_use == 0) /* Cache is off */
return;
- CODA_NC_DEBUG(CODA_NC_ZAPVNODE,
- myprintf(("Zapvnode: fid 0x%lx, 0x%lx, 0x%lx cred %p\n",
- fid->Volume, fid->Vnode, fid->Unique, cred)); )
+ CODA_NC_DEBUG(CODA_NC_ZAPVNODE,
+ myprintf(("Zapvnode: fid %s cred %p\n",
+ coda_f2s(fid), cred)); )
+
+
}
@@ -533,7 +528,7 @@ coda_nc_zapfile(dcp, name, namelen)
*/
void
coda_nc_purge_user(uid, dcstat)
- vuid_t uid;
+ uid_t uid;
enum dc_status dcstat;
{
/*
@@ -616,7 +611,8 @@ coda_nc_flush(dcstat)
if (CTOV(cncp->cp)->v_vflag & VV_TEXT) {
if (coda_vmflush(cncp->cp))
CODADEBUG(CODA_FLUSH,
- myprintf(("coda_nc_flush: (%lx.%lx.%lx) busy\n", cncp->cp->c_fid.Volume, cncp->cp->c_fid.Vnode, cncp->cp->c_fid.Unique)); )
+ myprintf(("coda_nc_flush: %s busy\n",
+ coda_f2s(&cncp->cp->c_fid))); )
}
if ((dcstat == IS_DOWNCALL)
diff --git a/sys/fs/coda/coda_namecache.h b/sys/fs/coda/coda_namecache.h
index fb9ae8c..13bb99d 100644
--- a/sys/fs/coda/coda_namecache.h
+++ b/sys/fs/coda/coda_namecache.h
@@ -140,11 +140,11 @@ extern void coda_nc_init(void);
extern void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
extern struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *);
-extern void coda_nc_zapParentfid(ViceFid *, enum dc_status);
-extern void coda_nc_zapfid(ViceFid *, enum dc_status);
-extern void coda_nc_zapvnode(ViceFid *, struct ucred *, enum dc_status);
+extern void coda_nc_zapParentfid(CodaFid *, enum dc_status);
+extern void coda_nc_zapfid(CodaFid *, enum dc_status);
+extern void coda_nc_zapvnode(CodaFid *, struct ucred *, enum dc_status);
extern void coda_nc_zapfile(struct cnode *, const char *, int);
-extern void coda_nc_purge_user(vuid_t, enum dc_status);
+extern void coda_nc_purge_user(uid_t, enum dc_status);
extern void coda_nc_flush(enum dc_status);
extern void print_coda_nc(void);
diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c
index 36df51d..f9e0f56 100644
--- a/sys/fs/coda/coda_subr.c
+++ b/sys/fs/coda/coda_subr.c
@@ -74,9 +74,16 @@ int coda_new = 0;
struct cnode *coda_freelist = NULL;
struct cnode *coda_cache[CODA_CACHESIZE];
-#define coda_hash(fid) (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1))
#define CNODE_NEXT(cp) ((cp)->c_next)
-#define ODD(vnode) ((vnode) & 0x1)
+
+#ifdef CODA_COMPAT_5
+#define coda_hash(fid) \
+ (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1))
+#define IS_DIR(cnode) (cnode.Vnode & 0x1)
+#else
+#define coda_hash(fid) (coda_f2i(fid) & (CODA_CACHESIZE-1))
+#define IS_DIR(cnode) (cnode.opaque[2] & 0x1)
+#endif
/*
* Allocate a cnode.
@@ -161,15 +168,13 @@ coda_unsave(cp)
*/
struct cnode *
coda_find(fid)
- ViceFid *fid;
+ CodaFid *fid;
{
struct cnode *cp;
cp = coda_cache[coda_hash(fid)];
while (cp) {
- if ((cp->c_fid.Vnode == fid->Vnode) &&
- (cp->c_fid.Volume == fid->Volume) &&
- (cp->c_fid.Unique == fid->Unique) &&
+ if (coda_fid_eq(&(cp->c_fid), fid) &&
(!IS_UNMOUNTING(cp)))
{
coda_active++;
@@ -218,12 +223,10 @@ coda_kill(whoIam, dcstat)
#endif
count++;
CODADEBUG(CODA_FLUSH,
- myprintf(("Live cnode fid %lx.%lx.%lx flags %d count %d\n",
- (cp->c_fid).Volume,
- (cp->c_fid).Vnode,
- (cp->c_fid).Unique,
- cp->c_flags,
- vrefcnt(CTOV(cp)))); );
+ myprintf(("Live cnode fid %s flags %d count %d\n",
+ coda_f2s(&cp->c_fid),
+ cp->c_flags,
+ vrefcnt(CTOV(cp)))); );
}
}
}
@@ -248,7 +251,7 @@ coda_flush(dcstat)
for (hash = 0; hash < CODA_CACHESIZE; hash++) {
for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
- if (!ODD(cp->c_fid.Vnode)) /* only files can be executed */
+ if (!IS_DIR(cp->c_fid)) /* only files can be executed */
coda_vmflush(cp);
}
}
@@ -268,9 +271,8 @@ coda_testflush(void)
for (cp = coda_cache[hash];
cp != NULL;
cp = CNODE_NEXT(cp)) {
- myprintf(("Live cnode fid %lx.%lx.%lx count %d\n",
- (cp->c_fid).Volume,(cp->c_fid).Vnode,
- (cp->c_fid).Unique, vrefcnt(CTOV(cp))));
+ myprintf(("Live cnode fid %s count %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount));
}
}
}
@@ -373,7 +375,7 @@ coda_cacheprint(whoIam)
* The sixth allows Venus to replace local fids with global ones
* during reintegration.
*
- * CODA_REPLACE -- replace one ViceFid with another throughout the name cache
+ * CODA_REPLACE -- replace one CodaFid with another throughout the name cache
*/
int handleDownCall(opcode, out)
@@ -396,7 +398,11 @@ int handleDownCall(opcode, out)
coda_clstat.reqs[CODA_PURGEUSER]++;
/* XXX - need to prevent fsync's */
+#ifdef CODA_COMPAT_5
coda_nc_purge_user(out->coda_purgeuser.cred.cr_uid, IS_DOWNCALL);
+#else
+ coda_nc_purge_user(out->coda_purgeuser.uid, IS_DOWNCALL);
+#endif
return(0);
}
@@ -407,7 +413,7 @@ int handleDownCall(opcode, out)
coda_clstat.ncalls++;
coda_clstat.reqs[CODA_ZAPFILE]++;
- cp = coda_find(&out->coda_zapfile.CodaFid);
+ cp = coda_find(&out->coda_zapfile.Fid);
if (cp != NULL) {
vref(CTOV(cp));
@@ -415,11 +421,10 @@ int handleDownCall(opcode, out)
ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall");
if (CTOV(cp)->v_vflag & VV_TEXT)
error = coda_vmflush(cp);
- CODADEBUG(CODA_ZAPFILE, myprintf((
-"zapfile: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique,
- vrefcnt(CTOV(cp)) - 1, error)););
- if (vrefcnt(CTOV(cp)) == 1) {
+ CODADEBUG(CODA_ZAPFILE,
+ myprintf(("zapfile: fid = %s, refcnt = %d, error = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1, error)););
+ if (vrefcnt(CTOV(cp)) == 1) {
cp->c_flags |= C_PURGING;
}
vrele(CTOV(cp));
@@ -434,17 +439,16 @@ int handleDownCall(opcode, out)
coda_clstat.ncalls++;
coda_clstat.reqs[CODA_ZAPDIR]++;
- cp = coda_find(&out->coda_zapdir.CodaFid);
+ cp = coda_find(&out->coda_zapdir.Fid);
if (cp != NULL) {
vref(CTOV(cp));
cp->c_flags &= ~C_VATTR;
- coda_nc_zapParentfid(&out->coda_zapdir.CodaFid, IS_DOWNCALL);
+ coda_nc_zapParentfid(&out->coda_zapdir.Fid, IS_DOWNCALL);
CODADEBUG(CODA_ZAPDIR, myprintf((
-"zapdir: fid = (%lx.%lx.%lx), refcnt = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique,
- vrefcnt(CTOV(cp)) - 1)););
+ "zapdir: fid = %s, refcnt = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1)););
if (vrefcnt(CTOV(cp)) == 1) {
cp->c_flags |= C_PURGING;
}
@@ -461,25 +465,23 @@ int handleDownCall(opcode, out)
coda_clstat.ncalls++;
coda_clstat.reqs[CODA_PURGEFID]++;
- cp = coda_find(&out->coda_purgefid.CodaFid);
+ cp = coda_find(&out->coda_purgefid.Fid);
if (cp != NULL) {
vref(CTOV(cp));
- if (ODD(out->coda_purgefid.CodaFid.Vnode)) { /* Vnode is a directory */
- coda_nc_zapParentfid(&out->coda_purgefid.CodaFid,
- IS_DOWNCALL);
+ if (IS_DIR(out->coda_purgefid.Fid)) { /* Vnode is a directory */
+ coda_nc_zapParentfid(&out->coda_purgefid.Fid,IS_DOWNCALL);
}
cp->c_flags &= ~C_VATTR;
- coda_nc_zapfid(&out->coda_purgefid.CodaFid, IS_DOWNCALL);
+ coda_nc_zapfid(&out->coda_purgefid.Fid, IS_DOWNCALL);
ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall");
- if (!(ODD(out->coda_purgefid.CodaFid.Vnode))
+ if (!(IS_DIR(out->coda_purgefid.Fid))
&& (CTOV(cp)->v_vflag & VV_TEXT)) {
error = coda_vmflush(cp);
}
- CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique,
- vrefcnt(CTOV(cp)) - 1, error)););
+ CODADEBUG(CODA_PURGEFID, myprintf((
+ "purgefid: fid = %s, refcnt = %d, error = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1, error)););
if (vrefcnt(CTOV(cp)) == 1) {
cp->c_flags |= C_PURGING;
}
@@ -502,13 +504,10 @@ int handleDownCall(opcode, out)
cp->c_fid = out->coda_replace.NewFid;
coda_save(cp);
- CODADEBUG(CODA_REPLACE, myprintf(("replace: oldfid = (%lx.%lx.%lx), newfid = (%lx.%lx.%lx), cp = %p\n",
- out->coda_replace.OldFid.Volume,
- out->coda_replace.OldFid.Vnode,
- out->coda_replace.OldFid.Unique,
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique, cp));)
- vrele(CTOV(cp));
+ CODADEBUG(CODA_REPLACE, myprintf((
+ "replace: oldfid = %s, newfid = %s, cp = %p\n",
+ coda_f2s(&out->coda_replace.OldFid),
+ coda_f2s(&cp->c_fid), cp));) vrele(CTOV(cp));
}
return (0);
}
diff --git a/sys/fs/coda/coda_subr.h b/sys/fs/coda/coda_subr.h
index 71c8a3d..2b026eb 100644
--- a/sys/fs/coda/coda_subr.h
+++ b/sys/fs/coda/coda_subr.h
@@ -33,7 +33,7 @@
struct cnode *coda_alloc(void);
void coda_free(struct cnode *cp);
-struct cnode *coda_find(ViceFid *fid);
+struct cnode *coda_find(CodaFid *fid);
void coda_flush(enum dc_status dcstat);
void coda_testflush(void);
void coda_checkunmounting(struct mount *mp);
diff --git a/sys/fs/coda/coda_venus.c b/sys/fs/coda/coda_venus.c
index f1eac62..8067226 100644
--- a/sys/fs/coda/coda_venus.c
+++ b/sys/fs/coda/coda_venus.c
@@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$");
((char*)inp + (int)inp->struc)[len++] = 0; \
Isize += len
+#ifdef CODA_COMPAT_5
#define INIT_IN(in, op, ident, p) \
(in)->opcode = (op); \
sx_slock(&proctree_lock); \
@@ -107,8 +108,18 @@ __FBSDID("$FreeBSD$");
bzero(&((in)->cred),sizeof(struct coda_cred)); \
(in)->cred.cr_uid = -1; \
(in)->cred.cr_groupid = -1; \
- } \
-
+ }
+#else
+#define INIT_IN(in, op, ident, p) \
+ (in)->opcode = (op); \
+ (in)->pid = p ? p->p_pid : -1; \
+ (in)->pgid = p ? p->p_pgid : -1; \
+ if (ident != NOCRED) { \
+ (in)->uid = ident->cr_uid; \
+ } else { \
+ (in)->uid = -1; \
+ }
+#endif
#define CNV_OFLAG(to, from) \
do { \
to = 0; \
@@ -168,7 +179,7 @@ int coda_kernel_version = CODA_KERNEL_VERSION;
int
venus_root(void *mdp,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid)
+/*out*/ CodaFid *VFid)
{
DECL_NO_IN(coda_root); /* sets Isize & Osize */
ALLOC_NO_IN(coda_root); /* sets inp & outp */
@@ -178,14 +189,14 @@ venus_root(void *mdp,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error)
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
CODA_FREE(inp, coda_root_size);
return error;
}
int
-venus_open(void *mdp, ViceFid *fid, int flag,
+venus_open(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p,
/*out*/ dev_t *dev, ino_t *inode)
{
@@ -195,7 +206,7 @@ venus_open(void *mdp, ViceFid *fid, int flag,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_OPEN, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_OFLAG(cflag, flag);
inp->flags = cflag;
@@ -211,7 +222,7 @@ venus_open(void *mdp, ViceFid *fid, int flag,
}
int
-venus_close(void *mdp, ViceFid *fid, int flag,
+venus_close(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p)
{
int cflag;
@@ -219,7 +230,7 @@ venus_close(void *mdp, ViceFid *fid, int flag,
ALLOC_NO_OUT(coda_close); /* sets inp & outp */
INIT_IN(&inp->ih, CODA_CLOSE, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_OFLAG(cflag, flag);
inp->flags = cflag;
@@ -248,7 +259,7 @@ venus_write(void)
* normal files.
*/
int
-venus_ioctl(void *mdp, ViceFid *fid,
+venus_ioctl(void *mdp, CodaFid *fid,
int com, int flag, caddr_t data,
struct ucred *cred, struct proc *p)
{
@@ -260,7 +271,7 @@ venus_ioctl(void *mdp, ViceFid *fid,
ALLOC(coda_ioctl); /* sets inp & outp */
INIT_IN(&inp->ih, CODA_IOCTL, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
/* command was mutated by increasing its size field to reflect the
* path and follow args. we need to subtract that out before sending
@@ -299,7 +310,7 @@ venus_ioctl(void *mdp, ViceFid *fid,
}
int
-venus_getattr(void *mdp, ViceFid *fid,
+venus_getattr(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ struct vattr *vap)
{
@@ -308,7 +319,7 @@ venus_getattr(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_GETATTR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
@@ -320,7 +331,7 @@ venus_getattr(void *mdp, ViceFid *fid,
}
int
-venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
+venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap,
struct ucred *cred, struct proc *p)
{
DECL_NO_OUT(coda_setattr); /* sets Isize & Osize */
@@ -328,7 +339,7 @@ venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_SETATTR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_V2VV_ATTR(&inp->attr, vap);
error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -338,7 +349,7 @@ venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
}
int
-venus_access(void *mdp, ViceFid *fid, int mode,
+venus_access(void *mdp, CodaFid *fid, int mode,
struct ucred *cred, struct proc *p)
{
DECL_NO_OUT(coda_access); /* sets Isize & Osize */
@@ -346,7 +357,7 @@ venus_access(void *mdp, ViceFid *fid, int mode,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_ACCESS, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
/* NOTE:
* NetBSD and Venus internals use the "data" in the low 3 bits.
* Hence, the conversion.
@@ -360,7 +371,7 @@ venus_access(void *mdp, ViceFid *fid, int mode,
}
int
-venus_readlink(void *mdp, ViceFid *fid,
+venus_readlink(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ char **str, int *len)
{
@@ -370,7 +381,7 @@ venus_readlink(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_READLINK, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
Osize += CODA_MAXPATHLEN;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -385,7 +396,7 @@ venus_readlink(void *mdp, ViceFid *fid,
}
int
-venus_fsync(void *mdp, ViceFid *fid,
+venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p)
{
DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */
@@ -393,7 +404,7 @@ venus_fsync(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_FSYNC, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -402,10 +413,10 @@ venus_fsync(void *mdp, ViceFid *fid,
}
int
-venus_lookup(void *mdp, ViceFid *fid,
+venus_lookup(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype)
+/*out*/ CodaFid *VFid, int *vtype)
{
DECL(coda_lookup); /* sets Isize & Osize */
coda_lookup_size += len + 1;
@@ -413,7 +424,7 @@ venus_lookup(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_LOOKUP, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
/* NOTE:
* Between version 1 and version 2 we have added an extra flag field
@@ -430,7 +441,7 @@ venus_lookup(void *mdp, ViceFid *fid,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
*vtype = outp->vtype;
}
@@ -439,10 +450,10 @@ venus_lookup(void *mdp, ViceFid *fid,
}
int
-venus_create(void *mdp, ViceFid *fid,
+venus_create(void *mdp, CodaFid *fid,
const char *nm, int len, int exclusive, int mode, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *attr)
+/*out*/ CodaFid *VFid, struct vattr *attr)
{
DECL(coda_create); /* sets Isize & Osize */
coda_create_size += len + 1;
@@ -450,7 +461,7 @@ venus_create(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_CREATE, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->excl = exclusive ? C_O_EXCL : 0;
inp->mode = mode;
CNV_V2VV_ATTR(&inp->attr, va);
@@ -460,7 +471,7 @@ venus_create(void *mdp, ViceFid *fid,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
CNV_VV2V_ATTR(attr, &outp->attr);
}
@@ -469,7 +480,7 @@ venus_create(void *mdp, ViceFid *fid,
}
int
-venus_remove(void *mdp, ViceFid *fid,
+venus_remove(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p)
{
@@ -479,7 +490,7 @@ venus_remove(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_REMOVE, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->name = Isize;
STRCPY(name, nm, len); /* increments Isize */
@@ -491,7 +502,7 @@ venus_remove(void *mdp, ViceFid *fid,
}
int
-venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_link(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len,
struct ucred *cred, struct proc *p)
{
@@ -514,7 +525,7 @@ venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
}
int
-venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_rename(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len, const char *tnm, int tlen,
struct ucred *cred, struct proc *p)
{
@@ -540,10 +551,10 @@ venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
}
int
-venus_mkdir(void *mdp, ViceFid *fid,
+venus_mkdir(void *mdp, CodaFid *fid,
const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *ova)
+/*out*/ CodaFid *VFid, struct vattr *ova)
{
DECL(coda_mkdir); /* sets Isize & Osize */
coda_mkdir_size += len + 1;
@@ -551,7 +562,7 @@ venus_mkdir(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_MKDIR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_V2VV_ATTR(&inp->attr, va);
inp->name = Isize;
@@ -559,7 +570,7 @@ venus_mkdir(void *mdp, ViceFid *fid,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
CNV_VV2V_ATTR(ova, &outp->attr);
}
@@ -568,7 +579,7 @@ venus_mkdir(void *mdp, ViceFid *fid,
}
int
-venus_rmdir(void *mdp, ViceFid *fid,
+venus_rmdir(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p)
{
@@ -578,7 +589,7 @@ venus_rmdir(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_RMDIR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->name = Isize;
STRCPY(name, nm, len); /* increments Isize */
@@ -590,7 +601,7 @@ venus_rmdir(void *mdp, ViceFid *fid,
}
int
-venus_symlink(void *mdp, ViceFid *fid,
+venus_symlink(void *mdp, CodaFid *fid,
const char *lnm, int llen, const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p)
{
@@ -600,7 +611,7 @@ venus_symlink(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_SYMLINK, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
CNV_V2VV_ATTR(&inp->attr, va);
inp->srcname = Isize;
@@ -616,7 +627,7 @@ venus_symlink(void *mdp, ViceFid *fid,
}
int
-venus_readdir(void *mdp, ViceFid *fid,
+venus_readdir(void *mdp, CodaFid *fid,
int count, int offset,
struct ucred *cred, struct proc *p,
/*out*/ char *buffer, int *len)
@@ -627,7 +638,7 @@ venus_readdir(void *mdp, ViceFid *fid,
/* send the open to venus. */
INIT_IN(&inp->ih, CODA_READDIR, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
inp->count = count;
inp->offset = offset;
@@ -643,20 +654,20 @@ venus_readdir(void *mdp, ViceFid *fid,
}
int
-venus_fhtovp(void *mdp, ViceFid *fid,
+venus_fhtovp(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype)
+/*out*/ CodaFid *VFid, int *vtype)
{
DECL(coda_vget); /* sets Isize & Osize */
ALLOC(coda_vget); /* sets inp & outp */
/* Send the open to Venus. */
INIT_IN(&inp->ih, CODA_VGET, cred, p);
- inp->VFid = *fid;
+ inp->Fid = *fid;
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
- *VFid = outp->VFid;
+ *VFid = outp->Fid;
*vtype = outp->vtype;
}
diff --git a/sys/fs/coda/coda_venus.h b/sys/fs/coda/coda_venus.h
index 392a73f..b506b5b 100644
--- a/sys/fs/coda/coda_venus.h
+++ b/sys/fs/coda/coda_venus.h
@@ -34,15 +34,15 @@
int
venus_root(void *mdp,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid);
+/*out*/ CodaFid *VFid);
int
-venus_open(void *mdp, ViceFid *fid, int flag,
+venus_open(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p,
/*out*/ dev_t *dev, ino_t *inode);
int
-venus_close(void *mdp, ViceFid *fid, int flag,
+venus_close(void *mdp, CodaFid *fid, int flag,
struct ucred *cred, struct proc *p);
void
@@ -52,82 +52,82 @@ void
venus_write(void);
int
-venus_ioctl(void *mdp, ViceFid *fid,
+venus_ioctl(void *mdp, CodaFid *fid,
int com, int flag, caddr_t data,
struct ucred *cred, struct proc *p);
int
-venus_getattr(void *mdp, ViceFid *fid,
+venus_getattr(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ struct vattr *vap);
int
-venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
+venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap,
struct ucred *cred, struct proc *p);
int
-venus_access(void *mdp, ViceFid *fid, int mode,
+venus_access(void *mdp, CodaFid *fid, int mode,
struct ucred *cred, struct proc *p);
int
-venus_readlink(void *mdp, ViceFid *fid,
+venus_readlink(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
/*out*/ char **str, int *len);
int
-venus_fsync(void *mdp, ViceFid *fid,
+venus_fsync(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p);
int
-venus_lookup(void *mdp, ViceFid *fid,
+venus_lookup(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype);
+/*out*/ CodaFid *VFid, int *vtype);
int
-venus_create(void *mdp, ViceFid *fid,
+venus_create(void *mdp, CodaFid *fid,
const char *nm, int len, int exclusive, int mode, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *attr);
+/*out*/ CodaFid *VFid, struct vattr *attr);
int
-venus_remove(void *mdp, ViceFid *fid,
+venus_remove(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p);
int
-venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_link(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len,
struct ucred *cred, struct proc *p);
int
-venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
+venus_rename(void *mdp, CodaFid *fid, CodaFid *tfid,
const char *nm, int len, const char *tnm, int tlen,
struct ucred *cred, struct proc *p);
int
-venus_mkdir(void *mdp, ViceFid *fid,
+venus_mkdir(void *mdp, CodaFid *fid,
const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, struct vattr *ova);
+/*out*/ CodaFid *VFid, struct vattr *ova);
int
-venus_rmdir(void *mdp, ViceFid *fid,
+venus_rmdir(void *mdp, CodaFid *fid,
const char *nm, int len,
struct ucred *cred, struct proc *p);
int
-venus_symlink(void *mdp, ViceFid *fid,
+venus_symlink(void *mdp, CodaFid *fid,
const char *lnm, int llen, const char *nm, int len, struct vattr *va,
struct ucred *cred, struct proc *p);
int
-venus_readdir(void *mdp, ViceFid *fid,
+venus_readdir(void *mdp, CodaFid *fid,
int count, int offset,
struct ucred *cred, struct proc *p,
/*out*/ char *buffer, int *len);
int
-venus_fhtovp(void *mdp, ViceFid *fid,
+venus_fhtovp(void *mdp, CodaFid *fid,
struct ucred *cred, struct proc *p,
-/*out*/ ViceFid *VFid, int *vtype);
+/*out*/ CodaFid *VFid, int *vtype);
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
index 3c326bd..fff32303 100644
--- a/sys/fs/coda/coda_vfsops.c
+++ b/sys/fs/coda/coda_vfsops.c
@@ -117,8 +117,8 @@ coda_mount(vfsp, path, data, ndp, td)
dev_t dev;
struct coda_mntinfo *mi;
struct vnode *rootvp;
- ViceFid rootfid;
- ViceFid ctlfid;
+ CodaFid rootfid = INVAL_FID;
+ CodaFid ctlfid = CTL_FID;
int error;
ENTRY;
@@ -187,16 +187,10 @@ coda_mount(vfsp, path, data, ndp, td)
* actually make the CODA_ROOT call to venus until the first call
* to coda_root in case a server is down while venus is starting.
*/
- rootfid.Volume = 0;
- rootfid.Vnode = 0;
- rootfid.Unique = 0;
cp = make_coda_node(&rootfid, vfsp, VDIR);
rootvp = CTOV(cp);
rootvp->v_vflag |= VV_ROOT;
- ctlfid.Volume = CTL_VOL;
- ctlfid.Vnode = CTL_VNO;
- ctlfid.Unique = CTL_UNI;
/* cp = make_coda_node(&ctlfid, vfsp, VCHR);
The above code seems to cause a loop in the cnode links.
I don't totally understand when it happens, it is caught
@@ -255,7 +249,6 @@ coda_unmount(vfsp, mntflags, td)
printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp));
#endif
vrele(mi->mi_rootvp);
-
active = coda_kill(vfsp, NOT_DOWNCALL);
ASSERT_VOP_LOCKED(mi->mi_rootvp, "coda_unmount");
mi->mi_rootvp->v_vflag &= ~VV_ROOT;
@@ -294,7 +287,8 @@ coda_root(vfsp, vpp)
int error;
struct thread *td = curthread; /* XXX - bnoble */
struct proc *p = td->td_proc;
- ViceFid VFid;
+ CodaFid VFid;
+ static const CodaFid invalfid = INVAL_FID;
ENTRY;
MARK_ENTRY(CODA_ROOT_STATS);
@@ -312,10 +306,8 @@ coda_root(vfsp, vpp)
* node to avoid a deadlock. This bug is fixed in the Coda CVS
* repository but not in any released versions as of 6 Mar 2003.
*/
- if ((VTOC(mi->mi_rootvp)->c_fid.Volume != 0) ||
- (VTOC(mi->mi_rootvp)->c_fid.Vnode != 0) ||
- (VTOC(mi->mi_rootvp)->c_fid.Unique != 0) ||
- mi->mi_started == 0)
+ if (memcmp(&VTOC(mi->mi_rootvp)->c_fid, &invalfid,
+ sizeof(CodaFid)) != 0 || mi->mi_started == 0)
{ /* Found valid root. */
*vpp = mi->mi_rootvp;
/* On Mach, this is vref. On NetBSD, VOP_LOCK */
@@ -469,7 +461,7 @@ coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
int error;
struct thread *td = curthread; /* XXX -mach */
struct proc *p = td->td_proc;
- ViceFid VFid;
+ CodaFid VFid;
int vtype;
ENTRY;
@@ -490,9 +482,8 @@ coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
*vpp = (struct vnode *)0;
} else {
CODADEBUG(CODA_VGET,
- myprintf(("vget: vol %lx vno %lx uni %lx type %d result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, vtype, error)); )
-
+ myprintf(("vget: %s type %d result %d\n",
+ coda_f2s(&VFid), vtype, error)); )
cp = make_coda_node(&VFid, vfsp, vtype);
*vpp = CTOV(cp);
}
@@ -514,7 +505,7 @@ getNewVnode(vpp)
ENTRY;
- cfid.cfid_len = (short)sizeof(ViceFid);
+ cfid.cfid_len = (short)sizeof(CodaFid);
cfid.cfid_fid = VTOC(*vpp)->c_fid; /* Structure assignment. */
/* XXX ? */
diff --git a/sys/fs/coda/coda_vfsops.h b/sys/fs/coda/coda_vfsops.h
index fbbcec4..6d36232 100644
--- a/sys/fs/coda/coda_vfsops.h
+++ b/sys/fs/coda/coda_vfsops.h
@@ -40,7 +40,7 @@
struct cfid {
u_short cfid_len;
u_short padding;
- ViceFid cfid_fid;
+ CodaFid cfid_fid;
};
struct mbuf;
diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c
index 8e44455..a1d24e9 100644
--- a/sys/fs/coda/coda_vnops.c
+++ b/sys/fs/coda/coda_vnops.c
@@ -489,10 +489,8 @@ printf("coda_rdwr: Internally Opening %p\n", vp);
}
/* Have UFS handle the call. */
- CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n",
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique, vrefcnt(CTOV(cp)))); )
-
+ CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = %s, refcnt = %d\n",
+ coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount)); )
if (rw == UIO_READ) {
error = VOP_READ(cfvp, uiop, ioflag, cred);
} else {
@@ -639,10 +637,8 @@ coda_getattr(v)
/* Check to see if the attributes have already been cached */
if (VALID_VATTR(cp)) {
- CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: (%lx.%lx.%lx)\n",
- cp->c_fid.Volume,
- cp->c_fid.Vnode,
- cp->c_fid.Unique));});
+ CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: %s\n",
+ coda_f2s(&cp->c_fid)));});
CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR))
print_vattr(&cp->c_vattr); );
@@ -654,11 +650,8 @@ coda_getattr(v)
error = venus_getattr(vtomi(vp), &cp->c_fid, cred, td->td_proc, vap);
if (!error) {
- CODADEBUG(CODA_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n",
- cp->c_fid.Volume,
- cp->c_fid.Vnode,
- cp->c_fid.Unique,
- error)); )
+ CODADEBUG(CODA_GETATTR, myprintf(("getattr miss %s: result %d\n",
+ coda_f2s(&cp->c_fid), error)); )
CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR))
print_vattr(vap); );
@@ -905,10 +898,9 @@ coda_inactive(v)
return 0;
}
- CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %lx.%lx.%lx. vfsp %p\n",
- cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique, vp->v_mount));)
-
+ CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %s, vfsp %p\n",
+ coda_f2s(&cp->c_fid), vp->v_mount));)
+
/* If an array has been allocated to hold the symlink, deallocate it */
if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) {
if (cp->c_symlink == NULL)
@@ -980,15 +972,14 @@ coda_lookup(v)
struct cnode *cp;
const char *nm = cnp->cn_nameptr;
int len = cnp->cn_namelen;
- ViceFid VFid;
+ CodaFid VFid;
int vtype;
int error = 0;
MARK_ENTRY(CODA_LOOKUP_STATS);
- CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %lx.%lx.%lx\n",
- nm, dcp->c_fid.Volume,
- dcp->c_fid.Vnode, dcp->c_fid.Unique)););
+ CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %s\n",
+ nm, coda_f2s(&dcp->c_fid))););
/* Check for lookup of control object. */
if (IS_CTL_NAME(dvp, nm, len)) {
@@ -1000,9 +991,9 @@ coda_lookup(v)
if (len+1 > CODA_MAXNAMLEN) {
MARK_INT_FAIL(CODA_LOOKUP_STATS);
- CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %lx.%lx.%lx(%s)\n",
- dcp->c_fid.Volume, dcp->c_fid.Vnode,
- dcp->c_fid.Unique, nm)););
+
+ CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %s (%s)\n",
+ coda_f2s(&dcp->c_fid), nm)););
*vpp = (struct vnode *)0;
error = EINVAL;
goto exit;
@@ -1022,16 +1013,15 @@ coda_lookup(v)
if (error) {
MARK_INT_FAIL(CODA_LOOKUP_STATS);
- CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %lx.%lx.%lx(%s)%d\n",
- dcp->c_fid.Volume, dcp->c_fid.Vnode, dcp->c_fid.Unique, nm, error));)
+
+ CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %s (%s)%d\n",
+ coda_f2s(&dcp->c_fid), nm, error));)
*vpp = (struct vnode *)0;
} else {
MARK_INT_SAT(CODA_LOOKUP_STATS);
CODADEBUG(CODA_LOOKUP,
- myprintf(("lookup: vol %lx vno %lx uni %lx type %o result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, vtype,
- error)); )
-
+ myprintf(("lookup: %s type %o result %d\n",
+ coda_f2s(&VFid), vtype, error)); )
cp = make_coda_node(&VFid, dvp->v_mount, vtype);
*vpp = CTOV(cp);
@@ -1141,7 +1131,7 @@ coda_create(v)
struct cnode *cp;
const char *nm = cnp->cn_nameptr;
int len = cnp->cn_namelen;
- ViceFid VFid;
+ CodaFid VFid;
struct vattr attr;
MARK_ENTRY(CODA_CREATE_STATS);
@@ -1186,8 +1176,8 @@ coda_create(v)
coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp));
CODADEBUG(CODA_CREATE,
- myprintf(("create: (%lx.%lx.%lx), result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, error)); )
+ myprintf(("create: %s, result %d\n",
+ coda_f2s(&VFid), error)); )
} else {
*vpp = (struct vnode *)0;
CODADEBUG(CODA_CREATE, myprintf(("create error %d\n", error));)
@@ -1228,10 +1218,8 @@ coda_remove(v)
MARK_ENTRY(CODA_REMOVE_STATS);
- CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %lx.%lx.%lx\n",
- nm, cp->c_fid.Volume, cp->c_fid.Vnode,
- cp->c_fid.Unique)););
-
+ CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %s\n",
+ nm, coda_f2s(&cp->c_fid))););
/* Remove the file's entry from the CODA Name Cache */
/* We're being conservative here, it might be that this person
* doesn't really have sufficient access to delete the file
@@ -1290,19 +1278,16 @@ coda_link(v)
MARK_ENTRY(CODA_LINK_STATS);
if (codadebug & CODADBGMSK(CODA_LINK)) {
-
- myprintf(("nb_link: vp fid: (%lx.%lx.%lx)\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
- myprintf(("nb_link: tdvp fid: (%lx.%lx.%lx)\n",
- tdcp->c_fid.Volume, tdcp->c_fid.Vnode, tdcp->c_fid.Unique));
-
+ myprintf(("nb_link: vp fid: %s\n",
+ coda_f2s(&cp->c_fid)));
+ myprintf(("nb_link: tdvp fid: %s)\n",
+ coda_f2s(&tdcp->c_fid)));
}
if (codadebug & CODADBGMSK(CODA_LINK)) {
- myprintf(("link: vp fid: (%lx.%lx.%lx)\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
- myprintf(("link: tdvp fid: (%lx.%lx.%lx)\n",
- tdcp->c_fid.Volume, tdcp->c_fid.Vnode, tdcp->c_fid.Unique));
-
+ myprintf(("link: vp fid: %s\n",
+ coda_f2s(&cp->c_fid)));
+ myprintf(("link: tdvp fid: %s\n",
+ coda_f2s(&tdcp->c_fid)));
}
/* Check for link to/from control object. */
@@ -1435,7 +1420,7 @@ coda_mkdir(v)
const char *nm = cnp->cn_nameptr;
int len = cnp->cn_namelen;
struct cnode *cp;
- ViceFid VFid;
+ CodaFid VFid;
struct vattr ova;
MARK_ENTRY(CODA_MKDIR_STATS);
@@ -1478,9 +1463,9 @@ coda_mkdir(v)
/* Invalidate the parent's attr cache, the modification time has changed */
VTOC(dvp)->c_flags &= ~C_VATTR;
- CODADEBUG( CODA_MKDIR, myprintf(("mkdir: (%lx.%lx.%lx) result %d\n",
- VFid.Volume, VFid.Vnode, VFid.Unique, error)); )
- } else {
+ CODADEBUG( CODA_MKDIR, myprintf(("mkdir: %s result %d\n",
+ coda_f2s(&VFid), error)); )
+ } else {
*vpp = (struct vnode *)0;
CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));)
}
@@ -1663,7 +1648,7 @@ printf("coda_readdir: Internally Opening %p\n", vp);
}
/* Have UFS handle the call. */
- CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vrefcnt(vp))); )
+ CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = %s, refcnt = %d\n", coda_f2s(&cp->c_fid), vp->v_usecount)); )
error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies,
cookies);
@@ -1774,8 +1759,8 @@ coda_lock(v)
ENTRY;
if (coda_lockdebug) {
- myprintf(("Attempting lock on %lx.%lx.%lx\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
+ myprintf(("Attempting lock on %s\n",
+ coda_f2s(&cp->c_fid)));
}
#ifndef DEBUG_LOCKS
@@ -1800,8 +1785,8 @@ coda_unlock(v)
ENTRY;
if (coda_lockdebug) {
- myprintf(("Attempting unlock on %lx.%lx.%lx\n",
- cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
+ myprintf(("Attempting unlock on %s\n",
+ coda_f2s(&cp->c_fid)));
}
return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, td));
@@ -1920,14 +1905,14 @@ print_cred(cred)
/*
* Return a vnode for the given fid.
* If no cnode exists for this fid create one and put it
- * in a table hashed by fid.Volume and fid.Vnode. If the cnode for
+ * in a table hashed by coda_f2i(). If the cnode for
* this fid is already in the table return it (ref count is
* incremented by coda_find. The cnode will be flushed from the
* table when coda_inactive calls coda_unsave.
*/
struct cnode *
make_coda_node(fid, vfsp, type)
- ViceFid *fid; struct mount *vfsp; short type;
+ CodaFid *fid; struct mount *vfsp; short type;
{
struct cnode *cp;
int err;
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 8617abd..78bb6d0 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -25,6 +25,7 @@ SUBDIR= accf_data \
cam \
cd9660 \
coda \
+ coda5 \
${_crypto} \
${_cryptodev} \
cue \
diff --git a/sys/modules/coda/Makefile b/sys/modules/coda/Makefile
index c04d1a1..9274f2f 100644
--- a/sys/modules/coda/Makefile
+++ b/sys/modules/coda/Makefile
@@ -5,11 +5,15 @@
KMOD= coda
SRCS= vnode_if.h \
coda_fbsd.c coda_namecache.c coda_psdev.c coda_subr.c \
- coda_venus.c coda_vfsops.c coda_vnops.c vcoda.h
+ coda_venus.c coda_vfsops.c coda_vnops.c vcoda.h \
+ opt_coda.h
-CLEANFILES= vcoda.h
+CLEANFILES= vcoda.h opt_coda.h
vcoda.h:
echo "#define NVCODA 4" > vcoda.h
+opt_coda.h:
+ echo >opt_coda.h
+
.include <bsd.kmod.mk>
diff --git a/sys/modules/coda5/Makefile b/sys/modules/coda5/Makefile
new file mode 100644
index 0000000..595e65e
--- /dev/null
+++ b/sys/modules/coda5/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../coda
+
+KMOD= coda5
+SRCS= vnode_if.h \
+ coda_fbsd.c coda_namecache.c coda_psdev.c coda_subr.c \
+ coda_venus.c coda_vfsops.c coda_vnops.c vcoda.h \
+ opt_coda.h
+
+CLEANFILES= vcoda.h opt_coda.h
+
+vcoda.h:
+ echo "#define NVCODA 4" > vcoda.h
+
+opt_coda.h:
+ echo "#define CODA_COMPAT_5" >opt_coda.h
+
+.include <bsd.kmod.mk>
OpenPOWER on IntegriCloud