/* the upcalls */ int venus_rootfid(struct super_block *sb, struct CodaFid *fidp)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error;
int venus_lookup(struct super_block *sb, struct CodaFid *fid, constchar *name, int length, int * type, struct CodaFid *resfid)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int offset;
int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
kuid_t uid)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error;
int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, struct file **fh)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error;
int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, constchar *name, int length, struct CodaFid *newfid, struct coda_vattr *attrs)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int offset;
int venus_create(struct super_block *sb, struct CodaFid *dirfid, constchar *name, int length, int excl, int mode, struct CodaFid *newfid, struct coda_vattr *attrs)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int offset;
int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, constchar *name, int length)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int offset;
int venus_remove(struct super_block *sb, struct CodaFid *dirfid, constchar *name, int length)
{ union inputArgs *inp; union outputArgs *outp; int error=0, insize, outsize, offset;
int venus_readlink(struct super_block *sb, struct CodaFid *fid, char *buffer, int *length)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int retlen; char *result;
int venus_link(struct super_block *sb, struct CodaFid *fid, struct CodaFid *dirfid, constchar *name, int len )
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int offset;
int venus_symlink(struct super_block *sb, struct CodaFid *fid, constchar *name, int len, constchar *symname, int symlen)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int offset, s;
int venus_pioctl(struct super_block *sb, struct CodaFid *fid, unsignedint cmd, struct PioctlData *data)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error; int iocsize;
insize = VC_MAXMSGSIZE;
UPARG(CODA_IOCTL);
/* build packet for Venus */ if (data->vi.in_size > VC_MAXDATASIZE) {
error = -EINVAL; gotoexit;
}
if (data->vi.out_size > VC_MAXDATASIZE) {
error = -EINVAL; gotoexit;
}
inp->coda_ioctl.VFid = *fid;
/* the cmd field was mutated by increasing its size field to *reflectthepathandfollowargs.Weneedtosubtractthat
* out before sending the command to Venus. */
inp->coda_ioctl.cmd = (cmd & ~(PIOCPARM_MASK << 16));
iocsize = ((cmd >> 16) & PIOCPARM_MASK) - sizeof(char *) - sizeof(int);
inp->coda_ioctl.cmd |= (iocsize & PIOCPARM_MASK) << 16;
/* get the data out of user space */ if (copy_from_user((char *)inp + (long)inp->coda_ioctl.data,
data->vi.in, data->vi.in_size)) {
error = -EINVAL; gotoexit;
}
/* Copy out the OUT buffer. */ if (outp->coda_ioctl.len > data->vi.out_size) {
error = -EINVAL; gotoexit;
}
/* Copy out the OUT buffer. */ if (copy_to_user(data->vi.out,
(char *)outp + (long)outp->coda_ioctl.data,
outp->coda_ioctl.len)) {
error = -EFAULT; gotoexit;
}
exit:
kvfree(inp); return error;
}
int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
{ union inputArgs *inp; union outputArgs *outp; int insize, outsize, error;
add_wait_queue(&req->uc_sleep, &wait); for (;;) { if (CODA_INTERRUPTIBLE(req))
set_current_state(TASK_INTERRUPTIBLE); else
set_current_state(TASK_UNINTERRUPTIBLE);
/* got a reply */ if (req->uc_flags & (CODA_REQ_WRITE | CODA_REQ_ABORT)) break;
/* Append msg to pending queue and poke Venus. */
list_add_tail(&req->uc_chain, &vcp->vc_pending);
wake_up_interruptible(&vcp->vc_waitq);
/* We can return early on asynchronous requests */ if (outSize == NULL) {
mutex_unlock(&vcp->vc_mutex); return0;
}
/* We can be interrupted while we wait for Venus to process *ourrequest.IftheinterruptoccursbeforeVenushasread *therequest,wedequeueandreturn.Ifitoccursafterthe *readbutbeforethereply,wedequeue,sendasignal *message,andreturn.Ifitoccursafterthereplyweignore *it.Innocasedowewanttorestartthesyscall.Ifit *wasinterruptedbyavenusshutdown(psdev_close),return
* ENODEV. */
/* Go to sleep. Wake up on signals only after the timeout. */
coda_waitfor_upcall(vcp, req);
/* Op went through, interrupt or not... */ if (req->uc_flags & CODA_REQ_WRITE) {
out = (union outputArgs *)req->uc_data; /* here we map positive Venus errors to kernel errors */
error = -out->oh.result;
*outSize = req->uc_outSize; gotoexit;
}
* *ThenextisaresultofVenusdetectinganinconsistentfile. *CODA_PURGEFID--flushtheattributeforthefile *purgeitanditschildrenfromthedcache * *ThelastallowsVenustoreplacelocalfidswithglobalones *duringreintegration. *
* CODA_REPLACE -- replace one CodaFid with another throughout the name cache */
int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out,
size_t nbytes)
{ struct inode *inode = NULL; struct CodaFid *fid = NULL, *newfid; struct super_block *sb;
/* *Makesurewehavereceivedenoughdatafromthecache *managertopopulatethenecessaryfieldsinthebuffer
*/ switch (opcode) { case CODA_PURGEUSER: if (nbytes < sizeof(struct coda_purgeuser_out)) return -EINVAL; break;
case CODA_ZAPDIR: if (nbytes < sizeof(struct coda_zapdir_out)) return -EINVAL; break;
case CODA_ZAPFILE: if (nbytes < sizeof(struct coda_zapfile_out)) return -EINVAL; break;
case CODA_PURGEFID: if (nbytes < sizeof(struct coda_purgefid_out)) return -EINVAL; break;
case CODA_REPLACE: if (nbytes < sizeof(struct coda_replace_out)) return -EINVAL; break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.