[libmultipath] drop the path cache
authorChristophe Varoqui <root@xa-s05.(none)>
Tue, 29 Nov 2005 10:05:08 +0000 (11:05 +0100)
committerChristophe Varoqui <root@xa-s05.(none)>
Tue, 29 Nov 2005 10:05:08 +0000 (11:05 +0100)
- remove the cache library files
- remove the cache loading in multipath
- remove the "dump pathvec" facility in multipathd
- remove a small cache assertion in the discovery

libmultipath/Makefile
libmultipath/cache.c [deleted file]
libmultipath/cache.h [deleted file]
libmultipath/discovery.c
multipath/main.c
multipathd/cli.c
multipathd/cli.h
multipathd/cli_handlers.c
multipathd/cli_handlers.h
multipathd/main.c
multipathd/main.h

index 41f7ee1..b9b04ba 100644 (file)
@@ -8,7 +8,7 @@ include ../Makefile.inc
 
 OBJS = memory.o parser.o vector.o devmapper.o callout.o \
        hwtable.o blacklist.o util.o dmparser.o config.o \
-       structs.o cache.o discovery.o propsel.o dict.o \
+       structs.o discovery.o propsel.o dict.o \
        pgpolicies.o debug.o regex.o defaults.o uevent.o \
        switchgroup.o uxsock.o print.o alias.o log_pthread.o \
        log.o configure.o structs_vec.o
diff --git a/libmultipath/cache.c b/libmultipath/cache.c
deleted file mode 100644 (file)
index a90b617..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2005 Christophe Varoqui
- * Copyright (c) 2005 Stephan Bader, IBM
- */
-#include <unistd.h>
-
-#include "memory.h"
-#include "vector.h"
-#include "structs.h"
-#include "debug.h"
-#include "cache.h"
-#include "uxsock.h"
-#include "defaults.h"
-
-static void
-revoke_cache_info(struct path * pp)
-{
-       pp->checker_context = NULL;
-       pp->fd = -1;
-       pp->mpp = NULL;
-       pp->getuid = NULL;
-       pp->getprio = NULL;
-       pp->checkfn = NULL;
-       pp->getprio_selected = 0;
-}
-
-int
-cache_load (vector pathvec)
-{
-       char *reply;
-       size_t len;
-       int fd;
-       struct path * pp;
-       int r = 1;
-       char * p;
-
-        fd = ux_socket_connect(DEFAULT_SOCKET);
-
-       if (fd == -1) {
-               condlog(3, "ux_socket_connect error");
-               return 1;
-       }
-
-       send_packet(fd, "dump pathvec", 13);
-       recv_packet(fd, &reply, &len);
-
-       for (p = reply; p < (reply + len); p += sizeof(struct path)) {
-               pp = alloc_path();
-
-               if (!pp)
-                       goto out;
-
-               if (!vector_alloc_slot(pathvec)) {
-                       free_path(pp);
-                       goto out;
-               }
-               vector_set_slot(pathvec, pp);
-               memcpy(pp, (void *)p, sizeof(struct path));
-               revoke_cache_info(pp);
-       }
-
-       r = 0;
-out:
-       FREE(reply);
-       close(fd);
-       return r;
-}
diff --git a/libmultipath/cache.h b/libmultipath/cache.h
deleted file mode 100644 (file)
index 737a50a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-int cache_load (vector pathvec);
index 2d8d304..0223910 100644 (file)
@@ -681,15 +681,11 @@ pathinfo (struct path *pp, vector hwtable, int mask)
                }
                condlog(3, "uid = %s (callout)", pp->wwid);
        }
-       else if (strlen(pp->wwid))
-               condlog(3, "uid = %s (cache)", pp->wwid);
-
        return 0;
 
 out:
        /*
         * Recoverable error, for example faulty or offline path
-        * Set up safe defaults, don't trust the cache
         */
        memset(pp->wwid, 0, WWID_SIZE);
        pp->state = PATH_DOWN;
index e5a0a4a..77883ac 100644 (file)
@@ -38,7 +38,6 @@
 #include <structs.h>
 #include <structs_vec.h>
 #include <dmparser.h>
-#include <cache.h>
 #include <config.h>
 #include <discovery.h>
 #include <debug.h>
@@ -236,12 +235,6 @@ configure (void)
        if (dev && blacklist(conf->blist, dev))
                goto out;
        
-       condlog(3, "load path identifiers cache");
-       cache_load(pathvec);
-
-       if (conf->verbosity > 2)
-               print_all_paths(pathvec, 1);
-
        /*
         * scope limiting must be translated into a wwid
         * failing the translation is fatal (by policy)
index 76e4dbb..d680349 100644 (file)
@@ -133,8 +133,6 @@ load_keys (void)
        r += add_key(keys, "path", PATH, 1);
        r += add_key(keys, "map", MAP, 1);
        r += add_key(keys, "group", GROUP, 1);
-       r += add_key(keys, "dump", DUMP, 0);
-       r += add_key(keys, "pathvec", PATHVEC, 0);
        r += add_key(keys, "reconfigure", RECONFIGURE, 0);
        r += add_key(keys, "stats", STATS, 0);
 
index 3ae53aa..659d1ea 100644 (file)
@@ -12,8 +12,6 @@ enum {
        __PATH,
        __MAP,
        __GROUP,
-       __DUMP,
-       __PATHVEC,
        __RECONFIGURE,
        __STATS,
 };
@@ -31,8 +29,6 @@ enum {
 #define PATH           (1 << __PATH)
 #define MAP            (1 << __MAP)
 #define GROUP          (1 << __GROUP)
-#define DUMP           (1 << __DUMP)
-#define PATHVEC                (1 << __PATHVEC)
 #define RECONFIGURE    (1 << __RECONFIGURE)
 #define STATS          (1 << __STATS)
 
index 39e7207..0fb1cfb 100644 (file)
@@ -108,16 +108,6 @@ cli_switch_group(void * v, char ** reply, int * len, void * data)
 }
 
 int
-cli_dump_pathvec(void * v, char ** reply, int * len, void * data)
-{
-       struct vectors * vecs = (struct vectors *)data;
-                       
-       condlog(2, "dump pathvec (operator)");
-
-       return dump_pathvec(reply, len, vecs);
-}
-
-int
 cli_reconfigure(void * v, char ** reply, int * len, void * data)
 {
        struct vectors * vecs = (struct vectors *)data;
index e76e68e..fbfbeda 100644 (file)
@@ -6,7 +6,6 @@ int cli_del_path (void * v, char ** reply, int * len, void * data);
 int cli_add_map (void * v, char ** reply, int * len, void * data);
 int cli_del_map (void * v, char ** reply, int * len, void * data);
 int cli_switch_group(void * v, char ** reply, int * len, void * data);
-int cli_dump_pathvec(void * v, char ** reply, int * len, void * data);
 int cli_reconfigure(void * v, char ** reply, int * len, void * data);
 int cli_suspend(void * v, char ** reply, int * len, void * data);
 int cli_resume(void * v, char ** reply, int * len, void * data);
index e3af6d1..48fae6a 100644 (file)
@@ -934,32 +934,6 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style)
        return 0;
 }
 
-int
-dump_pathvec (char ** r, int * len, struct vectors * vecs)
-{
-       int i;
-       struct path * pp;
-       char * reply;
-       char * p;
-
-       *len = VECTOR_SIZE(vecs->pathvec) * sizeof(struct path);
-       reply = (char *)MALLOC(*len);
-       *r = reply;
-
-       if (!reply)
-               return 1;
-
-       p = reply;
-
-       vector_foreach_slot (vecs->pathvec, pp, i) {
-               memcpy((void *)p, pp, sizeof(struct path));
-               p += sizeof(struct path);
-       }
-
-       /* return negative to hint caller not to add "ok" to the dump */
-       return -1;
-}
-
 static int
 map_discovery (struct vectors * vecs)
 {
@@ -1103,7 +1077,6 @@ uxlsnrloop (void * ap)
        add_handler(ADD+MAP, cli_add_map);
        add_handler(DEL+MAP, cli_del_map);
        add_handler(SWITCH+MAP+GROUP, cli_switch_group);
-       add_handler(DUMP+PATHVEC, cli_dump_pathvec);
        add_handler(RECONFIGURE, cli_reconfigure);
        add_handler(SUSPEND+MAP, cli_suspend);
        add_handler(RESUME+MAP, cli_resume);
index aa82bdc..c9a4886 100644 (file)
@@ -9,7 +9,6 @@
 int reconfigure (struct vectors *);
 int show_paths (char **, int *, struct vectors *, char *);
 int show_maps (char **, int *, struct vectors *, char *);
-int dump_pathvec (char **, int *, struct vectors *);
 int ev_add_path (char *, struct vectors *);
 int ev_remove_path (char *, struct vectors *);
 int ev_add_map (char *, struct vectors *);