]> 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>
Wed, 28 Aug 2002 04:53:33 +0000 (04:53 +0000)
committerGarry Zacheiss <zacheiss@mit.edu>
Wed, 28 Aug 2002 04:53:33 +0000 (04:53 +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.

(cherry picked from commit f840143cd6b672858e121a0fb3dea5e12cb60f84)

src/venus/fs.c

index dbc27cd98283ca4c8d6ebe5a9e08a9f204a032fc..ac7156faee16d9510c05486e2df4b65bc8cd42ac 100644 (file)
@@ -1909,6 +1909,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;
@@ -1919,13 +1921,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));