Coda File System

[Darwincoda] Re: Finder magic?

From: Pekka Nikander <pekka.nikander_at_iki.fi>
Date: Tue, 3 Aug 2004 17:21:11 +0300
>> 'The volume for "testserver.coda.cs.cmu.edu" cannot be found, insert
>> the volume for "testserver.coda.cs.cmu.edu" and wait for it to appear
>> on the desktop, then try again'
>>
>> Can anyone explain what happens behind the scene here, or give me a
>> pointer to some documents.
>
> See http://developer.apple.com/qa/qa2004/qa1351.html

That seems to be it.  I have now a working version, but need to
clean up it more before I know what was the real problem.

However, here are some initial diffs:

Index: coda_vnops.c
===================================================================
RCS file: 
/Volumes/src/cvs/od/proj/DarwinCoda/sys/darwin-7.3/coda/coda_vnops.c,v
retrieving revision 1.14
diff -u -r1.14 coda_vnops.c
--- coda_vnops.c	13 Jun 2004 09:42:42 -0000	1.14
+++ coda_vnops.c	3 Aug 2004 14:23:22 -0000
@@ -841,6 +841,7 @@
      }

      error = venus_getattr(vtomi(vp), &cp->c_fid, cred, THREAD2PROC, 
vap);
+    vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];

      if (!error) {
  	CODADEBUG(CODA_GETATTR, myprintf(("getattr miss %s vp=%p: result 
%d\n",

Index: coda_vfsops.c
===================================================================
RCS file: 
/Volumes/src/cvs/od/proj/DarwinCoda/sys/darwin-7.3/coda/coda_vfsops.c,v
retrieving revision 1.10
diff -u -r1.10 coda_vfsops.c
--- coda_vfsops.c	13 Jun 2004 07:10:55 -0000	1.10
+++ coda_vfsops.c	3 Aug 2004 14:21:14 -0000
@@ -104,10 +104,13 @@
  	return 0;
  }

+static int coda_mount_type;
+
  int
-coda_init(struct vfsconf * vfsconf)
+coda_init(struct vfsconf *vfsp)
  {
      ENTRY;
+    coda_mount_type = vfsp->vfc_typenum;
      LEAVE;
      return 0;
  }
@@ -127,6 +130,8 @@
  {
      struct vnode *dvp;
      struct cnode *cp;
+    char path_buf[MNAMELEN];
+    size_t len;
      dev_t dev;
      struct coda_mntinfo *mi;
      struct vnode *rootvp;
@@ -145,6 +150,12 @@
          LEAVE;
  	return(EBUSY);
      }
+
+    /* Get mount point name */
+    error = copyinstr(path, path_buf, MNAMELEN-1, &len);
+    if (error)
+	    return(error);
+    memset(path_buf + len, '\0', MNAMELEN - len);

      /* Validate mount device.  Similar to getmdev(). */
      NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, td);
@@ -212,12 +222,11 @@
       * to coda_root in case a server is down while venus is starting.
       */
      cp = make_coda_node(&rootfid, vfsp, VDIR);
-    if(cp==0)
-    {
+    if(cp==0) {
          LEAVE;
          return ENOMEM;
      }
-    SET_CNODE_NAME("/coda");
+    SET_CNODE_NAME(path_buf);
      rootvp = CTOV(cp);
      rootvp->v_vflag |= VV_ROOT;
  	
@@ -250,14 +259,15 @@
      /* Checked UFS. iosize is set as 8192 */
      vfsp->mnt_stat.f_iosize = 8192;

+    memcpy(vfsp->mnt_stat.f_mntonname, path_buf, MNAMELEN);
+    memcpy(vfsp->mnt_stat.f_mntfromname, "CODA", MNAMELEN);
+
      /* error is currently guaranteed to be zero, but in case some
         code changes... */
-    CODADEBUG(1,
-	     myprintf(("coda_mount returned %d\n",error)););
+    CODADEBUG(1, myprintf(("coda_mount returned %d\n", error)););
      if (error)
  	MARK_INT_FAIL(CODA_MOUNT_STATS);
-    else
-    {
+    else {
  	MARK_INT_SAT(CODA_MOUNT_STATS);
  	coda_instances++;
      }
@@ -478,7 +488,12 @@
  	return(EINVAL);
      }

+#if 0
      bzero(sbp, sizeof(struct statfs));
+#else
+    sbp->f_type = coda_mount_type;
+    sbp->f_flags = 0;
+#endif
      /* XXX - what to do about f_flags, others? --bnoble */
      /* Below This is what AFS does
      	#define NB_SFS_SIZ 0x895440
@@ -490,17 +505,16 @@
      sbp->f_blocks = NB_SFS_SIZ;
      sbp->f_bfree = NB_SFS_SIZ;
      sbp->f_bavail = NB_SFS_SIZ;
-    sbp->f_files = NB_SFS_SIZ;
-    sbp->f_ffree = NB_SFS_SIZ;
-    if (sbp != &vfsp->mnt_stat)
-    {
-        memcpy((caddr_t) & sbp->f_mntonname[0], (caddr_t) 
vfsp->mnt_stat.f_mntonname, MNAMELEN);
-        memcpy((caddr_t) & sbp->f_mntfromname[0], (caddr_t) 
vfsp->mnt_stat.f_mntfromname, MNAMELEN);
-    }
-    else
-    {
-	    snprintf(sbp->f_mntonname, sizeof(sbp->f_mntonname), "/coda");
-	    snprintf(sbp->f_mntfromname, sizeof(sbp->f_mntfromname), "CODA");
+    sbp->f_files = 0;
+    sbp->f_ffree = 0;
+    if (sbp != &vfsp->mnt_stat) {
+      memcpy(sbp->f_mntonname, vfsp->mnt_stat.f_mntonname, MNAMELEN);
+      memcpy(sbp->f_mntfromname, vfsp->mnt_stat.f_mntfromname, 
MNAMELEN);
+    } else {
+#if 0
+      snprintf(sbp->f_mntonname, sizeof(sbp->f_mntonname), 
"/Volumes/coda"); /* XXX */
+      snprintf(sbp->f_mntfromname, sizeof(sbp->f_mntfromname), "CODA");
+#endif
      }
      sbp->f_type = vfsp->mnt_vfc->vfc_typenum;
      snprintf(sbp->f_fstypename, sizeof(sbp->f_fstypename), "coda");

_______________________________________________
Darwincoda mailing list
Darwincoda_at_opendarwin.org
http://www.opendarwin.org/mailman/listinfo/DarwinCoda
Received on 2004-08-08 05:24:31