* [PATCH v3 1/5] makedevs: Create blocks of devices with the correct uid/gid
2013-05-30 12:18 [PATCH v3 0/5] Fixes for makedevs Peter Kjellerstedt
@ 2013-05-30 12:18 ` Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 2/5] makedevs: Correct the device number calculation for blocks of devices Peter Kjellerstedt
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 12:18 UTC (permalink / raw)
To: openembedded-core
When creating a block of devices (i.e., when count > 0), the wrong
path was used with the call to chown(), effectively trying to change
the owner of some (probably) non-existent file. Thus the created
device nodes were always owned by root.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index c7ad722..247d6c1 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -130,7 +130,7 @@ static void add_new_device(char *name, char *path, unsigned long uid,
timestamp = sb.st_mtime;
}
- mknod(name, mode, rdev);
+ mknod(path, mode, rdev);
chown(path, uid, gid);
// printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n",
// path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff));
@@ -198,7 +198,7 @@ static int interpret_table_entry(char *line)
error_msg_and_die("Device table entries require absolute paths");
}
name = xstrdup(path + 1);
- sprintf(path, "%s/%s\0", rootdir, name);
+ sprintf(path, "%s/%s", rootdir, name);
switch (type) {
case 'd':
@@ -223,6 +223,7 @@ static int interpret_table_entry(char *line)
for (i = start; i < count; i++) {
sprintf(buf, "%s%d", name, i);
+ sprintf(path, "%s/%s%d", rootdir, name, i);
/* FIXME: MKDEV uses illicit insider knowledge of kernel
* major/minor representation... */
rdev = MKDEV(major, minor + (i * increment - start));
--
1.8.2.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 2/5] makedevs: Correct the device number calculation for blocks of devices
2013-05-30 12:18 [PATCH v3 0/5] Fixes for makedevs Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 1/5] makedevs: Create blocks of devices with the correct uid/gid Peter Kjellerstedt
@ 2013-05-30 12:18 ` Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 3/5] makedevs: Make the mode number readable in debug messages Peter Kjellerstedt
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 12:18 UTC (permalink / raw)
To: openembedded-core
If the increment > 1 and the start > 0 then the calculation for the
minor device number was incorrect.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index 247d6c1..d58e891 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -226,7 +226,7 @@ static int interpret_table_entry(char *line)
sprintf(path, "%s/%s%d", rootdir, name, i);
/* FIXME: MKDEV uses illicit insider knowledge of kernel
* major/minor representation... */
- rdev = MKDEV(major, minor + (i * increment - start));
+ rdev = MKDEV(major, minor + (i - start) * increment);
add_new_device(buf, path, uid, gid, mode, rdev);
}
} else {
--
1.8.2.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 3/5] makedevs: Make the mode number readable in debug messages
2013-05-30 12:18 [PATCH v3 0/5] Fixes for makedevs Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 1/5] makedevs: Create blocks of devices with the correct uid/gid Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 2/5] makedevs: Correct the device number calculation for blocks of devices Peter Kjellerstedt
@ 2013-05-30 12:18 ` Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 4/5] makedevs: Avoid unnecessary timestamp calculation Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 5/5] makedevs: Make count actually behave as a count for device blocks Peter Kjellerstedt
4 siblings, 0 replies; 8+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 12:18 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index d58e891..4cfb1d5 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -108,7 +108,7 @@ static void add_new_directory(char *name, char *path,
{
mkdir(path, mode);
chown(path, uid, gid);
-// printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode);
+// printf("Directory: %s %s UID: %ld GID %ld MODE: %04lo\n", path, name, uid, gid, mode);
}
static void add_new_device(char *name, char *path, unsigned long uid,
@@ -132,7 +132,7 @@ static void add_new_device(char *name, char *path, unsigned long uid,
mknod(path, mode, rdev);
chown(path, uid, gid);
-// printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n",
+// printf("Device: %s %s UID: %ld GID: %ld MODE: %04lo MAJOR: %d MINOR: %d\n",
// path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff));
}
@@ -147,7 +147,7 @@ static void add_new_file(char *name, char *path, unsigned long uid,
}
chmod(path, mode);
chown(path, uid, gid);
-// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
+// printf("File: %s %s UID: %ld GID: %ld MODE: %04lo\n",
// path, name, gid, uid, mode);
}
@@ -158,7 +158,7 @@ static void add_new_fifo(char *name, char *path, unsigned long uid,
if (mknod(path, mode, 0))
error_msg_and_die("%s: file can not be created with mknod!", path);
chown(path, uid, gid);
-// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
+// printf("File: %s %s UID: %ld GID: %ld MODE: %04lo\n",
// path, name, gid, uid, mode);
}
--
1.8.2.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 4/5] makedevs: Avoid unnecessary timestamp calculation
2013-05-30 12:18 [PATCH v3 0/5] Fixes for makedevs Peter Kjellerstedt
` (2 preceding siblings ...)
2013-05-30 12:18 ` [PATCH v3 3/5] makedevs: Make the mode number readable in debug messages Peter Kjellerstedt
@ 2013-05-30 12:18 ` Peter Kjellerstedt
2013-05-30 12:18 ` [PATCH v3 5/5] makedevs: Make count actually behave as a count for device blocks Peter Kjellerstedt
4 siblings, 0 replies; 8+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 12:18 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index 4cfb1d5..4bb316b 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -116,7 +116,6 @@ static void add_new_device(char *name, char *path, unsigned long uid,
{
int status;
struct stat sb;
- time_t timestamp = time(NULL);
memset(&sb, 0, sizeof(struct stat));
status = lstat(path, &sb);
@@ -127,7 +126,6 @@ static void add_new_device(char *name, char *path, unsigned long uid,
* better match the actual file or strange things will happen.... */
if ((mode & S_IFMT) != (sb.st_mode & S_IFMT))
error_msg_and_die("%s: file type does not match specified type!", path);
- timestamp = sb.st_mtime;
}
mknod(path, mode, rdev);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 5/5] makedevs: Make count actually behave as a count for device blocks
2013-05-30 12:18 [PATCH v3 0/5] Fixes for makedevs Peter Kjellerstedt
` (3 preceding siblings ...)
2013-05-30 12:18 ` [PATCH v3 4/5] makedevs: Avoid unnecessary timestamp calculation Peter Kjellerstedt
@ 2013-05-30 12:18 ` Peter Kjellerstedt
2013-05-30 19:58 ` Richard Purdie
4 siblings, 1 reply; 8+ messages in thread
From: Peter Kjellerstedt @ 2013-05-30 12:18 UTC (permalink / raw)
To: openembedded-core
Previously count actually behaved as end, and did not take start into
account.
---
meta/files/device_table-minimal.txt | 2 +-
meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/files/device_table-minimal.txt b/meta/files/device_table-minimal.txt
index c6e5463..02ed534 100644
--- a/meta/files/device_table-minimal.txt
+++ b/meta/files/device_table-minimal.txt
@@ -13,7 +13,7 @@
/dev/apm_bios c 660 0 46 10 134 - - -
/dev/fb0 c 600 0 0 29 0 - - -
/dev/hda b 660 0 6 3 0 - - -
-/dev/hda b 660 0 6 3 1 1 1 20
+/dev/hda b 660 0 6 3 1 1 1 19
/dev/kmem c 640 0 15 1 2 - - -
/dev/kmsg c 600 0 0 1 11 - - -
/dev/mem c 640 0 15 1 1 - - -
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index 4bb316b..6c1f2fb 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -219,7 +219,7 @@ static int interpret_table_entry(char *line)
dev_t rdev;
char buf[80];
- for (i = start; i < count; i++) {
+ for (i = start; i < start + count; i++) {
sprintf(buf, "%s%d", name, i);
sprintf(path, "%s/%s%d", rootdir, name, i);
/* FIXME: MKDEV uses illicit insider knowledge of kernel
--
1.8.2.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v3 5/5] makedevs: Make count actually behave as a count for device blocks
2013-05-30 12:18 ` [PATCH v3 5/5] makedevs: Make count actually behave as a count for device blocks Peter Kjellerstedt
@ 2013-05-30 19:58 ` Richard Purdie
2013-05-31 11:38 ` Peter Kjellerstedt
0 siblings, 1 reply; 8+ messages in thread
From: Richard Purdie @ 2013-05-30 19:58 UTC (permalink / raw)
To: Peter Kjellerstedt; +Cc: openembedded-core
On Thu, 2013-05-30 at 14:18 +0200, Peter Kjellerstedt wrote:
> Previously count actually behaved as end, and did not take start into
> account.
> ---
> meta/files/device_table-minimal.txt | 2 +-
> meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
No signed-off-by line :(
I merged the others.
Cheers,
Richard
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 5/5] makedevs: Make count actually behave as a count for device blocks
2013-05-30 19:58 ` Richard Purdie
@ 2013-05-31 11:38 ` Peter Kjellerstedt
0 siblings, 0 replies; 8+ messages in thread
From: Peter Kjellerstedt @ 2013-05-31 11:38 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-core@lists.openembedded.org
> -----Original Message-----
> From: Richard Purdie [mailto:richard.purdie@linuxfoundation.org]
> Sent: den 30 maj 2013 21:58
> To: Peter Kjellerstedt
> Cc: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH v3 5/5] makedevs: Make count actually
> behave as a count for device blocks
>
> On Thu, 2013-05-30 at 14:18 +0200, Peter Kjellerstedt wrote:
> > Previously count actually behaved as end, and did not take start into
> > account.
> > ---
> > meta/files/device_table-minimal.txt | 2 +-
> > meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
>
> No signed-off-by line :(
>
> I merged the others.
>
> Cheers,
>
> Richard
Argh. The fact that we are not using Signed-off-by lines internally
is not helping me...
I have sent an updated version of the fifth patch.
//Peter
^ permalink raw reply [flat|nested] 8+ messages in thread