-/* $OpenBSD: config.h,v 1.31 2021/01/26 18:23:49 deraadt Exp $ */
+/* $OpenBSD: config.h,v 1.32 2021/11/28 19:26:03 deraadt Exp $ */
/* $NetBSD: config.h,v 1.30 1997/02/02 21:12:30 thorpej Exp $ */
/*
int mkmakefile(void);
/* mkswap.c */
+extern dev_t nodev;
int mkswap(void);
/* pack.c */
%{
-/* $OpenBSD: gram.y,v 1.24 2015/01/16 06:40:16 deraadt Exp $ */
+/* $OpenBSD: gram.y,v 1.25 2021/11/28 19:26:03 deraadt Exp $ */
/* $NetBSD: gram.y,v 1.14 1997/02/02 21:12:32 thorpej Exp $ */
/*
* from: @(#)gram.y 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h> /* NODEV */
#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
dev_spec { $$ = $1; };
dev_spec:
- WORD { $$ = new_si($1, NODEV); } |
+ WORD { $$ = new_si($1, nodev); } |
major_minor { $$ = new_si(NULL, $1); };
major_minor:
-/* $OpenBSD: hash.c,v 1.18 2015/01/17 07:37:14 deraadt Exp $ */
+/* $OpenBSD: hash.c,v 1.19 2021/11/28 19:26:03 deraadt Exp $ */
/* $NetBSD: hash.c,v 1.4 1996/11/07 22:59:43 gwr Exp $ */
/*
* from: @(#)hash.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h> /* ALIGNBYTES */
+#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
/* round up to next multiple of y, where y is a power of 2 */
#define ROUND(x, y) (((x) + (y) - 1) & ~((y) - 1))
-static void *poolalloc(size_t);
static void ht_init(struct hashtab *, size_t);
static void ht_expand(struct hashtab *);
-/*
- * Allocate space that will never be freed.
- */
-static void *
-poolalloc(size_t size)
-{
- char *p;
- size_t alloc;
- static char *pool;
- static size_t nleft;
-
- if (nleft < size) {
- /*
- * Compute a `good' size to allocate via malloc.
- * 16384 is a guess at a good page size for malloc;
- * 32 is a guess at malloc's overhead.
- */
- alloc = ROUND(size + 32, 16384) - 32;
- p = emalloc(alloc);
- nleft = alloc - size;
- } else {
- p = pool;
- nleft -= size;
- }
- pool = p + size;
- return (p);
-}
/*
* Initialize a new hash table. The size must be a power of 2.
newhashent(const char *name, u_int h)
{
struct hashent *hp;
- char *m;
- m = poolalloc(sizeof(*hp) + ALIGNBYTES);
- hp = (struct hashent *)ALIGN(m);
+ hp = emalloc(sizeof(*hp));
hp->h_name = name;
hp->h_hash = h;
hp->h_next = NULL;
if (hp->h_hash == h && strcmp(hp->h_name, s) == 0)
return (hp->h_name);
l = strlen(s) + 1;
- p = poolalloc(l);
+ p = malloc(l);
bcopy(s, p, l);
*hpp = newhashent(p, h);
if (++ht->ht_used > ht->ht_lim)
-/* $OpenBSD: mkmakefile.c,v 1.47 2019/06/28 13:33:55 deraadt Exp $ */
+/* $OpenBSD: mkmakefile.c,v 1.48 2021/11/28 19:26:03 deraadt Exp $ */
/* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */
/*
expand = expandname(nv->nv_name);
source = sourcepath(expand ? expand : nv->nv_name);
if (access(source, R_OK) == 0) {
- /* XXX poolalloc() prevents freeing old nv_name */
if (expand)
nv->nv_name = intern(expand);
break;
-/* $OpenBSD: mkswap.c,v 1.18 2019/06/28 13:33:55 deraadt Exp $ */
+/* $OpenBSD: mkswap.c,v 1.19 2021/11/28 19:26:03 deraadt Exp $ */
/* $NetBSD: mkswap.c,v 1.5 1996/08/31 20:58:27 mycroft Exp $ */
/*
* from: @(#)mkswap.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h> /* NODEV */
+#include <sys/types.h>
#include <err.h>
#include <errno.h>
#include "config.h"
#include "sem.h"
+dev_t nodev = (dev_t)-1;
+
static int mkoneswap(struct config *);
/*
{
static char buf[32];
- if (d == NODEV)
+ if (d == nodev)
(void)snprintf(buf, sizeof buf, "NODEV");
else
(void)snprintf(buf, sizeof buf, "makedev(%u, %u)",
-/* $OpenBSD: sem.c,v 1.37 2019/02/05 02:17:32 deraadt Exp $ */
+/* $OpenBSD: sem.c,v 1.38 2021/11/28 19:26:03 deraadt Exp $ */
/* $NetBSD: sem.c,v 1.10 1996/11/11 23:40:11 gwr Exp $ */
/*
* from: @(#)sem.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h> /* NODEV */
-
+#include <sys/types.h>
#include <ctype.h>
#include <err.h>
#include <stdio.h>
dev->d_name = name;
dev->d_next = NULL;
dev->d_isdef = 0;
- dev->d_major = NODEV;
+ dev->d_major = nodev;
dev->d_attrs = NULL;
dev->d_ihead = NULL;
dev->d_ipp = &dev->d_ihead;
setmajor(struct devbase *d, int n)
{
- if (d != &errdev && d->d_major != NODEV)
+ if (d != &errdev && d->d_major != nodev)
error("device `%s' is already major %d",
d->d_name, d->d_major);
else
if ((part >= maxpartitions) || (part < 0))
panic("resolve");
if ((nv = *nvp) == NULL) {
- dev_t d = NODEV;
+ dev_t d = nodev;
/*
* Apply default. Easiest to do this by number.
* Make sure to retain NODEVness, if this is dflt's disposition.
*/
- if (dflt->nv_int != NODEV) {
+ if (dflt->nv_int != nodev) {
maj = major(dflt->nv_int);
min = (minor(dflt->nv_int) / maxpartitions) + part;
d = makedev(maj, min);
}
*nvp = nv = newnv(NULL, NULL, NULL, d, NULL);
}
- if (nv->nv_int != NODEV) {
+ if (nv->nv_int != nodev) {
/*
* By the numbers. Find the appropriate major number
* to make a name.
return (1);
}
dev = ht_lookup(devbasetab, intern(buf));
- if (dev == NULL || dev->d_major == NODEV) {
+ if (dev == NULL || dev->d_major == nodev) {
error("%s: can't make %s device from `%s'",
name, what, nv->nv_str);
return (1);