Commit d7d65a95 authored by Jan Harkes's avatar Jan Harkes Committed by Linus Torvalds

[PATCH] Coda updates [5/5]

Introduce a new kernel-userspace interface that uses 128-bit file
identifiers instead of the previously used 96-bit fileids. We also
replacing the coda_creds structure with only the fsuid.

This new API has been used by for a couple of months now, people had to
patch their kernels whenever they want to run a current Coda release.
A new Kconfig option is added to fall back on the old API for older Coda
clients and other userspace filesystems that might use our protocol.
parent 01a4efd9
......@@ -1562,6 +1562,20 @@ config CODA_FS
whenever you want), say M here and read
<file:Documentation/modules.txt>. The module will be called coda.
config CODA_FS_OLD_API
bool "Use 96-bit Coda file identifiers"
depends on CODA_FS
help
A new kernel-userspace API had to be introduced for Coda v6.0
to support larger 128-bit file identifiers as needed by the
new realms implementation.
However this new API is not backward compatible with older
clients. If you really need to run the old Coda userspace
cache manager then say Y.
For most cases you probably want to say N.
config INTERMEZZO_FS
tristate "InterMezzo file system support (replicating fs) (EXPERIMENTAL)"
depends on INET && EXPERIMENTAL
......
......@@ -28,7 +28,11 @@ int coda_fake_statfs;
char * coda_f2s(struct CodaFid *f)
{
static char s[60];
#ifdef CODA_FS_OLD_API
sprintf(s, "(%08x.%08x.%08x)", f->opaque[0], f->opaque[1], f->opaque[2]);
#else
sprintf(s, "(%08x.%08x.%08x.%08x)", f->opaque[0], f->opaque[1], f->opaque[2], f->opaque[3]);
#endif
return s;
}
......
......@@ -384,7 +384,13 @@ static int __init init_coda(void)
{
int status;
int i;
printk(KERN_INFO "Coda Kernel/Venus communications, v5.3.15, coda@cs.cmu.edu\n");
printk(KERN_INFO "Coda Kernel/Venus communications, "
#ifdef CODA_FS_OLD_API
"v5.3.20"
#else
"v6.0.0"
#endif
", coda@cs.cmu.edu\n");
status = coda_init_inodecache();
if (status)
......
......@@ -55,9 +55,12 @@ static void *alloc_upcall(int opcode, int size)
inp->ih.opcode = opcode;
inp->ih.pid = current->pid;
inp->ih.pgid = current->pgrp;
#ifdef CODA_FS_OLD_API
memset(&inp->ih.cred, 0, sizeof(struct coda_cred));
inp->ih.cred.cr_fsuid = current->fsuid;
#else
inp->ih.uid = current->fsuid;
#endif
return (void*)inp;
}
......@@ -169,13 +172,19 @@ int venus_store(struct super_block *sb, struct CodaFid *fid, int flags,
union inputArgs *inp;
union outputArgs *outp;
int insize, outsize, error;
#ifdef CODA_FS_OLD_API
struct coda_cred cred = { 0, };
cred.cr_fsuid = uid;
#endif
insize = SIZE(store);
UPARG(CODA_STORE);
#ifdef CODA_FS_OLD_API
memcpy(&(inp->ih.cred), &cred, sizeof(cred));
#else
inp->ih.uid = uid;
#endif
inp->coda_store.VFid = *fid;
inp->coda_store.flags = flags;
......@@ -210,13 +219,19 @@ int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
union inputArgs *inp;
union outputArgs *outp;
int insize, outsize, error;
#ifdef CODA_FS_OLD_API
struct coda_cred cred = { 0, };
cred.cr_fsuid = uid;
#endif
insize = SIZE(release);
UPARG(CODA_CLOSE);
#ifdef CODA_FS_OLD_API
memcpy(&(inp->ih.cred), &cred, sizeof(cred));
#else
inp->ih.uid = uid;
#endif
inp->coda_close.VFid = *fid;
inp->coda_close.flags = flags;
......
......@@ -59,7 +59,7 @@ Mellon the rights to redistribute these changes without encumbrance.
#ifndef _CODA_HEADER_
#define _CODA_HEADER_
#include <linux/config.h>
/* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
#if defined(__NetBSD__) || \
......@@ -194,11 +194,17 @@ struct venus_dirent {
#endif
#ifndef _VUID_T_
#define _VUID_T_
typedef u_int32_t vuid_t;
typedef u_int32_t vgid_t;
#endif /*_VUID_T_ */
#ifdef CODA_FS_OLD_API
struct CodaFid {
u_int32_t opaque[3];
};
#ifdef __linux__
static __inline__ ino_t coda_f2i(struct CodaFid *fid)
{
if ( ! fid )
......@@ -209,24 +215,20 @@ static __inline__ ino_t coda_f2i(struct CodaFid *fid)
return (fid->opaque[2] + (fid->opaque[1]<<10) + (fid->opaque[0]<<20));
}
#else
#define coda_f2i(fid)\
((fid) ? ((fid)->opaque[2] + ((fid)->opaque[1]<<10) + ((fid)->opaque[0]<<20)) : 0)
#endif
#ifndef _VUID_T_
#define _VUID_T_
typedef u_int32_t vuid_t;
typedef u_int32_t vgid_t;
#endif /*_VUID_T_ */
#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 */
};
#else /* not defined(CODA_FS_OLD_API) */
struct CodaFid {
u_int32_t opaque[4];
};
#define coda_f2i(fid)\
(fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
#endif
#ifndef _VENUS_VATTR_T_
......@@ -316,7 +318,11 @@ struct coda_statfs {
#define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
#define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
#endif
#define CODA_KERNEL_VERSION 2 /* venus_lookup gets an extra parameter */
#ifdef CODA_FS_OLD_API
#define CODA_KERNEL_VERSION 2 /* venus_lookup got an extra parameter */
#else
#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
#endif
/*
* Venus <-> Coda RPC arguments
......@@ -324,10 +330,16 @@ struct coda_statfs {
struct coda_in_hdr {
u_int32_t opcode;
u_int32_t unique; /* Keep multiple outstanding msgs distinct */
#ifdef CODA_FS_OLD_API
u_int16_t pid; /* Common to all */
u_int16_t pgid; /* Common to all */
u_int16_t sid; /* Common to all */
struct coda_cred cred; /* Common to all */
#else
pid_t pid;
pid_t pgid;
vuid_t uid;
#endif
};
/* Really important that opcode and unique are 1st two fields! */
......@@ -602,7 +614,11 @@ struct coda_vget_out {
/* CODA_PURGEUSER is a venus->kernel call */
struct coda_purgeuser_out {
struct coda_out_hdr oh;
#ifdef CODA_FS_OLD_API
struct coda_cred cred;
#else
vuid_t uid;
#endif
};
/* coda_zapfile: */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment