]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afsd: Make mountdir check kernel-specific
authorAndrew Deason <adeason@sinenomine.net>
Thu, 17 Feb 2011 21:47:00 +0000 (15:47 -0600)
committerDerrick Brashear <shadow@dementia.org>
Fri, 18 Feb 2011 06:08:29 +0000 (22:08 -0800)
Checking if the /afs directory exists only makes sense for the kernel
afsd. The libuafs afsd does not care if the mount directory actually
exists on the machine or not, since it may not interact with the mount
directory path on the local machine at all.

So, make the mountdir check code be a new afsd function
(afsd_check_mount), and have it stat() the mount directory only in the
kernels-specific afsd.

Reviewed-on: http://gerrit.openafs.org/3980
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit fd010651194f4c9f1324ea7aa8d84426ce9827e4)

Change-Id: Ib4f4fe3a6072f9aea4683bb1ba531da8d965b156
Reviewed-on: http://gerrit.openafs.org/3983
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/afs/UKERNEL/afsd_uafs.c
src/afsd/afsd.c
src/afsd/afsd.h
src/afsd/afsd_kernel.c

index 06c61df0cf793171090bae49db416d6fdaa4feec..925ea8cc63ddf315175316a0340cbd89e2f9df30 100644 (file)
@@ -42,6 +42,15 @@ afsd_set_afsd_rtpri(void)
     /* noop */
 }
 
+int
+afsd_check_mount(const char *rn, const char *mountdir)
+{
+    /* libuafs could provide a callback of some kind to let the user code
+     * specify a "is this mount point valid?" function, but for now there's
+     * no need for it. */
+    return 0;
+}
+
 int
 afsd_call_syscall(long param1, long param2, long param3, long param4,
                   long param5)
index e611ca941b4b4d2f2a9515350b710f121e2128e9..5421eca26dfde3070ab2773ee25bf1a55faff0cb 100644 (file)
@@ -1923,7 +1923,6 @@ afsd_run(void)
 {
     static char rn[] = "afsd"; /*Name of this routine */
     struct afsconf_dir *cdir;  /* config dir */
-    struct stat statbuf;
     int lookupResult;          /*Result of GetLocalCellName() */
     int i;
     afs_int32 code;            /*Result of fork() */
@@ -1958,14 +1957,8 @@ afsd_run(void)
     }
 
     if (!enable_nomount) {
-       if (stat(afsd_cacheMountDir, &statbuf)) {
-           printf("afsd: Mountpoint %s missing.\n", afsd_cacheMountDir);
-           exit(1);
-       } else {
-           if (!S_ISDIR(statbuf.st_mode)) {
-               printf("afsd: Mountpoint %s is not a directory.\n", afsd_cacheMountDir);
-               exit(1);
-           }
+       if (afsd_check_mount(rn, afsd_cacheMountDir)) {
+           return -1;
        }
     }
 
index bb965a89ee6a85573a73f269f2d7120ef2e9878d..1b66b727757f801f722b1674612a9d33ba1dd9d2 100644 (file)
@@ -27,6 +27,7 @@ typedef void* (*afsd_callback_func) (void *rock);
 
 /* afsd.c expects these to be implemented; it does not implement them itself! */
 void afsd_mount_afs(const char *rn, const char *mountdir);
+int afsd_check_mount(const char *rn, const char *mountdir);
 void afsd_set_rx_rtpri(void);
 void afsd_set_afsd_rtpri(void);
 int afsd_call_syscall();
index cf8661d7dd6f5cc9bb688872976d05ab3e29f581..7502212169455261e25a478b0920a5a5517d7967 100644 (file)
@@ -538,6 +538,21 @@ afsd_daemon(int nochdir, int noclose)
     return daemon(nochdir, noclose);
 }
 
+int
+afsd_check_mount(const char *rn, const char *mountdir)
+{
+    struct stat statbuf;
+
+    if (stat(mountdir, &statbuf)) {
+       printf("%s: Mountpoint %s missing.\n", rn, mountdir);
+       return -1;
+    } else if (!S_ISDIR(statbuf.st_mode)) {
+       printf("%s: Mountpoint %s is not a directory.\n", rn, mountdir);
+       return -1;
+    }
+    return 0;
+}
+
 int
 main(int argc, char **argv)
 {