freebsd problems and newwalk() problem & solution

Alec Wolman wolman at cs.washington.edu
Fri Jul 10 04:20:49 CEST 1998



I'm trying to setup arla-0.7.2 with a FreeBSD 2.2.6 system.
I can't seem to get through the INSTALL directions.  The first
problem I ran into is that when I use the modload command to install
the xfs module, it doesn't tell me what the major device number
is.  I fixed that problem (I've appended my one-line patch below),
but I still get an error when I attempt to mount the afs filesystem.
The error is:

miles# /usr/arla/bin/mount_xfs /dev/xfs0 /afs
mount_xfs: mount: Operation not supported by device

Here is my first patch:
> rcsdiff -r1.1 -r1.2 xfs_dev.c
===================================================================
RCS file: RCS/xfs_dev.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
47c47
< RCSID("$Id: xfs_dev.c,v 1.1 1998/07/09 23:35:34 wolman Exp $");
---
> RCSID("$Id: xfs_dev.c,v 1.2 1998/07/09 23:37:18 wolman Exp $");
727c727
<     printf("char device number %d\n", major(dev));
---
>     uprintf("char device number %d\n", major(dev));
Exit 1


Also, a while back I reported a problem with using arlad in test mode.
I finally got around to fixing the newwalk() routine so that it
works much better now.  Here is my patch:

rcsdiff -C 3 -r1.1 -r1.2 arla.c
===================================================================
RCS file: RCS/arla.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 3 -r1.1 -r1.2
*** arla.c      1998/07/10 00:00:27     1.1
--- arla.c      1998/07/10 02:02:53     1.2
***************
*** 46,57 ****
  
  #include <version.h>
  
! RCSID("$Id: arla.c,v 1.1 1998/07/10 00:00:27 wolman Exp $") ;
  
  enum connected_mode connected_mode = CONNECTED;
  
  static CredCacheEntry *tmpce;
  
  static int arla_chdir(int, char **);
  static int arla_ls(int, char **);
  static int arla_cat(int, char **);
--- 46,60 ----
  
  #include <version.h>
  
! RCSID("$Id: arla.c,v 1.2 1998/07/10 02:02:53 wolman Exp $") ;
  
  enum connected_mode connected_mode = CONNECTED;
  
  static CredCacheEntry *tmpce;
  
+ static VenusFid cwd;
+ static VenusFid rootcwd;
+ 
  static int arla_chdir(int, char **);
  static int arla_ls(int, char **);
  static int arla_cat(int, char **);
***************
*** 101,124 ****
  newwalk (VenusFid *startdir, char *fname)
  {
       VenusFid cwd = *startdir;
!      char *slash;
!      char *comp;
       VenusFid file;
       Result ret;
       FCacheEntry *entry;
       int error;
       char symlink[MAXPATHLEN];
  
       do {
!        comp = fname;
!        slash = strchr (fname, '/');
!        if (slash) {
!            *slash = '\0';
!            fname = slash + 1;
         }
!        ret = cm_lookup (cwd, comp, &file, &tmpce);
         if (ret.res) {
!            arla_warn (ADEBWARN, ret.error, "lookup(%s)", comp);
             return -1;
         }
         error = fcache_get (&entry, file, tmpce);
--- 104,151 ----
  newwalk (VenusFid *startdir, char *fname)
  {
       VenusFid cwd = *startdir;
!      char *base;
       VenusFid file;
       Result ret;
       FCacheEntry *entry;
       int error;
       char symlink[MAXPATHLEN];
+      char store_name[MAXPATHLEN];
  
+      strcpy(store_name,fname);
+      fname = store_name;
       do {
!        /* set things up so that fname points to the remainder of the path,
!         * whereas base points to the whatever preceeds the first /
!         */
!        base = fname;
!        fname = strchr(fname, '/');
!        if (fname) {
!            /* deal with repeated adjacent / chars by eliminating the
!             * duplicates. 
!             */
!            while (*fname == '/') {
!                *fname = '\0';
!                fname++;
!            }
!        }
! 
!        /* deal with absolute pathnames first. */
!        if (*base == '\0') {
!            cwd = rootcwd;
!            if (fname) {
!                if (strncmp("afs",fname,3) == 0) {
!                    fname += 3;
!                }
!                continue;
!            } else {
!                break;
!            }
         }
! 
!        ret = cm_lookup (cwd, base, &file, &tmpce);
         if (ret.res) {
!            arla_warn (ADEBWARN, ret.error, "lookup(%s)", base);
             return -1;
         }
         error = fcache_get (&entry, file, tmpce);
***************
*** 132,137 ****
--- 159,166 ----
             arla_warn (ADEBWARN, error, "fcache_get_data");
             return -1;
         }
+ 
+        /* handle symlinks here */
         if (entry->status.FileType == TYPE_LINK) {
             int len;
             int fd;
***************
*** 142,147 ****
--- 171,177 ----
                 arla_warn (ADEBWARN, errno, "fcache_open_file");
                 return -1;
             }
+            /* read the symlink and null-terminate it */
             len = read (fd, symlink, sizeof(symlink));
             close (fd);
             if (len <= 0) {
***************
*** 150,169 ****
                 return -1;
             }
             symlink[len] = '\0';
!            if (slash != NULL) {
                 strcat (symlink, "/");
                 strcat (symlink, fname);
             }
!            fname = comp = slash = symlink;
!        } else
             cwd = file;
         ReleaseWriteLock (&entry->lock);
!      } while(slash != NULL && *comp);
       *startdir = cwd;
       return 0;
  }
  
- static VenusFid cwd;
  
  static int
  arla_quit (int argc, char **argv)
--- 180,206 ----
                 return -1;
             }
             symlink[len] = '\0';
!            /* if we're not at the end (i.e. slash is not null), take
!               * the expansion of the symlink and append fname to it.
!               */
!            if (fname != NULL) {
                 strcat (symlink, "/");
                 strcat (symlink, fname);
             }
!            strcpy(store_name,symlink);
!            fname = store_name;
!        } else {
!            /* if not a symlink, just update cwd */
             cwd = file;
+        }
         ReleaseWriteLock (&entry->lock);
!        /* the *fname condition below deals with a trailing / in a
!         * path-name */
!      } while (fname != NULL && *fname);
       *startdir = cwd;
       return 0;
  }
  
  
  static int
  arla_quit (int argc, char **argv)
***************
*** 791,799 ****
        tmpce = cred_get (0, getuid(), CRED_ANY);
         
        arla_warnx (ADEBINIT, "Getting root...");
!       error = getroot (&cwd, tmpce);
        if (error)
            arla_err (1, ADEBERROR, error, "getroot");
        arla_warnx(ADEBINIT, "arla loop started");
        sl_loop(cmds, "arla> ");
        store_state ();
--- 828,837 ----
        tmpce = cred_get (0, getuid(), CRED_ANY);
         
        arla_warnx (ADEBINIT, "Getting root...");
!       error = getroot (&rootcwd, tmpce);
        if (error)
            arla_err (1, ADEBERROR, error, "getroot");
+       cwd = rootcwd;
        arla_warnx(ADEBINIT, "arla loop started");
        sl_loop(cmds, "arla> ");
        store_state ();









More information about the Arla-drinkers mailing list