]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Make "fs newcell" work even when there are no pre-existing cells in
authorNickolai Zeldovich <kolya@mit.edu>
Thu, 22 Aug 2002 18:00:15 +0000 (18:00 +0000)
committerNickolai Zeldovich <kolya@mit.edu>
Thu, 22 Aug 2002 18:00:15 +0000 (18:00 +0000)
the kernel yet.  Previously, newcell tried to issue a GetCell pioctl
to figure out what version of the pioctl interface the kernel is
using.  Lacking such information (if the pioctl returns an error),
we now assume the newer interface.

src/venus/fs.c

index 40e874961282ae1b00342afcf175bd6b618dc561..85ef76933c572c66e1b3df1dfb7fec03f786a2d1 100644 (file)
@@ -1917,6 +1917,8 @@ static NewCellCmd(as)
      * MAXCELLHOSTS (8) servers. To determine which we are talking to,
      * do a GETCELL pioctl and pass it a magic number. If an array of
      * 8 comes back, its a 3.5 client. If not, its a 3.4 client.
+     * If we get back EDOM, there are no cells in the kernel yet,
+     * and we'll assume a 3.5 client.
      */
     tp = space;
     lp = (afs_int32 *)tp;
@@ -1927,13 +1929,17 @@ static NewCellCmd(as)
     blob.in       = space;
     blob.out      = space;
     code = pioctl(0, VIOCGETCELL, &blob, 1);
-    if (code < 0) {
+    if (code < 0 && errno != EDOM) {
        Die(errno, 0);
        return 1;
     }
-    tp = space;
-    cellname = tp + MAXCELLHOSTS*sizeof(afs_int32);
-    scount = ((cellname[0] != '\0') ? MAXCELLHOSTS : MAXHOSTS);
+    if (code < 1 && errno == EDOM) {
+       scount = MAXHOSTS;
+    } else {
+       tp = space;
+       cellname = tp + MAXCELLHOSTS*sizeof(afs_int32);
+       scount = ((cellname[0] != '\0') ? MAXCELLHOSTS : MAXHOSTS);
+    }
 
     /* Now setup and do the NEWCELL pioctl call */
     memset(space, 0, (scount+1) * sizeof(afs_int32));