From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: udev - keep private data out of the database?
Date: Thu, 12 Feb 2004 17:09:17 +0000 [thread overview]
Message-ID: <20040212170917.GA20556@vrfy.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
Shouldn't we keep the temporary strings out of the database,
or is this information useful for something?
It cuts the length of the data from 628 to 275 bytes.
And shouldn't we add a 'rm /udev/.udevdb' to the init scripts?
Without it, we can't change the format of the records, cause udev
refuses to work with the old file.
thanks,
Kay
[-- Attachment #2: 01-keep-private-strings-out-of-db.patch --]
[-- Type: text/plain, Size: 1602 bytes --]
===== udev.h 1.38 vs edited =====
--- 1.38/udev.h Thu Feb 12 02:29:39 2004
+++ edited/udev.h Thu Feb 12 17:41:58 2004
@@ -24,6 +24,7 @@
#define UDEV_H
#include "libsysfs/libsysfs.h"
+#include <stddef.h>
#include <sys/param.h>
#define COMMENT_CHARACTER '#'
@@ -33,6 +34,9 @@
#define GROUP_SIZE 30
#define MODE_SIZE 8
+/* length of public data */
+#define UDEVICE_LEN (offsetof(struct udevice, bus_id))
+
struct udevice {
char name[NAME_SIZE];
char owner[OWNER_SIZE];
@@ -43,11 +47,11 @@
unsigned int mode; /* not mode_t due to conflicting definitions in different libcs */
char symlink[NAME_SIZE];
- /* fields that help us in building strings */
- unsigned char bus_id[SYSFS_NAME_LEN];
- unsigned char program_result[NAME_SIZE];
- unsigned char kernel_number[NAME_SIZE];
- unsigned char kernel_name[NAME_SIZE];
+ /* private data that help us in building strings */
+ char bus_id[SYSFS_NAME_LEN];
+ char program_result[NAME_SIZE];
+ char kernel_number[NAME_SIZE];
+ char kernel_name[NAME_SIZE];
};
#define strfieldcpy(to, from) \
===== udevdb.c 1.19 vs edited =====
--- 1.19/udevdb.c Sat Jan 17 15:47:18 2004
+++ edited/udevdb.c Thu Feb 12 17:46:14 2004
@@ -58,8 +58,8 @@
key.dsize = strlen(keystr) + 1;
data.dptr = (void *)dev;
- data.dsize = sizeof(*dev);
-
+ data.dsize = UDEVICE_LEN;
+
return tdb_store(udevdb, key, data, TDB_REPLACE);
}
@@ -77,7 +77,8 @@
if (data.dptr == NULL || data.dsize == 0)
return -ENODEV;
- memcpy(dev, data.dptr, sizeof(*dev));
+ memset(dev, 0, sizeof(struct udevice));
+ memcpy(dev, data.dptr, UDEVICE_LEN);
return 0;
}
next reply other threads:[~2004-02-12 17:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-12 17:09 Kay Sievers [this message]
2004-02-12 23:13 ` udev - keep private data out of the database? 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=20040212170917.GA20556@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).