struct coda_inode_info *cii = ITOC(inode);
cii->c_cached_epoch = atomic_read(&permission_epoch);
- if ( !coda_cred_ok(&cii->c_cached_cred) ) {
- coda_load_creds(&cii->c_cached_cred);
+ if (cii->c_uid != current->fsuid) {
+ cii->c_uid = current->fsuid;
cii->c_cached_perm = mask;
} else
cii->c_cached_perm |= mask;
int hit;
hit = (mask & cii->c_cached_perm) == mask &&
- coda_cred_ok(&cii->c_cached_cred) &&
- cii->c_cached_epoch == atomic_read(&permission_epoch);
+ cii->c_uid == current->fsuid &&
+ cii->c_cached_epoch == atomic_read(&permission_epoch);
return hit;
}
return ( i->i_sb->s_root->d_inode == i );
}
-/* put the current process credentials in the cred */
-void coda_load_creds(struct coda_cred *cred)
-{
- cred->cr_uid = (vuid_t) current->uid;
- cred->cr_euid = (vuid_t) current->euid;
- cred->cr_suid = (vuid_t) current->suid;
- cred->cr_fsuid = (vuid_t) current->fsuid;
-
- cred->cr_groupid = (vgid_t) current->gid;
- cred->cr_egid = (vgid_t) current->egid;
- cred->cr_sgid = (vgid_t) current->sgid;
- cred->cr_fsgid = (vgid_t) current->fsgid;
-}
-
-int coda_cred_ok(struct coda_cred *cred)
-{
- return(current->fsuid == cred->cr_fsuid);
-}
-
-int coda_cred_eq(struct coda_cred *cred1, struct coda_cred *cred2)
-{
- return (cred1->cr_fsuid == cred2->cr_fsuid);
-}
-
unsigned short coda_flags_to_cflags(unsigned short flags)
{
unsigned short coda_flags = 0;
cfi->cfi_magic = CODA_MAGIC;
cfi->cfi_mapcount = 0;
cfi->cfi_container = host_file;
- coda_load_creds(&cfi->cfi_cred);
BUG_ON(coda_file->private_data != NULL);
coda_file->private_data = cfi;
coda_inode = coda_file->f_dentry->d_inode;
err = venus_store(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags,
- &cfi->cfi_cred);
+ coda_file->f_uid);
if (err == -EOPNOTSUPP) {
use_coda_close = 1;
if (use_coda_close)
err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
- coda_flags, &cfi->cfi_cred);
+ coda_flags, coda_file->f_uid);
host_inode = cfi->cfi_container->f_dentry->d_inode;
cii = ITOC(coda_inode);
return NULL;
memset(&ei->c_fid, 0, sizeof(struct ViceFid));
ei->c_flags = 0;
- memset(&ei->c_cached_cred, 0, sizeof(struct coda_cred));
+ ei->c_uid = 0;
ei->c_cached_perm = 0;
return &ei->vfs_inode;
}
inp->ih.opcode = opcode;
inp->ih.pid = current->pid;
inp->ih.pgid = current->pgrp;
- coda_load_creds(&(inp->ih.cred));
+ memset(&inp->ih.cred, 0, sizeof(struct coda_cred));
+ inp->ih.cred.cr_fsuid = current->fsuid;
return (void*)inp;
}
}
int venus_store(struct super_block *sb, struct ViceFid *fid, int flags,
- struct coda_cred *cred)
+ vuid_t uid)
{
union inputArgs *inp;
union outputArgs *outp;
int insize, outsize, error;
+ struct coda_cred cred = { 0, };
+ cred.cr_fsuid = uid;
insize = SIZE(store);
UPARG(CODA_STORE);
- memcpy(&(inp->ih.cred), cred, sizeof(*cred));
+ memcpy(&(inp->ih.cred), &cred, sizeof(cred));
inp->coda_store.VFid = *fid;
inp->coda_store.flags = flags;
}
int venus_close(struct super_block *sb, struct ViceFid *fid, int flags,
- struct coda_cred *cred)
+ vuid_t uid)
{
union inputArgs *inp;
union outputArgs *outp;
int insize, outsize, error;
+ struct coda_cred cred = { 0, };
+ cred.cr_fsuid = uid;
insize = SIZE(release);
UPARG(CODA_CLOSE);
- memcpy(&(inp->ih.cred), cred, sizeof(*cred));
+ memcpy(&(inp->ih.cred), &cred, sizeof(cred));
inp->coda_close.VFid = *fid;
inp->coda_close.flags = flags;
u_short c_flags; /* flags (see below) */
struct list_head c_cilist; /* list of all coda inodes */
unsigned int c_mapcount; /* nr of times this inode is mapped */
- unsigned int c_cached_epoch;
- struct coda_cred c_cached_cred; /* credentials of cached perms */
+ unsigned int c_cached_epoch; /* epoch for cached permissions */
+ vuid_t c_uid; /* fsuid for cached permissions */
unsigned int c_cached_perm; /* cached access permissions */
struct inode vfs_inode;
};
int cfi_magic; /* magic number */
struct file *cfi_container; /* container file for this cnode */
unsigned int cfi_mapcount; /* nr of times this file is mapped */
- struct coda_cred cfi_cred; /* credentials of opener */
};
#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data))
int coda_isroot(struct inode *i);
int coda_iscontrol(const char *name, size_t length);
-void coda_load_creds(struct coda_cred *cred);
void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
unsigned short coda_flags_to_cflags(unsigned short);
-int coda_cred_ok(struct coda_cred *cred);
-int coda_cred_eq(struct coda_cred *cred1, struct coda_cred *cred2);
/* sysctl.h */
void coda_sysctl_init(void);
int venus_lookup(struct super_block *sb, struct ViceFid *fid,
const char *name, int length, int *type,
struct ViceFid *resfid);
-int venus_store(struct super_block *sb, struct ViceFid *fid, int flags,
- struct coda_cred *);
+int venus_store(struct super_block *sb, struct ViceFid *fid, int flags, vuid_t uid);
int venus_release(struct super_block *sb, struct ViceFid *fid, int flags);
-int venus_close(struct super_block *sb, struct ViceFid *fid, int flags,
- struct coda_cred *);
+int venus_close(struct super_block *sb, struct ViceFid *fid, int flags, vuid_t uid);
int venus_open(struct super_block *sb, struct ViceFid *fid,
int flags, struct file **f);
int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid,