]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mountd/rmtab.c
Support --ha-callout for high-availability callouts
[nfs-utils.git] / utils / mountd / rmtab.c
index 844de511f48b07d76baac5b0b828b9e5520af33f..90fbef4702eede421b96e0e46ebe35aaf3c8037c 100644 (file)
@@ -19,6 +19,7 @@
 #include "exportfs.h"
 #include "xio.h"
 #include "mountd.h"
+#include "ha-callout.h"
 
 #include <limits.h> /* PATH_MAX */
 
@@ -61,6 +62,8 @@ mountlist_add(char *host, const char *path)
                            host) == 0
                    && strcmp(rep->r_path, path) == 0) {
                        rep->r_count++;
+                       /* PRC: do the HA callout: */
+                       ha_callout("mount", rep->r_client, rep->r_path, rep->r_count);
                        putrmtabent(rep, &pos);
                        endrmtabent();
                        xfunlock(lockid);
@@ -75,6 +78,8 @@ mountlist_add(char *host, const char *path)
        xe.r_path [sizeof (xe.r_path) - 1] = '\0';
        xe.r_count = 1;
        if (setrmtabent("a")) {
+               /* PRC: do the HA callout: */
+               ha_callout("mount", xe.r_client, xe.r_path, xe.r_count);
                putrmtabent(&xe, NULL);
                endrmtabent();
        }
@@ -103,8 +108,11 @@ mountlist_del(char *hname, const char *path)
        while ((rep = getrmtabent(1, NULL)) != NULL) {
                match = !strcmp (rep->r_client, hname)
                        && !strcmp(rep->r_path, path);
-               if (match)
+               if (match) {
                        rep->r_count--;
+                       /* PRC: do the HA callout: */
+                       ha_callout("unmount", rep->r_client, rep->r_path, rep->r_count);
+               }
                if (!match || rep->r_count)
                        fputrmtabent(fp, rep, NULL);
        }