From: Alex Riesen <raa.lkml@gmail.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [ANNOUNCE] udev 046 release
Date: Fri, 19 Nov 2004 10:00:40 +0000 [thread overview]
Message-ID: <81b0412b04111902001c5ea798@mail.gmail.com> (raw)
In-Reply-To: <20041118224411.GA10876@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
On Fri, 19 Nov 2004 10:58:53 +0100, Alex Riesen <raa.lkml@gmail.com> wrote:
> On Thu, 18 Nov 2004 14:44:12 -0800, Greg KH <greg@kroah.com> wrote:
> > I've released the 046 version of udev. It can be found at:
> > kernel.org/pub/linux/utils/kernel/hotplug/udev-046.tar.gz
>
> I just put const's at some places. It cut down data segments, but
> increased code size.
> Overall still smaller:
>
> -rwxr-xr-x 1 user users 50420 Nov 19 10:53 ../udev-046/udev
> -rwxr-xr-x 1 user users 49556 Nov 19 10:53 udev
> text data bss dec hex filename
> 47245 968 22480 70693 11425 ../udev-046/udev
> 48089 104 22064 70257 11271 udev
>
> Also, the instance of utsname in udev_lib.c is used only once.
forgot the patch...
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: udev-046-const.patch --]
[-- Type: text/x-patch; name="udev-046-const.patch", Size: 3922 bytes --]
* utsname used only once
* consts help gcc pack the object tighter
diff -upr udev-046/udev_lib.c udev-046-1/udev_lib.c
--- udev-046/udev_lib.c 2004-11-18 20:39:15.000000000 +0100
+++ udev-046-1/udev_lib.c 2004-11-19 10:33:23.885019143 +0100
@@ -65,12 +65,12 @@ void udev_set_values(struct udevice *ude
int kernel_release_satisfactory(int version, int patchlevel, int sublevel)
{
- static struct utsname uts;
static int kversion = 0;
static int kpatchlevel;
static int ksublevel;
if (kversion == 0) {
+ struct utsname uts;
if (uname(&uts) != 0)
return -1;
diff -upr udev-046/udev_sysfs.c udev-046-1/udev_sysfs.c
--- udev-046/udev_sysfs.c 2004-11-18 20:39:15.000000000 +0100
+++ udev-046-1/udev_sysfs.c 2004-11-19 10:42:08.480223052 +0100
@@ -35,9 +35,9 @@
#include "logging.h"
/* list of subsystem specific files, NULL if there is no file to wait for */
-static struct subsystem_file {
- char *subsystem;
- char *file;
+static const struct subsystem_file {
+ const char *subsystem;
+ const char *file;
} subsystem_files[] = {
{ .subsystem = "net", .file = "ifindex" },
{ .subsystem = "scsi_host", .file = "unique_id" },
@@ -56,7 +56,7 @@ static struct subsystem_file {
int subsystem_expect_no_dev(const char *subsystem)
{
- struct subsystem_file *file;
+ const struct subsystem_file *file;
for (file = subsystem_files; file->subsystem != NULL; file++)
if (strcmp(subsystem, file->subsystem) == 0)
@@ -66,9 +66,9 @@ int subsystem_expect_no_dev(const char *
}
/* get subsystem specific files, returns "dev" if no other found */
-static char *get_subsystem_specific_file(const char *subsystem)
+static const char *get_subsystem_specific_file(const char *subsystem)
{
- struct subsystem_file *file;
+ const struct subsystem_file *file;
/* look if we want to look for another file instead of "dev" */
for (file = subsystem_files; file->subsystem != NULL; file++)
@@ -123,9 +123,9 @@ static int class_device_expect_no_device
{
/* list of devices without a "device" symlink to the physical device
* if device is set to NULL, no devices in that subsystem has a link */
- static struct class_device {
- char *subsystem;
- char *device;
+ static const struct class_device {
+ const char *subsystem;
+ const char *device;
} class_device[] = {
{ .subsystem = "block", .device = "double" },
{ .subsystem = "block", .device = "nb" },
@@ -202,7 +202,7 @@ static int class_device_expect_no_device
{ .subsystem = "capi", .device = NULL },
{ NULL, NULL }
};
- struct class_device *classdevice;
+ const struct class_device *classdevice;
int len;
/* the kernel may tell us what to wait for */
@@ -240,13 +240,13 @@ static int class_device_expect_no_device
/* skip waiting for the bus of the devices device */
static int class_device_expect_no_bus(struct sysfs_class_device *class_dev)
{
- static char *devices_without_bus[] = {
+ static const char *devices_without_bus[] = {
"scsi_host",
"i2c-adapter",
"i2c-dev",
NULL
};
- char **device;
+ const char **device;
for (device = devices_without_bus; *device != NULL; device++) {
int len = strlen(*device);
@@ -262,9 +262,9 @@ static int class_device_expect_no_bus(st
int wait_for_devices_device(struct sysfs_device *devices_dev,
const char **error)
{
- static struct device_file {
- char *bus;
- char *file;
+ static const struct device_file {
+ const char *bus;
+ const char *file;
} device_files[] = {
{ .bus = "scsi", .file = "vendor" },
{ .bus = "usb", .file = "idVendor" },
@@ -280,7 +280,7 @@ int wait_for_devices_device(struct sysfs
{ .bus = "ieee1394", .file = "address" },
{ NULL, NULL }
};
- struct device_file *devicefile;
+ const struct device_file *devicefile;
int loop;
/* the kernel may tell us what to wait for */
next prev parent reply other threads:[~2004-11-19 10:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-18 22:44 [ANNOUNCE] udev 046 release Greg KH
2004-11-19 9:58 ` Alex Riesen
2004-11-19 10:00 ` Alex Riesen [this message]
2004-11-19 11:26 ` Mathieu Segaud
2004-11-19 14:42 ` Kay Sievers
2004-11-19 14:49 ` Mathieu Segaud
2004-11-19 15:45 ` Mathieu Segaud
2004-11-19 22:48 ` Greg KH
2004-11-19 22:58 ` Greg KH
2004-11-19 23:20 ` Paul Jackson
2004-11-19 23:47 ` Greg KH
2004-11-20 18:40 ` Alex Riesen
2004-11-22 19:52 ` 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=81b0412b04111902001c5ea798@mail.gmail.com \
--to=raa.lkml@gmail.com \
--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).