hush another afsd warning
[openafs.git] / src / afsd / afsd.c
index 60372ad..0be921e 100644 (file)
@@ -353,6 +353,9 @@ struct afs_cacheParams cparams;     /* params passed to cache manager */
 static int HandleMTab(void);
 int PartSizeOverflow(char *path, int cs);
 
+/* for now, not prototyped fully as it can't be */
+int call_syscall();
+
 #ifdef AFS_DARWIN_ENV
 static void
 afsd_sleep_callback(void * refCon, io_service_t service, 
@@ -1539,9 +1542,7 @@ mainproc(struct cmd_syndesc *as, void *arock)
     static char rn[] = "afsd"; /*Name of this routine */
     afs_int32 code;            /*Result of fork() */
     int i;
-#ifndef AFS_CACHE_VNODE_PATH
     int currVFile;             /*Current AFS cache file number passed in */
-#endif
     int mountFlags;            /*Flags passed to mount() */
     int lookupResult;          /*Result of GetLocalCellName() */
     int cacheIteration;                /*How many times through cache verification */
@@ -2163,23 +2164,6 @@ mainproc(struct cmd_syndesc *as, void *arock)
                     rn, vFilesFound, cacheFiles, cacheIteration);
        } while ((vFilesFound < cacheFiles)
                 && (cacheIteration < MAX_CACHE_LOOPS));
-#ifdef AFS_CACHE_VNODE_PATH
-       if (afsd_debug)
-           printf
-               ("%s: Calling AFSOP_CACHEBASEDIR with '%s'\n",
-                rn, cacheBaseDir);
-       call_syscall(AFSOP_CACHEBASEDIR, cacheBaseDir);
-       if (afsd_debug)
-           printf
-               ("%s: Calling AFSOP_CACHEDIRS with %d dirs\n",
-                rn, nFilesPerDir);
-       call_syscall(AFSOP_CACHEDIRS, nFilesPerDir);
-       if (afsd_debug)
-           printf
-               ("%s: Calling AFSOP_CACHEFILES with %d files\n",
-                rn, cacheFiles);
-       call_syscall(AFSOP_CACHEFILES, cacheFiles);
-#endif
     } else if (afsd_verbose)
        printf("%s: Using memory cache, not swept\n", rn);
 
@@ -2322,32 +2306,53 @@ mainproc(struct cmd_syndesc *as, void *arock)
     if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
        call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile);
 
-#ifndef AFS_CACHE_VNODE_PATH
     /*
      * Give the kernel the names of the AFS files cached on the workstation's
      * disk.
      */
     if (afsd_debug)
        printf
-           ("%s: Calling AFSOP_CACHEINODE for each of the %d files in '%s'\n",
+           ("%s: Calling AFSOP_CACHEFILE for each of the %d files in '%s'\n",
             rn, cacheFiles, cacheBaseDir);
-    if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) /* ... and again ... */
+    if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
+       /* ... and again ... */
+       int nocachefile = 0;
        for (currVFile = 0; currVFile < cacheFiles; currVFile++) {
+           if (!nocachefile) {
+               sprintf(fullpn_VFile, "%s/D%d/V%d", cacheBaseDir, dir_for_V[currVFile], currVFile);
+               code = call_syscall(AFSOP_CACHEFILE, fullpn_VFile);
+               if (code) {
+                   if (currVFile == 0) {
+                       if (afsd_debug)
+                           printf
+                               ("%s: Calling AFSOP_CACHEINODE for each of the %d files in '%s'\n",
+                                rn, cacheFiles, cacheBaseDir);
+                       nocachefile = 1;
+                   } else {
+                       printf
+                           ("%s: Error calling AFSOP_CACHEFILE for '%s'\n",
+                            rn, fullpn_VFile);
+                       exit(1);
+                   }
+               } else {
+                   continue;
+               }
+               /* fall through to setup-by-inode */
+           }
 #ifdef AFS_SGI62_ENV
            call_syscall(AFSOP_CACHEINODE,
                         (afs_uint32) (inode_for_V[currVFile] >> 32),
                         (afs_uint32) (inode_for_V[currVFile] & 0xffffffff));
-#else
-#if defined(LINUX_USE_FH)
-           sprintf(fullpn_VFile, "%s/D%d/V%d", cacheBaseDir, dir_for_V[currVFile], currVFile);
-           call_syscall(AFSOP_CACHEFILE, fullpn_VFile);
-#else
+#elif !(defined(LINUX_USE_FH) || defined(AFS_CACHE_VNODE_PATH))
            call_syscall(AFSOP_CACHEINODE, inode_for_V[currVFile]);
-#endif
+#else
+           printf
+               ("%s: Error calling AFSOP_CACHEINODE: not configured\n",
+                rn);
+           exit(1);
 #endif
        }
-#endif
-
+    }
     /*end for */
     /*
      * All the necessary info has been passed into the kernel to run an AFS