Re: A little patch to clean up multiple declarations of the cli_ipcname functions
John Hughes <[email protected]> Wed, 13 Jan 2010 16:14:00 +0100
| Newsgroups | gmane.linux.cluster.ssic.devel |
|---|---|
| Message-ID | <[email protected]> |
Ok, I've finished my patch to clean up the ipc directory, getting rid of multiple dodgy "extern" declarations. Found a couple of bugs in the process (missing cprid argument from ssi_shm_get_shmid_kernel, wrong type (int instead of u_long) for second argument to cli_ipcname_findid). I'll commit this to CVS later if no-one has any objections. (The comment "Avoid priblems woth shmids_ds" shows why I'm not going to put it in CVS at the moment. :-)) ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ ssic-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ssic-linux-devel
ipc-includes.patch
(text/x-patch, 11.6 KB)
Index: cluster/ssi/ipc/ipcmsg_svr.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/cluster/ssi/ipc/Attic/ipcmsg_svr.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.2.2.2
diff -u -p -r1.1.2.2 -r1.1.2.2.2.2
--- cluster/ssi/ipc/ipcmsg_svr.c 29 Dec 2009 19:28:48 -0000 1.1.2.2
+++ cluster/ssi/ipc/ipcmsg_svr.c 13 Jan 2010 12:39:54 -0000 1.1.2.2.2.2
@@ -36,6 +36,7 @@
#include <cluster/ssisys.h>
#include <cluster/ssi/namesvr.h>
#include <cluster/ssi/rcopy.h>
+#include <cluster/ssi/ipc/msg.h>
#include "ipc.h"
#include <cluster/gen/ics_ipc_macros_gen.h>
Index: cluster/ssi/ipc/ipcsem_svr.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/cluster/ssi/ipc/Attic/ipcsem_svr.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.2.2.2
diff -u -p -r1.1.2.2 -r1.1.2.2.2.2
--- cluster/ssi/ipc/ipcsem_svr.c 29 Dec 2009 19:28:49 -0000 1.1.2.2
+++ cluster/ssi/ipc/ipcsem_svr.c 13 Jan 2010 12:39:54 -0000 1.1.2.2.2.2
@@ -35,6 +35,7 @@
#include <cluster/ssisys.h>
#include <cluster/ssi/namesvr.h>
#include <cluster/ssi/rcopy.h>
+#include <cluster/ssi/ipc/sem.h>
#include "ipc.h"
#include <linux/sem.h>
#include <linux/msg.h>
Index: cluster/ssi/ipc/ipcshm_svr.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/cluster/ssi/ipc/Attic/ipcshm_svr.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.3.2.1
diff -u -p -r1.1.2.3 -r1.1.2.3.2.1
--- cluster/ssi/ipc/ipcshm_svr.c 29 Dec 2009 19:28:49 -0000 1.1.2.3
+++ cluster/ssi/ipc/ipcshm_svr.c 13 Jan 2010 12:57:12 -0000 1.1.2.3.2.1
@@ -98,16 +98,16 @@ done:
return 0;
}
-int ssi_shm_get_shmid_kernel(clusternode_t node_num, int shmid, char **shmidk, int *segsize)
+int ssi_shm_get_shmid_kernel(clusternode_t node_num, int shmid, char **shmidk, int *segsize, int *cprid)
{
ssi_procstate_t pstate;
int status = 0;
- int rval, len=0, cprid=0;
+ int rval, len=0;
ssi_procstate_get(&pstate);
len = sizeof(struct shmid_kernel);
- status = RIPC_SHM_GET_SHMID_KERNEL(node_num, &rval, shmid, &pstate, shmidk, &len, segsize, &cprid);
+ status = RIPC_SHM_GET_SHMID_KERNEL(node_num, &rval, shmid, &pstate, shmidk, &len, segsize, cprid);
if (!status)
status = rval;
Index: include/cluster/ssi/namesvr.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/cluster/ssi/Attic/namesvr.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.1.2.2
diff -u -p -r1.1.2.1 -r1.1.2.1.2.2
--- include/cluster/ssi/namesvr.h 20 Jan 2009 16:21:23 -0000 1.1.2.1
+++ include/cluster/ssi/namesvr.h 13 Jan 2010 12:47:36 -0000 1.1.2.1.2.2
@@ -55,5 +55,9 @@ enum id_type {
/* extern functions */
extern int cli_ipcname_getid (int, key_t, int, global_id_t *, clusternode_t *,
int, int *);
+extern int cli_ipcname_findid(int, global_id_t, key_t *, clusternode_t *, int *, int *, int *);
+extern int cli_ipcname_gettotal(int objtype, struct ssi_nodeid_pair **, int *);
+extern int cli_ipcname_rmid(int, global_id_t);
+
extern cluster_svc_t cluster_ipc_svc;
#endif /* !_SSI_NAMESVR_H */
Index: include/cluster/ssi/ipc/msg.h
===================================================================
RCS file: include/cluster/ssi/ipc/msg.h
diff -N include/cluster/ssi/ipc/msg.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ include/cluster/ssi/ipc/msg.h 13 Jan 2010 12:14:45 -0000 1.1.2.1
@@ -0,0 +1,29 @@
+/*
+ * Message Queue header file.
+ * Copyright (c) 2010 John Hughes
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE
+ * or NON INFRINGEMENT. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Questions/Comments/Bugfixes to [email protected]
+ *
+ */
+
+#ifndef _SSI_IPC_MSG_H
+#define _SSI_IPC_MSG_H
+
+extern int ssi_msg_get_msg_queue(clusternode_t, int, char **);
+
+#endif /* _SSI_IPC_MSG_H */
Index: include/cluster/ssi/ipc/sem.h
===================================================================
RCS file: include/cluster/ssi/ipc/sem.h
diff -N include/cluster/ssi/ipc/sem.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ include/cluster/ssi/ipc/sem.h 13 Jan 2010 12:14:45 -0000 1.1.2.1
@@ -0,0 +1,29 @@
+/*
+ * Semaphore header file.
+ * Copyright (c) 2010 John Hughes
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE
+ * or NON INFRINGEMENT. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Questions/Comments/Bugfixes to [email protected]
+ *
+ */
+
+#ifndef _SSI_IPC_SEM_H
+#define _SSI_IPC_SEM_H
+
+extern int ssi_sem_get_sem_array(clusternode_t, int, char **);
+
+#endif /* _SSI_IPC_SEM_H */
Index: include/cluster/ssi/ipc/shm.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/include/cluster/ssi/ipc/Attic/shm.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.1.2.2
diff -u -p -r1.1.2.1 -r1.1.2.1.2.2
--- include/cluster/ssi/ipc/shm.h 20 Jan 2009 16:21:24 -0000 1.1.2.1
+++ include/cluster/ssi/ipc/shm.h 13 Jan 2010 14:55:56 -0000 1.1.2.1.2.2
@@ -53,6 +53,11 @@ extern struct shmid_kernel * shm_cli_get
extern int ipcname_failover_create(key_t, int, int, clusternode_t, int);
extern void get_shm_attr(int, key_t, int *, int *);
+#ifdef _LINUX_SHM_H_ // Avoid priblems woth shmids_ds
+extern int ssi_shmctl(clusternode_t, int, int, struct shmid_ds *);
+#endif
+extern int ssi_shm_get_shmid_kernel(clusternode_t, int, char **, int *, int *);
+
extern struct file_operations cfs_shm_file_operations;
extern struct vfsmount *cfs_shm_node_mnts[];
extern clusternode_t name_server_node;
Index: ipc/msg.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/ipc/msg.c,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.2.2.2
diff -u -p -r1.1.1.1.2.2 -r1.1.1.1.2.2.2.2
--- ipc/msg.c 29 Dec 2009 19:28:54 -0000 1.1.1.1.2.2
+++ ipc/msg.c 13 Jan 2010 12:14:46 -0000 1.1.1.1.2.2.2.2
@@ -33,22 +33,11 @@
#ifdef CONFIG_SSI
#include <cluster/clms.h>
#include <cluster/ssisys.h>
+#include <cluster/ssi/ipc/msg.h>
#include <cluster/ssi/namesvr.h>
#include <cluster/nsc.h>
#include <cluster/nodelist.h>
-
-extern int cli_ipcname_findid(int, int, key_t *, clusternode_t *, int *,
- int *, int *);
-extern int cli_ipcname_gettotal(int objtype, struct ssi_nodeid_pair **, int *);
-extern int cli_ipcname_rmid(int service, global_id_t glid);
-extern int cli_ripc_msgctl(clusternode_t, int *, int, int, ssi_procstate_t *,
- long *);
-extern int ssi_msg_get_msg_queue(clusternode_t, int, char **);
-extern int cli_ripc_msgrcv(clusternode_t, int *, int, size_t, long msgtyp, int,
- char **, int *, long *);
-extern int cli_ripc_msgsnd(clusternode_t, int *, int, struct msg_msg *,
- int, char *, int, int);
-extern clusternode_t name_server_node;
+#include <cluster/gen/ics_ipc_protos_gen.h>
#define MSG_MAX_ID (local_view ? msg_ids.max_id : size-1)
#define MSG_IPC_ID(i,seq) (local_view ? msg_buildid(i,seq) : ipc_id)
Index: ipc/sem.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/ipc/sem.c,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.2.2.2
diff -u -p -r1.1.1.1.2.2 -r1.1.1.1.2.2.2.2
--- ipc/sem.c 29 Dec 2009 19:28:54 -0000 1.1.1.1.2.2
+++ ipc/sem.c 13 Jan 2010 12:14:46 -0000 1.1.1.1.2.2.2.2
@@ -78,9 +78,11 @@
#ifdef CONFIG_SSI
#include <cluster/icsgen.h>
#include <cluster/clms.h>
+#include <cluster/ssi/ipc/sem.h>
#include <cluster/ssi/namesvr.h>
#include <cluster/nsc.h>
#include <cluster/nodelist.h>
+#include <cluster/gen/ics_ipc_protos_gen.h>
#endif /* CONFIG_SSI */
#define sem_lock(id) ((struct sem_array*)ipc_lock(&sem_ids,id))
@@ -137,20 +139,6 @@ int sem_ctls[4] = {SEMMSL, SEMMNS, SEMOP
#define sc_semmni (sem_ctls[3])
#ifdef CONFIG_SSI
-extern int cli_ipcname_findid(int, int, key_t *, clusternode_t *, int *,
- int *, int *);
-extern int cli_ipcname_rmid(int, global_id_t);
-extern int cli_ripc_semctl(clusternode_t, int *, int, int, int,
- ssi_procstate_t *, union semun *, int);
-extern int cli_ripc_semop(clusternode_t, int *, int, unsigned,
- ssi_procstate_t *, ics_userbuf_t *, ics_userbuf_t *);
-extern int cli_ripc_semexit(clusternode_t, int *, ssi_procstate_t *, int,
- pid_t);
-extern int cli_ipcname_gettotal(int, struct ssi_nodeid_pair **, int *);
-extern int ssi_sem_get_sem_array(clusternode_t, int, char **);
-
-extern clusternode_t name_server_node;
-
void ssi_semexit(int semid, pid_t pid);
static void freeundos(int);
Index: ipc/shm.c
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/ipc/shm.c,v
retrieving revision 1.1.1.1.2.3
retrieving revision 1.1.1.1.2.3.2.2
diff -u -p -r1.1.1.1.2.3 -r1.1.1.1.2.3.2.2
--- ipc/shm.c 29 Dec 2009 19:28:54 -0000 1.1.1.1.2.3
+++ ipc/shm.c 13 Jan 2010 12:14:46 -0000 1.1.1.1.2.3.2.2
@@ -41,14 +41,6 @@
#include "util.h"
#ifdef CONFIG_SSI
-extern int cli_ipcname_findid(int, int, key_t *, clusternode_t *, int *, int *, int *);
-extern int cli_ipcname_gettotal(int objtype, struct ssi_nodeid_pair **, int *);
-extern int cli_ipcname_rmid(int, global_id_t);
-extern int ssi_shmctl(clusternode_t, int, int, struct shmid_ds *);
-extern int ssi_shm_get_shmid_kernel(clusternode_t, int, char **, int *, int *);
-extern int ipc_grow_ary(struct ipc_ids *, int);
-extern void ipc_drop_locks(int, struct kern_ipc_perm *, struct ipc_ids *, int);
-extern struct kern_ipc_perm * ipc_get_locks(int, struct ipc_ids *, int);
long ssi_shmget(key_t, size_t, int);
long shm_get_segsize(struct shmid_kernel *);
long shm_get_cpid(struct shmid_kernel *);
Index: ipc/util.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/openssi-future/ipc/util.h,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.2.2.1
diff -u -p -r1.1.1.1.2.2 -r1.1.1.1.2.2.2.1
--- ipc/util.h 29 Dec 2009 19:28:54 -0000 1.1.1.1.2.2
+++ ipc/util.h 13 Jan 2010 12:14:46 -0000 1.1.1.1.2.2.2.1
@@ -89,6 +89,7 @@ extern struct kern_ipc_perm *ipc_get_loc
extern void ipc_drop_locks(int, struct kern_ipc_perm *, struct ipc_ids *, int);
extern void __init ssi_ipc_nodehint_init(clusternode_t **, int *, int, int);
extern void *ssi_ipc_nodehint_realloc(clusternode_t **, int *, int *, int *);
+extern int ipc_grow_ary(struct ipc_ids *, int);
#endif
void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out);