It looked like include/corosync/engine/quorum.h
would be easy to make const/type-correct.
Just change a typedef.

old:

  typedef void (*quorum_set_quorate_fn_t) (unsigned int *view_list,
                                           int view_list_entries,
                                           int quorate, struct memb_ring_id *);

new: (add "const" to first param, change type of 2nd from int to size_t)

  typedef void (*quorum_set_quorate_fn_t) (const unsigned int *view_list,
                                           size_t view_list_entries,
                                           int quorate, struct memb_ring_id *);

Well, this thread was attached to more than its share of others,
so the patch is not as small as you'd expect:


>From a700ceda3be84882aee38bf8022ab5e07ff4d5c3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 6 Apr 2009 13:48:22 +0200
Subject: [PATCH 1/2] quorum.h (quorum_set_quorate_fn_t): s/int/size_t/

propagate the change:
* include/corosync/engine/quorum.h (quorum_set_quorate_fn_t):
* exec/vsf_quorum.c (quorum_view_list_entries):
(quorum_api_set_quorum, quorum_exec_init_fn):
* exec/vsf_ykd.c (ykd_primary_callback_fn):
---
 exec/vsf_quorum.c                |    9 ++++-----
 exec/vsf_ykd.c                   |    2 +-
 include/corosync/engine/quorum.h |    5 +++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c
index 1c959b4..14e7e1e 100644
--- a/exec/vsf_quorum.c
+++ b/exec/vsf_quorum.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Red Hat, Inc.
+ * Copyright (c) 2008, 2009 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -95,7 +95,7 @@ static struct corosync_api_v1 *corosync_api;
 static struct list_head lib_trackers_list;
 static struct list_head internal_trackers_list;
 static struct memb_ring_id quorum_ring_id;
-static int quorum_view_list_entries = 0;
+static size_t quorum_view_list_entries = 0;
 static int quorum_view_list[PROCESSOR_COUNT_MAX];
 struct quorum_services_api_ver1 *quorum_iface = NULL;

@@ -107,7 +107,7 @@ static void (*sync_primary_callback_fn) (

 /* Internal quorum API function */
 static void quorum_api_set_quorum(unsigned int *view_list,
-                                 int view_list_entries,
+                                 size_t view_list_entries,
                                  int quorum, struct memb_ring_id *ring_id)
 {
        primary_designated = quorum;
@@ -308,7 +308,7 @@ static int quorum_exec_init_fn (struct corosync_api_v1 *api)
        }
        if (!quorum_iface) {
                /*
-                 * With no quorum provider, we are always quorate 
+                 * With no quorum provider, we are always quorate
                  */
                primary_designated = 1;
        }
@@ -468,4 +468,3 @@ static void message_handler_req_lib_quorum_trackstop (void 
*conn, void *msg)
        res.error = CS_OK;
        corosync_api->ipc_response_send(conn, &res, sizeof(mar_res_header_t));
 }
-
diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c
index eff9d02..521fedd 100644
--- a/exec/vsf_ykd.c
+++ b/exec/vsf_ykd.c
@@ -146,7 +146,7 @@ static struct corosync_api_v1 *api;

 static void (*ykd_primary_callback_fn) (
        unsigned int *view_list,
-       int view_list_entries,
+       size_t view_list_entries,
        int primary_designated,
        struct memb_ring_id *ring_id) = NULL;

diff --git a/include/corosync/engine/quorum.h b/include/corosync/engine/quorum.h
index 9bd9780..cca3e23 100644
--- a/include/corosync/engine/quorum.h
+++ b/include/corosync/engine/quorum.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Red Hat, Inc.
+ * Copyright (c) 2008, 2009 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -35,7 +35,8 @@
 #ifndef QUORUM_H_DEFINED
 #define QUORUM_H_DEFINED

-typedef void (*quorum_set_quorate_fn_t) (unsigned int *view_list, int 
view_list_entries,
+typedef void (*quorum_set_quorate_fn_t) (unsigned int *view_list,
+                                        size_t view_list_entries,
                                         int quorate, struct memb_ring_id *);

 struct quorum_services_api_ver1 {
-- 
1.6.2.rc1.285.gc5f54


>From d74dd4da5c7da4baf79d7b0ec81752bc81e06a17 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 6 Apr 2009 14:14:47 +0200
Subject: [PATCH 2/2] quorum.h (quorum_set_quorate_fn_t): make first param const

* exec/quorum.h (sync_callback_fn_t):
* exec/sync.c (current_members_cnt, sync_primary_callback_fn):
* exec/sync.h (name):
* exec/vsf_quorum.c (sync_primary_callback_fn):
(quorum_api_set_quorum):
* exec/vsf_ykd.c (ykd_primary_callback_fn):
* include/corosync/engine/coroapi.h (sync_callback_fn_t):
* include/corosync/engine/quorum.h (quorum_set_quorate_fn_t):
---
 exec/quorum.h                     |    6 +++---
 exec/sync.c                       |    6 +++---
 exec/sync.h                       |    8 ++++----
 exec/vsf_quorum.c                 |    6 +++---
 exec/vsf_ykd.c                    |    2 +-
 include/corosync/engine/coroapi.h |    4 ++--
 include/corosync/engine/quorum.h  |    2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/exec/quorum.h b/exec/quorum.h
index a59df04..5e61dbd 100644
--- a/exec/quorum.h
+++ b/exec/quorum.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Red Hat, Inc.
+ * Copyright (c) 2008, 2009 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -40,8 +40,8 @@ struct memb_ring_id;
 typedef void (*quorum_callback_fn_t) (int quorate, void *context);

 typedef void (*sync_callback_fn_t) (
-       unsigned int *view_list,
-       int view_list_entries,
+       const unsigned int *view_list,
+       size_t view_list_entries,
        int primary_designated,
        struct memb_ring_id *ring_id);

diff --git a/exec/sync.c b/exec/sync.c
index 8a9dd9a..bbcca52 100644
--- a/exec/sync.c
+++ b/exec/sync.c
@@ -124,7 +124,7 @@ static struct totempg_group sync_group = {
 static hdb_handle_t sync_group_handle;
 static char *service_name;
 static unsigned int current_members[PROCESSOR_COUNT_MAX];
-static unsigned int current_members_cnt;
+static size_t current_members_cnt;

 struct req_exec_sync_barrier_start {
        mar_req_header_t header;
@@ -290,8 +290,8 @@ int sync_register (
 }

 void sync_primary_callback_fn (
-       unsigned int *view_list,
-       int view_list_entries,
+       const unsigned int *view_list,
+       size_t view_list_entries,
        int primary_designated,
        struct memb_ring_id *ring_id)
 {
diff --git a/exec/sync.h b/exec/sync.h
index b821990..4ef60a4 100644
--- a/exec/sync.h
+++ b/exec/sync.h
@@ -6,7 +6,7 @@
  * Author: Steven Dake ([email protected])
  *
  * This software licensed under BSD license, the text of which follows:
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  *
@@ -59,14 +59,14 @@ int sync_primary_designated (void);
 /**
  * Execute synchronization upon request for the named service
  * @param name service handler name to synchronize
- * 
+ *
  * @return int 0 OK, error code otherwise
  */
 extern int sync_request (char *name);

 extern void sync_primary_callback_fn (
-       unsigned int *view_list,
-       int view_list_entries,
+       const unsigned int *view_list,
+       size_t view_list_entries,
        int primary_designated,
        struct memb_ring_id *ring_id);

diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c
index 14e7e1e..a283f88 100644
--- a/exec/vsf_quorum.c
+++ b/exec/vsf_quorum.c
@@ -100,13 +100,13 @@ static int quorum_view_list[PROCESSOR_COUNT_MAX];
 struct quorum_services_api_ver1 *quorum_iface = NULL;

 static void (*sync_primary_callback_fn) (
-       unsigned int *view_list,
-       int view_list_entries,
+       const unsigned int *view_list,
+       size_t view_list_entries,
        int primary_designated,
        struct memb_ring_id *ring_id);

 /* Internal quorum API function */
-static void quorum_api_set_quorum(unsigned int *view_list,
+static void quorum_api_set_quorum(const unsigned int *view_list,
                                  size_t view_list_entries,
                                  int quorum, struct memb_ring_id *ring_id)
 {
diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c
index 521fedd..f4b3ebc 100644
--- a/exec/vsf_ykd.c
+++ b/exec/vsf_ykd.c
@@ -145,7 +145,7 @@ static void *ykd_state_send_callback_token_handle = 0;
 static struct corosync_api_v1 *api;

 static void (*ykd_primary_callback_fn) (
-       unsigned int *view_list,
+       const unsigned int *view_list,
        size_t view_list_entries,
        int primary_designated,
        struct memb_ring_id *ring_id) = NULL;
diff --git a/include/corosync/engine/coroapi.h 
b/include/corosync/engine/coroapi.h
index 723d81f..224185b 100644
--- a/include/corosync/engine/coroapi.h
+++ b/include/corosync/engine/coroapi.h
@@ -209,8 +209,8 @@ struct quorum_callin_functions
 };

 typedef void (*sync_callback_fn_t) (
-       unsigned int *view_list,
-       int view_list_entries,
+       const unsigned int *view_list,
+       size_t view_list_entries,
        int primary_designated,
        struct memb_ring_id *ring_id);

diff --git a/include/corosync/engine/quorum.h b/include/corosync/engine/quorum.h
index cca3e23..4bd28d6 100644
--- a/include/corosync/engine/quorum.h
+++ b/include/corosync/engine/quorum.h
@@ -35,7 +35,7 @@
 #ifndef QUORUM_H_DEFINED
 #define QUORUM_H_DEFINED

-typedef void (*quorum_set_quorate_fn_t) (unsigned int *view_list,
+typedef void (*quorum_set_quorate_fn_t) (const unsigned int *view_list,
                                         size_t view_list_entries,
                                         int quorate, struct memb_ring_id *);

-- 
1.6.2.rc1.285.gc5f54
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to