|
|
c896fb |
---
|
|
|
c896fb |
multipathd/cli.c | 22 +++++++++++-----------
|
|
|
c896fb |
multipathd/cli.h | 20 +++++++++++---------
|
|
|
c896fb |
2 files changed, 22 insertions(+), 20 deletions(-)
|
|
|
c896fb |
|
|
|
c896fb |
Index: multipath-tools-130222/multipathd/cli.c
|
|
|
c896fb |
===================================================================
|
|
|
c896fb |
--- multipath-tools-130222.orig/multipathd/cli.c
|
|
|
c896fb |
+++ multipath-tools-130222/multipathd/cli.c
|
|
|
c896fb |
@@ -26,7 +26,7 @@ alloc_handler (void)
|
|
|
c896fb |
}
|
|
|
c896fb |
|
|
|
c896fb |
static int
|
|
|
c896fb |
-add_key (vector vec, char * str, unsigned long code, int has_param)
|
|
|
c896fb |
+add_key (vector vec, char * str, uint64_t code, int has_param)
|
|
|
c896fb |
{
|
|
|
c896fb |
struct key * kw;
|
|
|
c896fb |
|
|
|
c896fb |
@@ -57,7 +57,7 @@ out:
|
|
|
c896fb |
}
|
|
|
c896fb |
|
|
|
c896fb |
int
|
|
|
c896fb |
-add_handler (unsigned long fp, int (*fn)(void *, char **, int *, void *))
|
|
|
c896fb |
+add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *))
|
|
|
c896fb |
{
|
|
|
c896fb |
struct handler * h;
|
|
|
c896fb |
|
|
|
c896fb |
@@ -79,7 +79,7 @@ add_handler (unsigned long fp, int (*fn)
|
|
|
c896fb |
}
|
|
|
c896fb |
|
|
|
c896fb |
static struct handler *
|
|
|
c896fb |
-find_handler (unsigned long fp)
|
|
|
c896fb |
+find_handler (uint64_t fp)
|
|
|
c896fb |
{
|
|
|
c896fb |
int i;
|
|
|
c896fb |
struct handler *h;
|
|
|
c896fb |
@@ -92,7 +92,7 @@ find_handler (unsigned long fp)
|
|
|
c896fb |
}
|
|
|
c896fb |
|
|
|
c896fb |
int
|
|
|
c896fb |
-set_handler_callback (unsigned long fp, int (*fn)(void *, char **, int *, void *))
|
|
|
c896fb |
+set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *))
|
|
|
c896fb |
{
|
|
|
c896fb |
struct handler * h = find_handler(fp);
|
|
|
c896fb |
|
|
|
c896fb |
@@ -293,11 +293,11 @@ out:
|
|
|
c896fb |
return r;
|
|
|
c896fb |
}
|
|
|
c896fb |
|
|
|
c896fb |
-static unsigned long
|
|
|
c896fb |
+static uint64_t
|
|
|
c896fb |
fingerprint(vector vec)
|
|
|
c896fb |
{
|
|
|
c896fb |
int i;
|
|
|
c896fb |
- unsigned long fp = 0;
|
|
|
c896fb |
+ uint64_t fp = 0;
|
|
|
c896fb |
struct key * kw;
|
|
|
c896fb |
|
|
|
c896fb |
if (!vec)
|
|
|
c896fb |
@@ -343,7 +343,7 @@ static int
|
|
|
c896fb |
do_genhelp(char *reply, int maxlen) {
|
|
|
c896fb |
int len = 0;
|
|
|
c896fb |
int i, j;
|
|
|
c896fb |
- unsigned long fp;
|
|
|
c896fb |
+ uint64_t fp;
|
|
|
c896fb |
struct handler * h;
|
|
|
c896fb |
struct key * kw;
|
|
|
c896fb |
|
|
|
c896fb |
@@ -442,7 +442,7 @@ parse_cmd (char * cmd, char ** reply, in
|
|
|
c896fb |
}
|
|
|
c896fb |
|
|
|
c896fb |
char *
|
|
|
c896fb |
-get_keyparam (vector v, unsigned long code)
|
|
|
c896fb |
+get_keyparam (vector v, uint64_t code)
|
|
|
c896fb |
{
|
|
|
c896fb |
struct key * kw;
|
|
|
c896fb |
int i;
|
|
|
c896fb |
@@ -515,7 +515,7 @@ void cli_exit(void)
|
|
|
c896fb |
}
|
|
|
c896fb |
|
|
|
c896fb |
static int
|
|
|
c896fb |
-key_match_fingerprint (struct key * kw, unsigned long fp)
|
|
|
c896fb |
+key_match_fingerprint (struct key * kw, uint64_t fp)
|
|
|
c896fb |
{
|
|
|
c896fb |
if (!fp)
|
|
|
c896fb |
return 0;
|
|
|
c896fb |
@@ -530,7 +530,7 @@ char *
|
|
|
c896fb |
key_generator (const char * str, int state)
|
|
|
c896fb |
{
|
|
|
c896fb |
static int index, len, has_param;
|
|
|
c896fb |
- static unsigned long rlfp;
|
|
|
c896fb |
+ static uint64_t rlfp;
|
|
|
c896fb |
struct key * kw;
|
|
|
c896fb |
int i;
|
|
|
c896fb |
struct handler *h;
|
|
|
c896fb |
@@ -600,7 +600,7 @@ key_generator (const char * str, int sta
|
|
|
c896fb |
* nfp is the candidate fingerprint we try to
|
|
|
c896fb |
* validate against all known command fingerprints.
|
|
|
c896fb |
*/
|
|
|
c896fb |
- unsigned long nfp = rlfp | kw->code;
|
|
|
c896fb |
+ uint64_t nfp = rlfp | kw->code;
|
|
|
c896fb |
vector_foreach_slot(handlers, h, i) {
|
|
|
c896fb |
if (!rlfp || ((h->fingerprint & nfp) == nfp)) {
|
|
|
c896fb |
/*
|
|
|
c896fb |
Index: multipath-tools-130222/multipathd/cli.h
|
|
|
c896fb |
===================================================================
|
|
|
c896fb |
--- multipath-tools-130222.orig/multipathd/cli.h
|
|
|
c896fb |
+++ multipath-tools-130222/multipathd/cli.h
|
|
|
c896fb |
@@ -1,3 +1,5 @@
|
|
|
c896fb |
+#include <stdint.h>
|
|
|
c896fb |
+
|
|
|
c896fb |
enum {
|
|
|
c896fb |
__LIST,
|
|
|
c896fb |
__ADD,
|
|
|
c896fb |
@@ -68,10 +70,10 @@ enum {
|
|
|
c896fb |
#define WILDCARDS (1 << __WILDCARDS)
|
|
|
c896fb |
#define QUIT (1 << __QUIT)
|
|
|
c896fb |
#define SHUTDOWN (1 << __SHUTDOWN)
|
|
|
c896fb |
-#define GETPRSTATUS (1UL << __GETPRSTATUS)
|
|
|
c896fb |
-#define SETPRSTATUS (1UL << __SETPRSTATUS)
|
|
|
c896fb |
-#define UNSETPRSTATUS (1UL << __UNSETPRSTATUS)
|
|
|
c896fb |
-#define FMT (1UL << __FMT)
|
|
|
c896fb |
+#define GETPRSTATUS (1ULL << __GETPRSTATUS)
|
|
|
c896fb |
+#define SETPRSTATUS (1ULL << __SETPRSTATUS)
|
|
|
c896fb |
+#define UNSETPRSTATUS (1ULL << __UNSETPRSTATUS)
|
|
|
c896fb |
+#define FMT (1ULL << __FMT)
|
|
|
c896fb |
|
|
|
c896fb |
#define INITIAL_REPLY_LEN 1200
|
|
|
c896fb |
|
|
|
c896fb |
@@ -92,21 +94,21 @@ enum {
|
|
|
c896fb |
struct key {
|
|
|
c896fb |
char * str;
|
|
|
c896fb |
char * param;
|
|
|
c896fb |
- unsigned long code;
|
|
|
c896fb |
+ uint64_t code;
|
|
|
c896fb |
int has_param;
|
|
|
c896fb |
};
|
|
|
c896fb |
|
|
|
c896fb |
struct handler {
|
|
|
c896fb |
- unsigned long fingerprint;
|
|
|
c896fb |
+ uint64_t fingerprint;
|
|
|
c896fb |
int (*fn)(void *, char **, int *, void *);
|
|
|
c896fb |
};
|
|
|
c896fb |
|
|
|
c896fb |
int alloc_handlers (void);
|
|
|
c896fb |
-int add_handler (unsigned long fp, int (*fn)(void *, char **, int *, void *));
|
|
|
c896fb |
-int set_handler_callback (unsigned long fp, int (*fn)(void *, char **, int *, void *));
|
|
|
c896fb |
+int add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *));
|
|
|
c896fb |
+int set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *));
|
|
|
c896fb |
int parse_cmd (char * cmd, char ** reply, int * len, void *);
|
|
|
c896fb |
int load_keys (void);
|
|
|
c896fb |
-char * get_keyparam (vector v, unsigned long code);
|
|
|
c896fb |
+char * get_keyparam (vector v, uint64_t code);
|
|
|
c896fb |
void free_keys (vector vec);
|
|
|
c896fb |
void free_handlers (void);
|
|
|
c896fb |
int cli_init (void);
|