toproto: use NetBSD names/types for device numbers

This should unbreak crossbuilding from Ubuntu 32-bit

Change-Id: I6ead9f8289dba6271c52dace81abffaabe6c8869
This commit is contained in:
David van Moolenbroek 2013-11-07 16:51:21 +00:00 committed by Lionel Sambuc
parent 24ec0d73b5
commit c498a34843
2 changed files with 9 additions and 5 deletions

View file

@ -4,5 +4,7 @@
PROG=toproto PROG=toproto
MAN= MAN=
.include <bsd.prog.mk> CPPFLAGS+= -I${NETBSDSRCDIR}/sbin/mknod
.PATH: ${NETBSDSRCDIR}/sbin/mknod
.include <bsd.prog.mk>

View file

@ -11,6 +11,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "pack_dev.h"
#define MAX_ENTRIES 100000 #define MAX_ENTRIES 100000
#define MAX_LINE_SIZE 0xfff #define MAX_LINE_SIZE 0xfff
@ -38,8 +40,8 @@ struct entry
char *size; char *size;
char *link; char *link;
/* Can't use devmajor_t/devminor_t on linux systems :( */ /* Can't use devmajor_t/devminor_t on linux systems :( */
dev_t dev_major; int32_t dev_major;
dev_t dev_minor; int32_t dev_minor;
/* just internal variables used to create a tree */ /* just internal variables used to create a tree */
int depth; int depth;
@ -123,8 +125,8 @@ convert_to_entry(char *line, struct entry *entry)
} else if (strncmp(key, "device", 7) == 0) { } else if (strncmp(key, "device", 7) == 0) {
long int dev_id; long int dev_id;
dev_id = strtoul(value, NULL, 16); dev_id = strtoul(value, NULL, 16);
entry->dev_major = major(dev_id); entry->dev_major = major_netbsd(dev_id);
entry->dev_minor = minor(dev_id); entry->dev_minor = minor_netbsd(dev_id);
} else { } else {
fprintf(stderr, fprintf(stderr,
"\tunknown attribute %s -> %s\n", key, "\tunknown attribute %s -> %s\n", key,