* [PATCH] overall trivial trivial cleanup
@ 2004-03-03 21:03 Kay Sievers
2004-03-04 0:57 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Kay Sievers @ 2004-03-03 21:03 UTC (permalink / raw)
To: linux-hotplug
[-- 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();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] overall trivial trivial cleanup
2004-03-03 21:03 [PATCH] overall trivial trivial cleanup Kay Sievers
@ 2004-03-04 0:57 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-03-04 0:57 UTC (permalink / raw)
To: linux-hotplug
On Wed, Mar 03, 2004 at 10:03:41PM +0100, Kay Sievers wrote:
> 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.
Applied, thanks.
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-03-04 0:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-03 21:03 [PATCH] overall trivial trivial cleanup Kay Sievers
2004-03-04 0:57 ` Greg KH
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).