lkml.org 
[lkml]   [2005]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2.6.13-rc1-mm1] connector: Remove the union declaration
Hello,

This patch removes the ugly union declaration in cn_fork.h and
cn_exit.h files. The code is cleaner without the union and the price is
only four bytes added in the structure.

Thanks to Alexander Nyberg for reporting this.

Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@polymtl.ca>

---
drivers/connector/cn_exit.c | 8 ++++----
drivers/connector/cn_fork.c | 10 +++++-----
include/linux/cn_exit.h | 16 ++++++++--------
include/linux/cn_fork.h | 18 +++++++++---------
4 files changed, 26 insertions(+), 26 deletions(-)


Index: linux-2.6.13-rc1-mm1/drivers/connector/cn_exit.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/connector/cn_exit.c 2005-07-04 14:20:59.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/connector/cn_exit.c 2005-07-04 14:36:47.000000000 +0200
@@ -73,9 +73,9 @@ void exit_connector(pid_t pid, pid_t pti
exitmsg = (struct cn_exit_msg *)msg->data;
exitmsg->type = EXIT_CN_MSG_P;
exitmsg->cpu = smp_processor_id();
- exitmsg->u.s.pid = pid;
- exitmsg->u.s.ptid = ptid;
- exitmsg->u.s.code = code;
+ exitmsg->pid = pid;
+ exitmsg->ptid = ptid;
+ exitmsg->code = code;

put_cpu_var(exit_counts);

@@ -107,7 +107,7 @@ static inline void cn_exit_send_status(v
msg->len = CN_EXIT_INFO_SIZE;
exitmsg = (struct cn_exit_msg *)msg->data;
exitmsg->type = EXIT_CN_MSG_S;
- exitmsg->u.status = cn_exit_enable;
+ exitmsg->status = cn_exit_enable;

cn_netlink_send(msg, CN_IDX_EXIT, GFP_KERNEL);
}
Index: linux-2.6.13-rc1-mm1/drivers/connector/cn_fork.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/connector/cn_fork.c 2005-07-04 14:20:59.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/connector/cn_fork.c 2005-07-04 14:36:50.000000000 +0200
@@ -72,10 +72,10 @@ void fork_connector(pid_t ppid, pid_t pt
forkmsg = (struct cn_fork_msg *)msg->data;
forkmsg->type = FORK_CN_MSG_P;
forkmsg->cpu = smp_processor_id();
- forkmsg->u.s.ppid = ppid;
- forkmsg->u.s.ptid = ptid;
- forkmsg->u.s.cpid = cpid;
- forkmsg->u.s.ctid = ctid;
+ forkmsg->ppid = ppid;
+ forkmsg->ptid = ptid;
+ forkmsg->cpid = cpid;
+ forkmsg->ctid = ctid;

put_cpu_var(fork_counts);

@@ -107,7 +107,7 @@ static inline void cn_fork_send_status(v
msg->len = CN_FORK_INFO_SIZE;
forkmsg = (struct cn_fork_msg *)msg->data;
forkmsg->type = FORK_CN_MSG_S;
- forkmsg->u.status = cn_fork_enable;
+ forkmsg->status = cn_fork_enable;

cn_netlink_send(msg, CN_IDX_FORK, GFP_KERNEL);
}
Index: linux-2.6.13-rc1-mm1/include/linux/cn_exit.h
===================================================================
--- linux-2.6.13-rc1-mm1.orig/include/linux/cn_exit.h 2005-07-04 14:21:05.000000000 +0200
+++ linux-2.6.13-rc1-mm1/include/linux/cn_exit.h 2005-07-04 14:42:11.000000000 +0200
@@ -41,14 +41,14 @@ struct cn_exit_msg {
int type; /* 0: information about processes
1: exit connector's state */
int cpu; /* ID of the cpu where the exit occurred */
- union {
- struct {
- pid_t pid; /* process ID */
- pid_t ptid; /* process thread ID */
- pid_t code; /* process exit code */
- } s;
- int status;
- } u;
+
+ /* Information about processes */
+ pid_t pid; /* process ID */
+ pid_t ptid; /* process thread ID */
+ pid_t code; /* process exit code */
+
+ /* Exit connector's state */
+ int status;
};

/* Code above is only inside the kernel */
Index: linux-2.6.13-rc1-mm1/include/linux/cn_fork.h
===================================================================
--- linux-2.6.13-rc1-mm1.orig/include/linux/cn_fork.h 2005-07-04 14:21:05.000000000 +0200
+++ linux-2.6.13-rc1-mm1/include/linux/cn_fork.h 2005-07-04 14:39:17.000000000 +0200
@@ -49,15 +49,15 @@ struct cn_fork_msg {
int type; /* 0: information about processes
1: fork connector's state */
int cpu; /* ID of the cpu where the fork occurred */
- union {
- struct {
- pid_t ppid; /* parent process ID */
- pid_t ptid; /* parent thread ID */
- pid_t cpid; /* child process ID */
- pid_t ctid; /* child thread ID */
- } s;
- int status;
- } u;
+
+ /* Information about processes */
+ pid_t ppid; /* parent process ID */
+ pid_t ptid; /* parent thread ID */
+ pid_t cpid; /* child process ID */
+ pid_t ctid; /* child thread ID */
+
+ /* fork connector's state */
+ int status;
};

/* Code above is only inside the kernel */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-07-04 15:14    [W:0.030 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site