diff options
Diffstat (limited to 'sys')
34 files changed, 133 insertions, 135 deletions
diff --git a/sys/arch/alpha/stand/netboot/if_prom.c b/sys/arch/alpha/stand/netboot/if_prom.c index 482994d6cea..93eb7b77076 100644 --- a/sys/arch/alpha/stand/netboot/if_prom.c +++ b/sys/arch/alpha/stand/netboot/if_prom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_prom.c,v 1.4 2008/03/09 12:03:03 sobrado Exp $ */ +/* $OpenBSD: if_prom.c,v 1.5 2010/12/06 18:44:49 jasper Exp $ */ /* $NetBSD: if_prom.c,v 1.9 1997/04/06 08:41:26 cgd Exp $ */ /* @@ -61,7 +61,7 @@ struct netif_dif prom_ifs[] = { { 0, 1, &prom_stats[0], 0, }, }; -struct netif_stats prom_stats[NENTS(prom_ifs)]; +struct netif_stats prom_stats[nitems(prom_ifs)]; struct netbbinfo netbbinfo = { 0xfeedbabedeadbeef, /* magic number */ @@ -82,7 +82,7 @@ struct netif_driver prom_netif_driver = { prom_put, /* netif_put */ prom_end, /* netif_end */ prom_ifs, /* netif_ifs */ - NENTS(prom_ifs) /* netif_nifs */ + nitems(prom_ifs) /* netif_nifs */ }; int netfd, broken_firmware; diff --git a/sys/arch/amd64/stand/boot/conf.c b/sys/arch/amd64/stand/boot/conf.c index 212c8c529a0..724c6cd3c4a 100644 --- a/sys/arch/amd64/stand/boot/conf.c +++ b/sys/arch/amd64/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.15 2010/08/11 14:18:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.16 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -56,10 +56,10 @@ void (*i386_probe2[])(void) = { }; struct i386_boot_probes probe_list[] = { - { "probing", i386_probe1, NENTS(i386_probe1) }, - { "disk", i386_probe2, NENTS(i386_probe2) } + { "probing", i386_probe1, nitems(i386_probe1) }, + { "disk", i386_probe2, nitems(i386_probe2) } }; -int nibprobes = NENTS(probe_list); +int nibprobes = nitems(probe_list); struct fs_ops file_system[] = { @@ -74,7 +74,7 @@ struct fs_ops file_system[] = { cd9660_stat, cd9660_readdir }, #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "BIOS", biosstrategy, biosopen, biosclose, biosioctl }, @@ -82,7 +82,7 @@ struct devsw devsw[] = { { "TFTP", tftpstrategy, tftpopen, tftpclose, tftpioctl }, #endif }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct consdev constab[] = { { pc_probe, pc_init, pc_getc, pc_putc }, diff --git a/sys/arch/amd64/stand/cdboot/conf.c b/sys/arch/amd64/stand/cdboot/conf.c index 42a39f8fe7b..7b50da459d1 100644 --- a/sys/arch/amd64/stand/cdboot/conf.c +++ b/sys/arch/amd64/stand/cdboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.15 2010/08/11 14:18:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.16 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -57,10 +57,10 @@ void (*amd64_probe2[])(void) = { }; struct i386_boot_probes probe_list[] = { - { "probing", amd64_probe1, NENTS(amd64_probe1) }, - { "disk", amd64_probe2, NENTS(amd64_probe2) } + { "probing", amd64_probe1, nitems(amd64_probe1) }, + { "disk", amd64_probe2, nitems(amd64_probe2) } }; -int nibprobes = NENTS(probe_list); +int nibprobes = nitems(probe_list); struct fs_ops file_system[] = { { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, @@ -76,12 +76,12 @@ struct fs_ops file_system[] = { fat_stat, fat_readdir }, #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "BIOS", biosstrategy, biosopen, biosclose, biosioctl }, }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct consdev constab[] = { { pc_probe, pc_init, pc_getc, pc_putc }, diff --git a/sys/arch/amd64/stand/libsa/dev_i386.c b/sys/arch/amd64/stand/libsa/dev_i386.c index dc7edbb120f..f8757073289 100644 --- a/sys/arch/amd64/stand/libsa/dev_i386.c +++ b/sys/arch/amd64/stand/libsa/dev_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_i386.c,v 1.3 2007/06/27 20:29:37 mk Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.4 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -38,13 +38,13 @@ const char bdevs[][4] = { "wd", "", "fd", "", "sd", "st", "cd", "mcd", "", "", "", "", "", "", "", "scd", "", "hd", "" }; -const int nbdevs = NENTS(bdevs); +const int nbdevs = nitems(bdevs); const char cdevs[][4] = { "cn", "", "", "", "", "", "", "", "com", "", "", "", "pc" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); /* pass dev_t to the open routines */ int diff --git a/sys/arch/amd64/stand/libsa/memprobe.c b/sys/arch/amd64/stand/libsa/memprobe.c index 72224813324..7043d0716b3 100644 --- a/sys/arch/amd64/stand/libsa/memprobe.c +++ b/sys/arch/amd64/stand/libsa/memprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memprobe.c,v 1.7 2010/07/02 00:36:52 weingart Exp $ */ +/* $OpenBSD: memprobe.c,v 1.8 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -221,14 +221,14 @@ addrprobe(u_int kloc) { __volatile u_int *loc; register u_int i, ret = 0; - u_int save[NENTS(addrprobe_pat)]; + u_int save[nitems(addrprobe_pat)]; /* Get location */ loc = (int *)(kloc * 1024); save[0] = *loc; /* Probe address */ - for(i = 0; i < NENTS(addrprobe_pat); i++){ + for(i = 0; i < nitems(addrprobe_pat); i++){ *loc = addrprobe_pat[i]; if(*loc != addrprobe_pat[i]) ret++; @@ -237,13 +237,13 @@ addrprobe(u_int kloc) if (!ret) { /* Write address */ - for(i = 0; i < NENTS(addrprobe_pat); i++) { + for(i = 0; i < nitems(addrprobe_pat); i++) { save[i] = loc[i]; loc[i] = addrprobe_pat[i]; } /* Read address */ - for(i = 0; i < NENTS(addrprobe_pat); i++) { + for(i = 0; i < nitems(addrprobe_pat); i++) { if(loc[i] != addrprobe_pat[i]) ret++; loc[i] = save[i]; diff --git a/sys/arch/amd64/stand/pxeboot/conf.c b/sys/arch/amd64/stand/pxeboot/conf.c index f5e6e7a4957..24e62ad883a 100644 --- a/sys/arch/amd64/stand/pxeboot/conf.c +++ b/sys/arch/amd64/stand/pxeboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.19 2010/08/11 14:18:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.20 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -65,17 +65,17 @@ void (*i386_probe3[])(void) = { }; struct i386_boot_probes probe_list[] = { - { "probing", i386_probe1, NENTS(i386_probe1) }, - { "disk", i386_probe2, NENTS(i386_probe2) }, - { "net", i386_probe3, NENTS(i386_probe3) }, + { "probing", i386_probe1, nitems(i386_probe1) }, + { "disk", i386_probe2, nitems(i386_probe2) }, + { "net", i386_probe3, nitems(i386_probe3) }, }; -int nibprobes = NENTS(probe_list); +int nibprobes = nitems(probe_list); /* This next list must match file_system[]. */ char *fs_name[] = { NULL, "tftp", "nfs" }; -int nfsname = NENTS(fs_name); +int nfsname = nitems(fs_name); struct fs_ops file_system[] = { { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, @@ -95,7 +95,7 @@ struct fs_ops file_system[] = { null_stat, null_readdir } #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { #ifdef _TEST @@ -104,7 +104,7 @@ struct devsw devsw[] = { { "BIOS", biosstrategy, biosopen, biosclose, biosioctl }, #endif }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct devsw netsw[] = { { "net", net_strategy, net_open, net_close, net_ioctl }, @@ -112,7 +112,7 @@ struct devsw netsw[] = { struct netif_driver *netif_drivers[] = { }; -int n_netif_drivers = NENTS(netif_drivers); +int n_netif_drivers = nitems(netif_drivers); struct consdev constab[] = { #ifdef _TEST diff --git a/sys/arch/amd64/stand/pxeboot/devopen.c b/sys/arch/amd64/stand/pxeboot/devopen.c index f6ba14639ac..9e4e51706a9 100644 --- a/sys/arch/amd64/stand/pxeboot/devopen.c +++ b/sys/arch/amd64/stand/pxeboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.4 2007/07/27 17:48:01 tom Exp $ */ +/* $OpenBSD: devopen.c,v 1.5 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -45,13 +45,13 @@ const char bdevs[][4] = { "wd", "", "fd", "", "sd", "st", "cd", "mcd", "", "", "", "", "", "", "", "scd", "", "hd", "" }; -const int nbdevs = NENTS(bdevs); +const int nbdevs = nitems(bdevs); const char cdevs[][4] = { "cn", "", "", "", "", "", "", "", "com", "", "", "", "pc" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); /* pass dev_t to the open routines */ int diff --git a/sys/arch/armish/stand/boot/conf.c b/sys/arch/armish/stand/boot/conf.c index e597cc4c890..65f7f1aaf84 100644 --- a/sys/arch/armish/stand/boot/conf.c +++ b/sys/arch/armish/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.4 2008/04/19 23:20:22 weingart Exp $ */ +/* $OpenBSD: conf.c,v 1.5 2010/12/06 18:44:49 jasper Exp $ */ /* $NetBSD: conf.c,v 1.4 2005/12/11 12:17:06 christos Exp $ */ /* @@ -48,7 +48,7 @@ int debug = 0; struct devsw devsw[] = { { "wd", wdstrategy, wdopen, wdclose, noioctl }, }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); /* * Filesystem configuration @@ -57,7 +57,7 @@ struct fs_ops file_system[] = { { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat, ufs_readdir } }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); /* * Console configuration diff --git a/sys/arch/armish/stand/boot/dev_armish.c b/sys/arch/armish/stand/boot/dev_armish.c index 40e0293f07a..860b9ad2d62 100644 --- a/sys/arch/armish/stand/boot/dev_armish.c +++ b/sys/arch/armish/stand/boot/dev_armish.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_armish.c,v 1.1 2006/07/29 15:01:49 kettenis Exp $ */ +/* $OpenBSD: dev_armish.c,v 1.2 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2006 Mark Kettenis @@ -25,7 +25,7 @@ const char cdevs[][4] = { "cn", "", "", "", "", "", "", "", "", "", "", "", "com" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); void devboot(dev_t dev, char *p) diff --git a/sys/arch/hp300/stand/common/if_le.c b/sys/arch/hp300/stand/common/if_le.c index 92c6499748f..402917bbc98 100644 --- a/sys/arch/hp300/stand/common/if_le.c +++ b/sys/arch/hp300/stand/common/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.6 2010/08/07 03:50:01 krw Exp $ */; +/* $OpenBSD: if_le.c,v 1.7 2010/12/06 18:44:49 jasper Exp $ */; /* $NetBSD: if_le.c,v 1.9 1997/01/30 10:32:54 thorpej Exp $ */ /* @@ -80,10 +80,10 @@ extern struct netif_stats le_stats[]; struct netif_dif le_ifs[] = { /* dif_unit dif_nsel dif_stats dif_private */ -{ 0, NENTS(le0conf), &le_stats[0], le0conf, }, +{ 0, nitems(le0conf),&le_stats[0], le0conf, }, }; -struct netif_stats le_stats[NENTS(le_ifs)]; +struct netif_stats le_stats[nitems(le_ifs)]; struct netif_driver le_driver = { "le", /* netif_bname */ @@ -94,7 +94,7 @@ struct netif_driver le_driver = { le_put, /* netif_put */ le_end, /* netif_end */ le_ifs, /* netif_ifs */ - NENTS(le_ifs) /* netif_nifs */ + nitems(le_ifs) /* netif_nifs */ }; struct le_softc { diff --git a/sys/arch/hppa/stand/boot/conf.c b/sys/arch/hppa/stand/boot/conf.c index b37e6b61f79..e98425e5575 100644 --- a/sys/arch/hppa/stand/boot/conf.c +++ b/sys/arch/hppa/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.22 2008/04/19 23:20:22 weingart Exp $ */ +/* $OpenBSD: conf.c,v 1.23 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -43,14 +43,14 @@ struct fs_ops file_system[] = { { lif_open, lif_close, lif_read, lif_write, lif_seek, lif_stat, lif_readdir }, }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "dk", iodcstrategy, dkopen, dkclose, noioctl }, { "ct", iodcstrategy, ctopen, ctclose, noioctl }, { "lf", iodcstrategy, lfopen, lfclose, noioctl } }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct consdev constab[] = { { ite_probe, ite_init, ite_getc, ite_putc }, diff --git a/sys/arch/hppa/stand/cdboot/cdboot.c b/sys/arch/hppa/stand/cdboot/cdboot.c index 47715f6c8ef..4780419ee60 100644 --- a/sys/arch/hppa/stand/cdboot/cdboot.c +++ b/sys/arch/hppa/stand/cdboot/cdboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdboot.c,v 1.7 2004/06/14 00:32:31 deraadt Exp $ */ +/* $OpenBSD: cdboot.c,v 1.8 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2003 Michael Shalayeff @@ -46,12 +46,12 @@ struct fs_ops file_system[] = { { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, cd9660_stat, cd9660_readdir }, }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "dk", iodcstrategy, dkopen, dkclose, noioctl }, }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct consdev constab[] = { { ite_probe, ite_init, ite_getc, ite_putc }, diff --git a/sys/arch/hppa/stand/libsa/cmd_hppa.c b/sys/arch/hppa/stand/libsa/cmd_hppa.c index ff7c4e19454..cc8f7255d8a 100644 --- a/sys/arch/hppa/stand/libsa/cmd_hppa.c +++ b/sys/arch/hppa/stand/libsa/cmd_hppa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_hppa.c,v 1.9 2009/08/30 19:30:50 miod Exp $ */ +/* $OpenBSD: cmd_hppa.c,v 1.10 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2002, 2009 Miodrag Vallat @@ -331,13 +331,13 @@ set_serial(console, port, arg) speed = 0; if (arg == NULL || *arg == '\0') { - for (i = 0; i < NENTS(i_speeds); i++) + for (i = 0; i < nitems(i_speeds); i++) if (i_speeds[i] == 9600) { speed = i; break; } } else { - for (i = 0; i < NENTS(c_speeds); i++) + for (i = 0; i < nitems(c_speeds); i++) if (strcmp(arg, c_speeds[i]) == 0) { speed = i; break; diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c index ea9fc25709e..f9c36fe3144 100644 --- a/sys/arch/hppa/stand/libsa/dev_hppa.c +++ b/sys/arch/hppa/stand/libsa/dev_hppa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_hppa.c,v 1.11 2005/04/25 21:08:18 miod Exp $ */ +/* $OpenBSD: dev_hppa.c,v 1.12 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -42,7 +42,7 @@ const char cdevs[][4] = { "ite", "", "", "", "", "", "", "", "", "", "", "", "" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); const struct pdc_devs { char name[3]; @@ -78,11 +78,11 @@ devopen(f, fname, file) printf("devopen: "); #endif - for (dp = pdc_devs; dp < &pdc_devs[NENTS(pdc_devs)]; dp++) + for (dp = pdc_devs; dp < &pdc_devs[nitems(pdc_devs)]; dp++) if (!strncmp(fname, dp->name, sizeof(dp->name)-1)) break; - if (dp >= &pdc_devs[NENTS(pdc_devs)] || dp->dev_type < 0) + if (dp >= &pdc_devs[nitems(pdc_devs)] || dp->dev_type < 0) return ENODEV; #ifdef DEBUGBUG if (debug) diff --git a/sys/arch/hppa64/stand/boot/conf.c b/sys/arch/hppa64/stand/boot/conf.c index 2dfb1fced8f..29f196a4ff7 100644 --- a/sys/arch/hppa64/stand/boot/conf.c +++ b/sys/arch/hppa64/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.2 2008/04/19 23:20:22 weingart Exp $ */ +/* $OpenBSD: conf.c,v 1.3 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -34,14 +34,14 @@ struct fs_ops file_system[] = { { lif_open, lif_close, lif_read, lif_write, lif_seek, lif_stat, lif_readdir }, }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "dk", iodcstrategy, dkopen, dkclose, noioctl }, { "ct", iodcstrategy, ctopen, ctclose, noioctl }, { "lf", iodcstrategy, lfopen, lfclose, noioctl } }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct consdev constab[] = { { ite_probe, ite_init, ite_getc, ite_putc }, diff --git a/sys/arch/hppa64/stand/cdboot/cdboot.c b/sys/arch/hppa64/stand/cdboot/cdboot.c index 2ceb33315df..82fcb5abae9 100644 --- a/sys/arch/hppa64/stand/cdboot/cdboot.c +++ b/sys/arch/hppa64/stand/cdboot/cdboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdboot.c,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ +/* $OpenBSD: cdboot.c,v 1.2 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -37,12 +37,12 @@ struct fs_ops file_system[] = { { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, cd9660_stat, cd9660_readdir }, }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "dk", iodcstrategy, dkopen, dkclose, noioctl }, }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct consdev constab[] = { { ite_probe, ite_init, ite_getc, ite_putc }, diff --git a/sys/arch/hppa64/stand/libsa/cmd_hppa64.c b/sys/arch/hppa64/stand/libsa/cmd_hppa64.c index 1aa6117cb07..d782f5945ff 100644 --- a/sys/arch/hppa64/stand/libsa/cmd_hppa64.c +++ b/sys/arch/hppa64/stand/libsa/cmd_hppa64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_hppa64.c,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ +/* $OpenBSD: cmd_hppa64.c,v 1.2 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2002 Miodrag Vallat @@ -337,13 +337,13 @@ set_serial(console, port, arg) speed = 0; if (arg == NULL || *arg == '\0') { - for (i = 0; i < NENTS(i_speeds); i++) + for (i = 0; i < nitems(i_speeds); i++) if (i_speeds[i] == 9600) { speed = i; break; } } else { - for (i = 0; i < NENTS(c_speeds); i++) + for (i = 0; i < nitems(c_speeds); i++) if (strcmp(arg, c_speeds[i]) == 0) { speed = i; break; diff --git a/sys/arch/hppa64/stand/libsa/dev_hppa64.c b/sys/arch/hppa64/stand/libsa/dev_hppa64.c index d081d5dfe12..74d6f51f5e7 100644 --- a/sys/arch/hppa64/stand/libsa/dev_hppa64.c +++ b/sys/arch/hppa64/stand/libsa/dev_hppa64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_hppa64.c,v 1.2 2005/05/29 18:53:54 miod Exp $ */ +/* $OpenBSD: dev_hppa64.c,v 1.3 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -33,7 +33,7 @@ const char cdevs[][4] = { "ite", "", "", "", "", "", "", "", "", "", "", "", "" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); const struct pdc_devs { char name[3]; @@ -69,11 +69,11 @@ devopen(f, fname, file) printf("devopen: "); #endif - for (dp = pdc_devs; dp < &pdc_devs[NENTS(pdc_devs)]; dp++) + for (dp = pdc_devs; dp < &pdc_devs[nitems(pdc_devs)]; dp++) if (!strncmp(fname, dp->name, sizeof(dp->name)-1)) break; - if (dp >= &pdc_devs[NENTS(pdc_devs)] || dp->dev_type < 0) + if (dp >= &pdc_devs[nitems(pdc_devs)] || dp->dev_type < 0) return ENODEV; #ifdef DEBUGBUG if (debug) diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c index 9a0b970cef9..97ecb428a85 100644 --- a/sys/arch/i386/stand/boot/conf.c +++ b/sys/arch/i386/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.41 2010/08/11 14:18:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.42 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -58,10 +58,10 @@ void (*i386_probe2[])(void) = { }; struct i386_boot_probes probe_list[] = { - { "probing", i386_probe1, NENTS(i386_probe1) }, - { "disk", i386_probe2, NENTS(i386_probe2) } + { "probing", i386_probe1, nitems(i386_probe1) }, + { "disk", i386_probe2, nitems(i386_probe2) } }; -int nibprobes = NENTS(probe_list); +int nibprobes = nitems(probe_list); struct fs_ops file_system[] = { @@ -80,7 +80,7 @@ struct fs_ops file_system[] = { null_stat, null_readdir } #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { #ifdef _TEST @@ -92,13 +92,13 @@ struct devsw devsw[] = { { "TFTP", tftpstrategy, tftpopen, tftpclose, tftpioctl }, #endif }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); #ifdef notdef struct netif_driver *netif_drivers[] = { NULL }; -int n_netif_drivers = NENTS(netif_drivers); +int n_netif_drivers = nitems(netif_drivers); #endif struct consdev constab[] = { diff --git a/sys/arch/i386/stand/cdboot/conf.c b/sys/arch/i386/stand/cdboot/conf.c index 29cfb25c204..cf0261990fb 100644 --- a/sys/arch/i386/stand/cdboot/conf.c +++ b/sys/arch/i386/stand/cdboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.13 2010/08/11 14:18:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.14 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -61,10 +61,10 @@ void (*i386_probe2[])(void) = { }; struct i386_boot_probes probe_list[] = { - { "probing", i386_probe1, NENTS(i386_probe1) }, - { "disk", i386_probe2, NENTS(i386_probe2) }, + { "probing", i386_probe1, nitems(i386_probe1) }, + { "disk", i386_probe2, nitems(i386_probe2) }, }; -int nibprobes = NENTS(probe_list); +int nibprobes = nitems(probe_list); struct fs_ops file_system[] = { { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, @@ -84,7 +84,7 @@ struct fs_ops file_system[] = { null_stat, null_readdir } #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { #ifdef _TEST @@ -93,7 +93,7 @@ struct devsw devsw[] = { { "BIOS", biosstrategy, biosopen, biosclose, biosioctl }, #endif }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct consdev constab[] = { #ifdef _TEST diff --git a/sys/arch/i386/stand/libsa/debug.c b/sys/arch/i386/stand/libsa/debug.c index 23472281b0d..ae196e01008 100644 --- a/sys/arch/i386/stand/libsa/debug.c +++ b/sys/arch/i386/stand/libsa/debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: debug.c,v 1.13 2004/03/09 19:12:12 tom Exp $ */ +/* $OpenBSD: debug.c,v 1.14 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -34,7 +34,7 @@ #define VBASE (0xb8000) char *const reg_names[] = { REG_NAMES }; -const int nreg = NENTS(reg_names); +const int nreg = nitems(reg_names); struct reg reg; u_int32_t *const reg_values[] = { REG_VALUES(reg) }; char *const trap_names[] = { TRAP_NAMES }; diff --git a/sys/arch/i386/stand/libsa/dev_i386.c b/sys/arch/i386/stand/libsa/dev_i386.c index d2ec3f7945c..013b0b1e810 100644 --- a/sys/arch/i386/stand/libsa/dev_i386.c +++ b/sys/arch/i386/stand/libsa/dev_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_i386.c,v 1.30 2007/06/27 20:29:37 mk Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.31 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -38,13 +38,13 @@ const char bdevs[][4] = { "wd", "", "fd", "", "sd", "st", "cd", "mcd", "", "", "", "", "", "", "", "scd", "", "hd", "" }; -const int nbdevs = NENTS(bdevs); +const int nbdevs = nitems(bdevs); const char cdevs[][4] = { "cn", "", "", "", "", "", "", "", "com", "", "", "", "pc" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); /* pass dev_t to the open routines */ int diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c index 063f048e440..ca75a405ae6 100644 --- a/sys/arch/i386/stand/libsa/memprobe.c +++ b/sys/arch/i386/stand/libsa/memprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memprobe.c,v 1.47 2010/07/02 00:36:52 weingart Exp $ */ +/* $OpenBSD: memprobe.c,v 1.48 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -224,14 +224,14 @@ addrprobe(u_int kloc) { __volatile u_int *loc; register u_int i, ret = 0; - u_int save[NENTS(addrprobe_pat)]; + u_int save[nitems(addrprobe_pat)]; /* Get location */ loc = (int *)(kloc * 1024); save[0] = *loc; /* Probe address */ - for (i = 0; i < NENTS(addrprobe_pat); i++) { + for (i = 0; i < nitems(addrprobe_pat); i++) { *loc = addrprobe_pat[i]; if (*loc != addrprobe_pat[i]) ret++; @@ -240,13 +240,13 @@ addrprobe(u_int kloc) if (!ret) { /* Write address */ - for (i = 0; i < NENTS(addrprobe_pat); i++) { + for (i = 0; i < nitems(addrprobe_pat); i++) { save[i] = loc[i]; loc[i] = addrprobe_pat[i]; } /* Read address */ - for (i = 0; i < NENTS(addrprobe_pat); i++) { + for (i = 0; i < nitems(addrprobe_pat); i++) { if (loc[i] != addrprobe_pat[i]) ret++; loc[i] = save[i]; diff --git a/sys/arch/i386/stand/pxeboot/conf.c b/sys/arch/i386/stand/pxeboot/conf.c index 82c90624387..672e897e303 100644 --- a/sys/arch/i386/stand/pxeboot/conf.c +++ b/sys/arch/i386/stand/pxeboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.18 2010/08/11 14:18:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.19 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -67,17 +67,17 @@ void (*i386_probe3[])(void) = { }; struct i386_boot_probes probe_list[] = { - { "probing", i386_probe1, NENTS(i386_probe1) }, - { "disk", i386_probe2, NENTS(i386_probe2) }, - { "net", i386_probe3, NENTS(i386_probe3) }, + { "probing", i386_probe1, nitems(i386_probe1) }, + { "disk", i386_probe2, nitems(i386_probe2) }, + { "net", i386_probe3, nitems(i386_probe3) }, }; -int nibprobes = NENTS(probe_list); +int nibprobes = nitems(probe_list); /* This next list must match file_system[]. */ char *fs_name[] = { NULL, "tftp", "nfs" }; -int nfsname = NENTS(fs_name); +int nfsname = nitems(fs_name); struct fs_ops file_system[] = { { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, @@ -97,7 +97,7 @@ struct fs_ops file_system[] = { null_stat, null_readdir } #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { #ifdef _TEST @@ -106,7 +106,7 @@ struct devsw devsw[] = { { "BIOS", biosstrategy, biosopen, biosclose, biosioctl }, #endif }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); struct devsw netsw[] = { { "net", net_strategy, net_open, net_close, net_ioctl }, @@ -114,7 +114,7 @@ struct devsw netsw[] = { struct netif_driver *netif_drivers[] = { }; -int n_netif_drivers = NENTS(netif_drivers); +int n_netif_drivers = nitems(netif_drivers); struct consdev constab[] = { #ifdef _TEST diff --git a/sys/arch/i386/stand/pxeboot/devopen.c b/sys/arch/i386/stand/pxeboot/devopen.c index 836329474f1..9e4e51706a9 100644 --- a/sys/arch/i386/stand/pxeboot/devopen.c +++ b/sys/arch/i386/stand/pxeboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.4 2007/07/27 17:46:57 tom Exp $ */ +/* $OpenBSD: devopen.c,v 1.5 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -45,13 +45,13 @@ const char bdevs[][4] = { "wd", "", "fd", "", "sd", "st", "cd", "mcd", "", "", "", "", "", "", "", "scd", "", "hd", "" }; -const int nbdevs = NENTS(bdevs); +const int nbdevs = nitems(bdevs); const char cdevs[][4] = { "cn", "", "", "", "", "", "", "", "com", "", "", "", "pc" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); /* pass dev_t to the open routines */ int diff --git a/sys/arch/landisk/stand/boot/conf.c b/sys/arch/landisk/stand/boot/conf.c index e890db05245..13845460097 100644 --- a/sys/arch/landisk/stand/boot/conf.c +++ b/sys/arch/landisk/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.3 2008/04/19 23:20:22 weingart Exp $ */ +/* $OpenBSD: conf.c,v 1.4 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -44,9 +44,9 @@ struct fs_ops file_system[] = { cd9660_stat, cd9660_readdir }, #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "dk", blkdevstrategy, blkdevopen, blkdevclose, noioctl }, }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); diff --git a/sys/arch/landisk/stand/xxboot/boot1.c b/sys/arch/landisk/stand/xxboot/boot1.c index a2ca3d8e244..fb9b746294b 100644 --- a/sys/arch/landisk/stand/xxboot/boot1.c +++ b/sys/arch/landisk/stand/xxboot/boot1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot1.c,v 1.2 2008/06/26 05:42:11 ray Exp $ */ +/* $OpenBSD: boot1.c,v 1.3 2010/12/06 18:44:49 jasper Exp $ */ /* $NetBSD: boot1.c,v 1.1 2006/09/01 21:26:19 uwe Exp $ */ /*- @@ -55,12 +55,12 @@ struct fs_ops file_system[] = { { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat, ufs_readdir }, }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "dk", blkdevstrategy, blkdevopen, blkdevclose, noioctl }, }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); const char * boot1(uint32_t *sector) diff --git a/sys/arch/loongson/stand/boot/conf.c b/sys/arch/loongson/stand/boot/conf.c index 0797d24b9f8..aed5f03fe4a 100644 --- a/sys/arch/loongson/stand/boot/conf.c +++ b/sys/arch/loongson/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.4 2010/04/03 19:13:27 miod Exp $ */ +/* $OpenBSD: conf.c,v 1.5 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -53,7 +53,7 @@ struct devsw devsw[] = { /* ATA storage device */ { "wd", pmon_iostrategy, pmon_ioopen, pmon_ioclose, noioctl } }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); /* * Filesystem configuration @@ -69,7 +69,7 @@ struct fs_ops file_system[] = { { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, cd9660_stat, cd9660_readdir } }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); /* * Console configuration diff --git a/sys/arch/socppc/stand/boot/conf.c b/sys/arch/socppc/stand/boot/conf.c index 03a11cfeb7c..75226b9c5ea 100644 --- a/sys/arch/socppc/stand/boot/conf.c +++ b/sys/arch/socppc/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.5 2010/02/14 15:16:49 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.6 2010/12/06 18:44:49 jasper Exp $ */ /* $NetBSD: conf.c,v 1.4 2005/12/11 12:17:06 christos Exp $ */ /* @@ -48,7 +48,7 @@ int debug = 0; struct devsw devsw[] = { { "wd", wdstrategy, wdopen, wdclose, noioctl }, }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); /* * Filesystem configuration @@ -57,7 +57,7 @@ struct fs_ops file_system[] = { { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat, ufs_readdir } }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); /* * Console configuration diff --git a/sys/arch/socppc/stand/boot/dev_socppc.c b/sys/arch/socppc/stand/boot/dev_socppc.c index 9fa311e57f7..204fa315022 100644 --- a/sys/arch/socppc/stand/boot/dev_socppc.c +++ b/sys/arch/socppc/stand/boot/dev_socppc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_socppc.c,v 1.1 2008/05/10 20:06:26 kettenis Exp $ */ +/* $OpenBSD: dev_socppc.c,v 1.2 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -25,7 +25,7 @@ const char cdevs[][4] = { "cn", "", "", "", "", "", "", "", "", "", "", "", "com" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); void devboot(dev_t dev, char *p) diff --git a/sys/arch/zaurus/stand/zboot/conf.c b/sys/arch/zaurus/stand/zboot/conf.c index 0793eef266f..b605577ac2c 100644 --- a/sys/arch/zaurus/stand/zboot/conf.c +++ b/sys/arch/zaurus/stand/zboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.4 2005/05/24 20:38:20 uwe Exp $ */ +/* $OpenBSD: conf.c,v 1.5 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -52,10 +52,10 @@ void (*zaurus_probe2[])(void) = { }; struct zaurus_boot_probes probe_list[] = { - { "probing", zaurus_probe1, NENTS(zaurus_probe1) }, - { "disk", zaurus_probe2, NENTS(zaurus_probe2) } + { "probing", zaurus_probe1, nitems(zaurus_probe1) }, + { "disk", zaurus_probe2, nitems(zaurus_probe2) } }; -int nibprobes = NENTS(probe_list); +int nibprobes = nitems(probe_list); void (*sa_cleanup)(void) = NULL; @@ -76,7 +76,7 @@ struct fs_ops file_system[] = { null_stat, null_readdir } #endif }; -int nfsys = NENTS(file_system); +int nfsys = nitems(file_system); struct devsw devsw[] = { { "UNIX", unixstrategy, unixopen, unixclose, unixioctl }, @@ -84,13 +84,13 @@ struct devsw devsw[] = { { "TFTP", tftpstrategy, tftpopen, tftpclose, tftpioctl }, #endif }; -int ndevs = NENTS(devsw); +int ndevs = nitems(devsw); #ifdef notdef struct netif_driver *netif_drivers[] = { NULL }; -int n_netif_drivers = NENTS(netif_drivers); +int n_netif_drivers = nitems(netif_drivers); #endif struct consdev constab[] = { diff --git a/sys/arch/zaurus/stand/zboot/devopen.c b/sys/arch/zaurus/stand/zboot/devopen.c index a195e469dce..24b22d4828f 100644 --- a/sys/arch/zaurus/stand/zboot/devopen.c +++ b/sys/arch/zaurus/stand/zboot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.6 2007/06/27 20:29:38 mk Exp $ */ +/* $OpenBSD: devopen.c,v 1.7 2010/12/06 18:44:49 jasper Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -38,13 +38,13 @@ const char bdevs[][4] = { "", "", "", "", "", "", "", "scd", "", "hd", "" }; -const int nbdevs = NENTS(bdevs); +const int nbdevs = nitems(bdevs); const char cdevs[][4] = { "cn", "", "", "", "", "", "", "", "", "", "", "", "com" }; -const int ncdevs = NENTS(cdevs); +const int ncdevs = nitems(cdevs); /* pass dev_t to the open routines */ int diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 4a1882c9e94..f3488ca71e2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.191 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.192 2010/12/06 18:44:49 jasper Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -2185,10 +2185,9 @@ vfs_vnode_print(void *v, int full, int (*pr)(const char *, ...)) { struct vnode *vp = v; -#define NENTS(n) (sizeof n / sizeof(n[0])) (*pr)("tag %s(%d) type %s(%d) mount %p typedata %p\n", - vp->v_tag > NENTS(vtags)? "<unk>":vtags[vp->v_tag], vp->v_tag, - vp->v_type > NENTS(vtypes)? "<unk>":vtypes[vp->v_type], + vp->v_tag > nitems(vtags)? "<unk>":vtags[vp->v_tag], vp->v_tag, + vp->v_type > nitems(vtypes)? "<unk>":vtypes[vp->v_type], vp->v_type, vp->v_mount, vp->v_mountedhere); (*pr)("data %p usecount %d writecount %ld holdcnt %ld numoutput %d\n", diff --git a/sys/lib/libsa/stand.h b/sys/lib/libsa/stand.h index fc4a518c00b..3739d911a01 100644 --- a/sys/lib/libsa/stand.h +++ b/sys/lib/libsa/stand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stand.h,v 1.47 2010/05/09 15:30:28 jsg Exp $ */ +/* $OpenBSD: stand.h,v 1.48 2010/12/06 18:44:49 jasper Exp $ */ /* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */ /*- @@ -48,7 +48,6 @@ struct open_file; /* * Useful macros */ -#define NENTS(x) sizeof(x)/sizeof(x[0]) /* don't define if libkern included */ #ifndef LIBKERN_INLINE #define max(a,b) (((a)>(b))? (a) : (b)) |