aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/upcall.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/coda/upcall.c')
-rw-r--r--fs/coda/upcall.c79
1 files changed, 38 insertions, 41 deletions
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index 87601e147644..9a20a3b1998e 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -37,7 +37,7 @@
37#include <linux/coda_cache.h> 37#include <linux/coda_cache.h>
38#include <linux/coda_proc.h> 38#include <linux/coda_proc.h>
39 39
40static int coda_upcall(struct coda_sb_info *mntinfo, int inSize, int *outSize, 40static int coda_upcall(struct venus_comm *vc, int inSize, int *outSize,
41 union inputArgs *buffer); 41 union inputArgs *buffer);
42 42
43static void *alloc_upcall(int opcode, int size) 43static void *alloc_upcall(int opcode, int size)
@@ -83,7 +83,7 @@ int venus_rootfid(struct super_block *sb, struct CodaFid *fidp)
83 insize = SIZE(root); 83 insize = SIZE(root);
84 UPARG(CODA_ROOT); 84 UPARG(CODA_ROOT);
85 85
86 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 86 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
87 if (!error) 87 if (!error)
88 *fidp = outp->coda_root.VFid; 88 *fidp = outp->coda_root.VFid;
89 89
@@ -102,7 +102,7 @@ int venus_getattr(struct super_block *sb, struct CodaFid *fid,
102 UPARG(CODA_GETATTR); 102 UPARG(CODA_GETATTR);
103 inp->coda_getattr.VFid = *fid; 103 inp->coda_getattr.VFid = *fid;
104 104
105 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 105 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
106 if (!error) 106 if (!error)
107 *attr = outp->coda_getattr.attr; 107 *attr = outp->coda_getattr.attr;
108 108
@@ -123,7 +123,7 @@ int venus_setattr(struct super_block *sb, struct CodaFid *fid,
123 inp->coda_setattr.VFid = *fid; 123 inp->coda_setattr.VFid = *fid;
124 inp->coda_setattr.attr = *vattr; 124 inp->coda_setattr.attr = *vattr;
125 125
126 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 126 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
127 127
128 CODA_FREE(inp, insize); 128 CODA_FREE(inp, insize);
129 return error; 129 return error;
@@ -149,7 +149,7 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid,
149 memcpy((char *)(inp) + offset, name, length); 149 memcpy((char *)(inp) + offset, name, length);
150 *((char *)inp + offset + length) = '\0'; 150 *((char *)inp + offset + length) = '\0';
151 151
152 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 152 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
153 if (!error) { 153 if (!error) {
154 *resfid = outp->coda_lookup.VFid; 154 *resfid = outp->coda_lookup.VFid;
155 *type = outp->coda_lookup.vtype; 155 *type = outp->coda_lookup.vtype;
@@ -182,7 +182,7 @@ int venus_store(struct super_block *sb, struct CodaFid *fid, int flags,
182 inp->coda_store.VFid = *fid; 182 inp->coda_store.VFid = *fid;
183 inp->coda_store.flags = flags; 183 inp->coda_store.flags = flags;
184 184
185 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 185 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
186 186
187 CODA_FREE(inp, insize); 187 CODA_FREE(inp, insize);
188 return error; 188 return error;
@@ -200,7 +200,7 @@ int venus_release(struct super_block *sb, struct CodaFid *fid, int flags)
200 inp->coda_release.VFid = *fid; 200 inp->coda_release.VFid = *fid;
201 inp->coda_release.flags = flags; 201 inp->coda_release.flags = flags;
202 202
203 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 203 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
204 204
205 CODA_FREE(inp, insize); 205 CODA_FREE(inp, insize);
206 return error; 206 return error;
@@ -229,7 +229,7 @@ int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
229 inp->coda_close.VFid = *fid; 229 inp->coda_close.VFid = *fid;
230 inp->coda_close.flags = flags; 230 inp->coda_close.flags = flags;
231 231
232 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 232 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
233 233
234 CODA_FREE(inp, insize); 234 CODA_FREE(inp, insize);
235 return error; 235 return error;
@@ -248,7 +248,7 @@ int venus_open(struct super_block *sb, struct CodaFid *fid,
248 inp->coda_open_by_fd.VFid = *fid; 248 inp->coda_open_by_fd.VFid = *fid;
249 inp->coda_open_by_fd.flags = flags; 249 inp->coda_open_by_fd.flags = flags;
250 250
251 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 251 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
252 if (!error) 252 if (!error)
253 *fh = outp->coda_open_by_fd.fh; 253 *fh = outp->coda_open_by_fd.fh;
254 254
@@ -276,7 +276,7 @@ int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
276 memcpy((char *)(inp) + offset, name, length); 276 memcpy((char *)(inp) + offset, name, length);
277 *((char *)inp + offset + length) = '\0'; 277 *((char *)inp + offset + length) = '\0';
278 278
279 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 279 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
280 if (!error) { 280 if (!error) {
281 *attrs = outp->coda_mkdir.attr; 281 *attrs = outp->coda_mkdir.attr;
282 *newfid = outp->coda_mkdir.VFid; 282 *newfid = outp->coda_mkdir.VFid;
@@ -318,7 +318,7 @@ int venus_rename(struct super_block *sb, struct CodaFid *old_fid,
318 memcpy((char *)(inp) + offset, new_name, new_length); 318 memcpy((char *)(inp) + offset, new_name, new_length);
319 *((char *)inp + offset + new_length) = '\0'; 319 *((char *)inp + offset + new_length) = '\0';
320 320
321 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 321 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
322 322
323 CODA_FREE(inp, insize); 323 CODA_FREE(inp, insize);
324 return error; 324 return error;
@@ -347,7 +347,7 @@ int venus_create(struct super_block *sb, struct CodaFid *dirfid,
347 memcpy((char *)(inp) + offset, name, length); 347 memcpy((char *)(inp) + offset, name, length);
348 *((char *)inp + offset + length) = '\0'; 348 *((char *)inp + offset + length) = '\0';
349 349
350 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 350 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
351 if (!error) { 351 if (!error) {
352 *attrs = outp->coda_create.attr; 352 *attrs = outp->coda_create.attr;
353 *newfid = outp->coda_create.VFid; 353 *newfid = outp->coda_create.VFid;
@@ -373,8 +373,8 @@ int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
373 inp->coda_rmdir.name = offset; 373 inp->coda_rmdir.name = offset;
374 memcpy((char *)(inp) + offset, name, length); 374 memcpy((char *)(inp) + offset, name, length);
375 *((char *)inp + offset + length) = '\0'; 375 *((char *)inp + offset + length) = '\0';
376 376
377 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 377 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
378 378
379 CODA_FREE(inp, insize); 379 CODA_FREE(inp, insize);
380 return error; 380 return error;
@@ -395,8 +395,8 @@ int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
395 inp->coda_remove.name = offset; 395 inp->coda_remove.name = offset;
396 memcpy((char *)(inp) + offset, name, length); 396 memcpy((char *)(inp) + offset, name, length);
397 *((char *)inp + offset + length) = '\0'; 397 *((char *)inp + offset + length) = '\0';
398 398
399 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 399 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
400 400
401 CODA_FREE(inp, insize); 401 CODA_FREE(inp, insize);
402 return error; 402 return error;
@@ -417,7 +417,7 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid,
417 417
418 inp->coda_readlink.VFid = *fid; 418 inp->coda_readlink.VFid = *fid;
419 419
420 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 420 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
421 if (!error) { 421 if (!error) {
422 retlen = outp->coda_readlink.count; 422 retlen = outp->coda_readlink.count;
423 if ( retlen > *length ) 423 if ( retlen > *length )
@@ -453,8 +453,8 @@ int venus_link(struct super_block *sb, struct CodaFid *fid,
453 /* make sure strings are null terminated */ 453 /* make sure strings are null terminated */
454 memcpy((char *)(inp) + offset, name, len); 454 memcpy((char *)(inp) + offset, name, len);
455 *((char *)inp + offset + len) = '\0'; 455 *((char *)inp + offset + len) = '\0';
456 456
457 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 457 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
458 458
459 CODA_FREE(inp, insize); 459 CODA_FREE(inp, insize);
460 return error; 460 return error;
@@ -489,7 +489,7 @@ int venus_symlink(struct super_block *sb, struct CodaFid *fid,
489 memcpy((char *)(inp) + offset, name, len); 489 memcpy((char *)(inp) + offset, name, len);
490 *((char *)inp + offset + len) = '\0'; 490 *((char *)inp + offset + len) = '\0';
491 491
492 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 492 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
493 493
494 CODA_FREE(inp, insize); 494 CODA_FREE(inp, insize);
495 return error; 495 return error;
@@ -504,9 +504,9 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid)
504 insize=SIZE(fsync); 504 insize=SIZE(fsync);
505 UPARG(CODA_FSYNC); 505 UPARG(CODA_FSYNC);
506 506
507 inp->coda_fsync.VFid = *fid; 507 inp->coda_fsync.VFid = *fid;
508 error = coda_upcall(coda_sbp(sb), sizeof(union inputArgs), 508 error = coda_upcall(coda_vcp(sb), sizeof(union inputArgs),
509 &outsize, inp); 509 &outsize, inp);
510 510
511 CODA_FREE(inp, insize); 511 CODA_FREE(inp, insize);
512 return error; 512 return error;
@@ -524,7 +524,7 @@ int venus_access(struct super_block *sb, struct CodaFid *fid, int mask)
524 inp->coda_access.VFid = *fid; 524 inp->coda_access.VFid = *fid;
525 inp->coda_access.flags = mask; 525 inp->coda_access.flags = mask;
526 526
527 error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); 527 error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
528 528
529 CODA_FREE(inp, insize); 529 CODA_FREE(inp, insize);
530 return error; 530 return error;
@@ -573,9 +573,9 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
573 goto exit; 573 goto exit;
574 } 574 }
575 575
576 error = coda_upcall(coda_sbp(sb), SIZE(ioctl) + data->vi.in_size, 576 error = coda_upcall(coda_vcp(sb), SIZE(ioctl) + data->vi.in_size,
577 &outsize, inp); 577 &outsize, inp);
578 578
579 if (error) { 579 if (error) {
580 printk("coda_pioctl: Venus returns: %d for %s\n", 580 printk("coda_pioctl: Venus returns: %d for %s\n",
581 error, coda_f2s(fid)); 581 error, coda_f2s(fid));
@@ -615,7 +615,7 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs)
615 insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); 615 insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs));
616 UPARG(CODA_STATFS); 616 UPARG(CODA_STATFS);
617 617
618 error = coda_upcall(coda_sbp(dentry->d_sb), insize, &outsize, inp); 618 error = coda_upcall(coda_vcp(dentry->d_sb), insize, &outsize, inp);
619 if (!error) { 619 if (!error) {
620 sfs->f_blocks = outp->coda_statfs.stat.f_blocks; 620 sfs->f_blocks = outp->coda_statfs.stat.f_blocks;
621 sfs->f_bfree = outp->coda_statfs.stat.f_bfree; 621 sfs->f_bfree = outp->coda_statfs.stat.f_bfree;
@@ -710,28 +710,25 @@ static inline void coda_waitfor_upcall(struct upc_req *req)
710} 710}
711 711
712 712
713/* 713/*
714 * coda_upcall will return an error in the case of 714 * coda_upcall will return an error in the case of
715 * failed communication with Venus _or_ will peek at Venus 715 * failed communication with Venus _or_ will peek at Venus
716 * reply and return Venus' error. 716 * reply and return Venus' error.
717 * 717 *
718 * As venus has 2 types of errors, normal errors (positive) and internal 718 * As venus has 2 types of errors, normal errors (positive) and internal
719 * errors (negative), normal errors are negated, while internal errors 719 * errors (negative), normal errors are negated, while internal errors
720 * are all mapped to -EINTR, while showing a nice warning message. (jh) 720 * are all mapped to -EINTR, while showing a nice warning message. (jh)
721 *
722 */ 721 */
723static int coda_upcall(struct coda_sb_info *sbi, 722static int coda_upcall(struct venus_comm *vcp,
724 int inSize, int *outSize, 723 int inSize, int *outSize,
725 union inputArgs *buffer) 724 union inputArgs *buffer)
726{ 725{
727 struct venus_comm *vcommp;
728 union outputArgs *out; 726 union outputArgs *out;
729 union inputArgs *sig_inputArgs; 727 union inputArgs *sig_inputArgs;
730 struct upc_req *req, *sig_req; 728 struct upc_req *req, *sig_req;
731 int error = 0; 729 int error = 0;
732 730
733 vcommp = sbi->sbi_vcomm; 731 if (!vcp->vc_inuse) {
734 if (!vcommp->vc_inuse) {
735 printk(KERN_NOTICE "coda: Venus dead, not sending upcall\n"); 732 printk(KERN_NOTICE "coda: Venus dead, not sending upcall\n");
736 return -ENXIO; 733 return -ENXIO;
737 } 734 }
@@ -746,16 +743,16 @@ static int coda_upcall(struct coda_sb_info *sbi,
746 req->uc_inSize = inSize; 743 req->uc_inSize = inSize;
747 req->uc_outSize = *outSize ? *outSize : inSize; 744 req->uc_outSize = *outSize ? *outSize : inSize;
748 req->uc_opcode = ((union inputArgs *)buffer)->ih.opcode; 745 req->uc_opcode = ((union inputArgs *)buffer)->ih.opcode;
749 req->uc_unique = ++vcommp->vc_seq; 746 req->uc_unique = ++vcp->vc_seq;
750 init_waitqueue_head(&req->uc_sleep); 747 init_waitqueue_head(&req->uc_sleep);
751 748
752 /* Fill in the common input args. */ 749 /* Fill in the common input args. */
753 ((union inputArgs *)buffer)->ih.unique = req->uc_unique; 750 ((union inputArgs *)buffer)->ih.unique = req->uc_unique;
754 751
755 /* Append msg to pending queue and poke Venus. */ 752 /* Append msg to pending queue and poke Venus. */
756 list_add_tail(&req->uc_chain, &vcommp->vc_pending); 753 list_add_tail(&req->uc_chain, &vcp->vc_pending);
757 754
758 wake_up_interruptible(&vcommp->vc_waitq); 755 wake_up_interruptible(&vcp->vc_waitq);
759 /* We can be interrupted while we wait for Venus to process 756 /* We can be interrupted while we wait for Venus to process
760 * our request. If the interrupt occurs before Venus has read 757 * our request. If the interrupt occurs before Venus has read
761 * the request, we dequeue and return. If it occurs after the 758 * the request, we dequeue and return. If it occurs after the
@@ -788,7 +785,7 @@ static int coda_upcall(struct coda_sb_info *sbi,
788 goto exit; 785 goto exit;
789 786
790 /* Venus saw the upcall, make sure we can send interrupt signal */ 787 /* Venus saw the upcall, make sure we can send interrupt signal */
791 if (!vcommp->vc_inuse) { 788 if (!vcp->vc_inuse) {
792 printk(KERN_INFO "coda: Venus dead, not sending signal.\n"); 789 printk(KERN_INFO "coda: Venus dead, not sending signal.\n");
793 goto exit; 790 goto exit;
794 } 791 }
@@ -815,8 +812,8 @@ static int coda_upcall(struct coda_sb_info *sbi,
815 sig_req->uc_outSize = sizeof(struct coda_in_hdr); 812 sig_req->uc_outSize = sizeof(struct coda_in_hdr);
816 813
817 /* insert at head of queue! */ 814 /* insert at head of queue! */
818 list_add(&(sig_req->uc_chain), &vcommp->vc_pending); 815 list_add(&(sig_req->uc_chain), &vcp->vc_pending);
819 wake_up_interruptible(&vcommp->vc_waitq); 816 wake_up_interruptible(&vcp->vc_waitq);
820 817
821exit: 818exit:
822 kfree(req); 819 kfree(req);