linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] overall trivial trivial cleanup
Date: Wed, 03 Mar 2004 21:03:41 +0000	[thread overview]
Message-ID: <20040303210341.GA14662@vrfy.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

Here I try to make the style a bit more consistant in the different
files, so that new patches just copy the 'right' one :)

Some "magic" numbers are replaced and udevtest.c is catched up with udev.

thanks,
Kay

[-- Attachment #2: 01-cleanup-all.patch --]
[-- Type: text/plain, Size: 5251 bytes --]

===== logging.h 1.11 vs edited =====
--- 1.11/logging.h	Thu Feb 26 06:14:04 2004
+++ edited/logging.h	Wed Mar  3 21:04:13 2004
@@ -34,6 +34,8 @@
 #include <unistd.h>
 #include <syslog.h>
 
+#define LOGNAME_SIZE			42
+
 #undef info
 #define info(format, arg...)								\
 	do {										\
@@ -61,12 +63,12 @@
 	__attribute__ ((format (printf, 2, 3)));
 
 /* each program that uses syslog must declare this variable somewhere */
-extern unsigned char logname[42];
+extern unsigned char logname[LOGNAME_SIZE];
 
 #undef init_logging
 static inline void init_logging(char *program_name)
 {
-	snprintf(logname, 42,"%s[%d]", program_name, getpid());
+	snprintf(logname, LOGNAME_SIZE,"%s[%d]", program_name, getpid());
 	openlog(logname, 0, LOG_DAEMON);
 }
 
===== namedev_parse.c 1.29 vs edited =====
--- 1.29/namedev_parse.c	Sat Feb 28 22:51:04 2004
+++ edited/namedev_parse.c	Wed Mar  3 21:43:42 2004
@@ -58,7 +58,6 @@
 
 void dump_config_dev(struct config_device *dev)
 {
-	/*FIXME dump all sysfs's */
 	dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', "
 		  "sysfs_file[0]='%s', sysfs_value[0]='%s', "
 		  "kernel='%s', program='%s', result='%s'",
===== udev.c 1.51 vs edited =====
--- 1.51/udev.c	Wed Mar  3 00:47:21 2004
+++ edited/udev.c	Wed Mar  3 21:52:05 2004
@@ -40,7 +40,7 @@
 char **main_envp;
 
 #ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
 void log_message(int level, const char *format, ...)
 {
 	va_list args;
@@ -74,7 +74,7 @@
 	"usb_host",
 	"pci_bus",
 	"pcmcia_socket",
-	"",
+	""
 };
 
 static int udev_hotplug(void)
@@ -164,7 +164,7 @@
 	return -retval;
 }
 
-int main(int argc, char **argv, char **envp)
+int main(int argc, char *argv[], char *envp[])
 {
 	main_argv = argv;
 	main_envp = envp;
===== udevd.c 1.22 vs edited =====
--- 1.22/udevd.c	Thu Feb 26 04:09:18 2004
+++ edited/udevd.c	Wed Mar  3 21:05:10 2004
@@ -52,7 +52,7 @@
 static void msg_queue_manager(void);
 
 #ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
 void log_message (int level, const char *format, ...)
 {
 	va_list	args;
===== udevinfo.c 1.16 vs edited =====
--- 1.16/udevinfo.c	Tue Mar  2 01:46:03 2004
+++ edited/udevinfo.c	Wed Mar  3 21:41:52 2004
@@ -41,7 +41,7 @@
 int main_argc;
 
 #ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
 void log_message (int level, const char *format, ...)
 {
 	va_list	args;
===== udevsend.c 1.26 vs edited =====
--- 1.26/udevsend.c	Thu Feb 26 04:09:18 2004
+++ edited/udevsend.c	Wed Mar  3 21:07:05 2004
@@ -41,7 +41,7 @@
 #include "logging.h"
 
 #ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
 void log_message (int level, const char *format, ...)
 {
 	va_list	args;
===== udevstart.c 1.2 vs edited =====
--- 1.2/udevstart.c	Tue Mar  2 23:31:16 2004
+++ edited/udevstart.c	Wed Mar  3 21:10:43 2004
@@ -34,7 +34,7 @@
 
 
 #ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
 void log_message(int level, const char *format, ...)
 {
 	va_list args;
@@ -187,7 +187,7 @@
 }
 
 
-int main(int argc, char **argv, char **envp)
+int main(int argc, char *argv[], char *envp[])
 {
 	init_logging("udevstart");
 
===== udevtest.c 1.5 vs edited =====
--- 1.5/udevtest.c	Thu Feb 26 04:09:18 2004
+++ edited/udevtest.c	Wed Mar  3 21:50:46 2004
@@ -38,15 +38,11 @@
 char **main_envp;
 
 #ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
 void log_message (int level, const char *format, ...)
 {
-	va_list	args;
+	va_list args;
 
-//	if (!udev_log)
-//		return;
-
-	/* FIXME use level... */
 	va_start(args, format);
 	vprintf(format, args);
 	va_end(args);
@@ -55,35 +51,24 @@
 }
 #endif
 
-static void sig_handler(int signum)
-{
-	switch (signum) {
-		case SIGINT:
-		case SIGTERM:
-			exit(20 + signum);
-		default:
-			dbg("unhandled signal");
-	}
-}
-
 static char *subsystem_blacklist[] = {
 	"net",
 	"scsi_host",
 	"scsi_device",
 	"usb_host",
 	"pci_bus",
-	"",
+	"pcmcia_socket",
+	""
 };
 
-static int udev_hotplug(int argc, char **argv)
+static int udev_hotplug(void)
 {
 	char *devpath;
 	char *subsystem;
 	int retval = -EINVAL;
 	int i;
-	struct sigaction act;
 
-	devpath = argv[1];
+	devpath = main_argv[1];
 	if (!devpath) {
 		dbg("no devpath?");
 		goto exit;
@@ -98,7 +83,7 @@
 	}
 
 	/* skip blacklisted subsystems */
-	subsystem = argv[1];
+	subsystem = main_argv[1];
 	i = 0;
 	while (subsystem_blacklist[i][0] != '\0') {
 		if (strcmp(subsystem, subsystem_blacklist[i]) == 0) {
@@ -111,16 +96,10 @@
 	/* initialize our configuration */
 	udev_init_config();
 
-	/* set up a default signal handler for now */
-	act.sa_handler = sig_handler;
-	sigemptyset (&act.sa_mask);
-	act.sa_flags = SA_RESTART;
-	sigaction(SIGINT, &act, NULL);
-	sigaction(SIGTERM, &act, NULL);
-
 	/* initialize the naming deamon */
 	namedev_init();
 
+	/* simulate node creation with fake flag */
 	retval = udev_add_device(devpath, subsystem, 1);
 
 exit:
@@ -130,14 +109,14 @@
 	return -retval;
 }
 
-int main(int argc, char **argv, char **envp)
+int main(int argc, char *argv[], char *envp[])
 {
 	main_argv = argv;
 	main_envp = envp;
 
 	dbg("version %s", UDEV_VERSION);
 
-	return udev_hotplug(argc, argv);
+	return udev_hotplug();
 }
 
 

             reply	other threads:[~2004-03-03 21:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-03 21:03 Kay Sievers [this message]
2004-03-04  0:57 ` [PATCH] overall trivial trivial cleanup Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040303210341.GA14662@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).