This diff drops another nitems() copy we have in tree, NENTS().
Compile tested on amd64, no binary change.
OK?
--
Cheers,
Jasper
"During times of universal deceit,
telling the truth becomes a revolutionary act."
Index: arch/alpha/stand/netboot/if_prom.c
===================================================================
RCS file: /cvs/src/sys/arch/alpha/stand/netboot/if_prom.c,v
retrieving revision 1.4
diff -p -u -r1.4 if_prom.c
--- arch/alpha/stand/netboot/if_prom.c 9 Mar 2008 12:03:03 -0000 1.4
+++ arch/alpha/stand/netboot/if_prom.c 6 Dec 2010 18:00:02 -0000
@@ -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;
Index: arch/amd64/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/boot/conf.c,v
retrieving revision 1.15
diff -p -u -r1.15 conf.c
--- arch/amd64/stand/boot/conf.c 11 Aug 2010 14:18:52 -0000 1.15
+++ arch/amd64/stand/boot/conf.c 6 Dec 2010 18:00:02 -0000
@@ -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 },
Index: arch/amd64/stand/cdboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/cdboot/conf.c,v
retrieving revision 1.15
diff -p -u -r1.15 conf.c
--- arch/amd64/stand/cdboot/conf.c 11 Aug 2010 14:18:52 -0000 1.15
+++ arch/amd64/stand/cdboot/conf.c 6 Dec 2010 18:00:02 -0000
@@ -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 },
Index: arch/amd64/stand/libsa/dev_i386.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/dev_i386.c,v
retrieving revision 1.3
diff -p -u -r1.3 dev_i386.c
--- arch/amd64/stand/libsa/dev_i386.c 27 Jun 2007 20:29:37 -0000 1.3
+++ arch/amd64/stand/libsa/dev_i386.c 6 Dec 2010 18:00:02 -0000
@@ -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
Index: arch/amd64/stand/libsa/memprobe.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/memprobe.c,v
retrieving revision 1.7
diff -p -u -r1.7 memprobe.c
--- arch/amd64/stand/libsa/memprobe.c 2 Jul 2010 00:36:52 -0000 1.7
+++ arch/amd64/stand/libsa/memprobe.c 6 Dec 2010 18:00:03 -0000
@@ -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];
Index: arch/amd64/stand/pxeboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/pxeboot/conf.c,v
retrieving revision 1.19
diff -p -u -r1.19 conf.c
--- arch/amd64/stand/pxeboot/conf.c 11 Aug 2010 14:18:52 -0000 1.19
+++ arch/amd64/stand/pxeboot/conf.c 6 Dec 2010 18:00:03 -0000
@@ -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
Index: arch/amd64/stand/pxeboot/devopen.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/pxeboot/devopen.c,v
retrieving revision 1.4
diff -p -u -r1.4 devopen.c
--- arch/amd64/stand/pxeboot/devopen.c 27 Jul 2007 17:48:01 -0000 1.4
+++ arch/amd64/stand/pxeboot/devopen.c 6 Dec 2010 18:00:03 -0000
@@ -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
Index: arch/armish/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/armish/stand/boot/conf.c,v
retrieving revision 1.4
diff -p -u -r1.4 conf.c
--- arch/armish/stand/boot/conf.c 19 Apr 2008 23:20:22 -0000 1.4
+++ arch/armish/stand/boot/conf.c 6 Dec 2010 18:00:03 -0000
@@ -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
Index: arch/armish/stand/boot/dev_armish.c
===================================================================
RCS file: /cvs/src/sys/arch/armish/stand/boot/dev_armish.c,v
retrieving revision 1.1
diff -p -u -r1.1 dev_armish.c
--- arch/armish/stand/boot/dev_armish.c 29 Jul 2006 15:01:49 -0000 1.1
+++ arch/armish/stand/boot/dev_armish.c 6 Dec 2010 18:00:03 -0000
@@ -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)
Index: arch/hp300/stand/common/if_le.c
===================================================================
RCS file: /cvs/src/sys/arch/hp300/stand/common/if_le.c,v
retrieving revision 1.6
diff -p -u -r1.6 if_le.c
--- arch/hp300/stand/common/if_le.c 7 Aug 2010 03:50:01 -0000 1.6
+++ arch/hp300/stand/common/if_le.c 6 Dec 2010 18:00:04 -0000
@@ -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 {
Index: arch/hppa/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/stand/boot/conf.c,v
retrieving revision 1.22
diff -p -u -r1.22 conf.c
--- arch/hppa/stand/boot/conf.c 19 Apr 2008 23:20:22 -0000 1.22
+++ arch/hppa/stand/boot/conf.c 6 Dec 2010 18:00:04 -0000
@@ -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 },
Index: arch/hppa/stand/cdboot/cdboot.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/stand/cdboot/cdboot.c,v
retrieving revision 1.7
diff -p -u -r1.7 cdboot.c
--- arch/hppa/stand/cdboot/cdboot.c 14 Jun 2004 00:32:31 -0000 1.7
+++ arch/hppa/stand/cdboot/cdboot.c 6 Dec 2010 18:00:04 -0000
@@ -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 },
Index: arch/hppa/stand/libsa/cmd_hppa.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/stand/libsa/cmd_hppa.c,v
retrieving revision 1.9
diff -p -u -r1.9 cmd_hppa.c
--- arch/hppa/stand/libsa/cmd_hppa.c 30 Aug 2009 19:30:50 -0000 1.9
+++ arch/hppa/stand/libsa/cmd_hppa.c 6 Dec 2010 18:00:05 -0000
@@ -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;
Index: arch/hppa/stand/libsa/dev_hppa.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/stand/libsa/dev_hppa.c,v
retrieving revision 1.11
diff -p -u -r1.11 dev_hppa.c
--- arch/hppa/stand/libsa/dev_hppa.c 25 Apr 2005 21:08:18 -0000 1.11
+++ arch/hppa/stand/libsa/dev_hppa.c 6 Dec 2010 18:00:05 -0000
@@ -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)
Index: arch/hppa64/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa64/stand/boot/conf.c,v
retrieving revision 1.2
diff -p -u -r1.2 conf.c
--- arch/hppa64/stand/boot/conf.c 19 Apr 2008 23:20:22 -0000 1.2
+++ arch/hppa64/stand/boot/conf.c 6 Dec 2010 18:00:05 -0000
@@ -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 },
Index: arch/hppa64/stand/cdboot/cdboot.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa64/stand/cdboot/cdboot.c,v
retrieving revision 1.1
diff -p -u -r1.1 cdboot.c
--- arch/hppa64/stand/cdboot/cdboot.c 1 Apr 2005 10:40:48 -0000 1.1
+++ arch/hppa64/stand/cdboot/cdboot.c 6 Dec 2010 18:00:05 -0000
@@ -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 },
Index: arch/hppa64/stand/libsa/cmd_hppa64.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa64/stand/libsa/cmd_hppa64.c,v
retrieving revision 1.1
diff -p -u -r1.1 cmd_hppa64.c
--- arch/hppa64/stand/libsa/cmd_hppa64.c 1 Apr 2005 10:40:48 -0000
1.1
+++ arch/hppa64/stand/libsa/cmd_hppa64.c 6 Dec 2010 18:00:05 -0000
@@ -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;
Index: arch/hppa64/stand/libsa/dev_hppa64.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa64/stand/libsa/dev_hppa64.c,v
retrieving revision 1.2
diff -p -u -r1.2 dev_hppa64.c
--- arch/hppa64/stand/libsa/dev_hppa64.c 29 May 2005 18:53:54 -0000
1.2
+++ arch/hppa64/stand/libsa/dev_hppa64.c 6 Dec 2010 18:00:05 -0000
@@ -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)
Index: arch/i386/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/boot/conf.c,v
retrieving revision 1.41
diff -p -u -r1.41 conf.c
--- arch/i386/stand/boot/conf.c 11 Aug 2010 14:18:52 -0000 1.41
+++ arch/i386/stand/boot/conf.c 6 Dec 2010 18:00:05 -0000
@@ -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[] = {
Index: arch/i386/stand/cdboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/cdboot/conf.c,v
retrieving revision 1.13
diff -p -u -r1.13 conf.c
--- arch/i386/stand/cdboot/conf.c 11 Aug 2010 14:18:52 -0000 1.13
+++ arch/i386/stand/cdboot/conf.c 6 Dec 2010 18:00:05 -0000
@@ -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
Index: arch/i386/stand/libsa/debug.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/debug.c,v
retrieving revision 1.13
diff -p -u -r1.13 debug.c
--- arch/i386/stand/libsa/debug.c 9 Mar 2004 19:12:12 -0000 1.13
+++ arch/i386/stand/libsa/debug.c 6 Dec 2010 18:00:06 -0000
@@ -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 };
Index: arch/i386/stand/libsa/dev_i386.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/dev_i386.c,v
retrieving revision 1.30
diff -p -u -r1.30 dev_i386.c
--- arch/i386/stand/libsa/dev_i386.c 27 Jun 2007 20:29:37 -0000 1.30
+++ arch/i386/stand/libsa/dev_i386.c 6 Dec 2010 18:00:06 -0000
@@ -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
Index: arch/i386/stand/libsa/memprobe.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/memprobe.c,v
retrieving revision 1.47
diff -p -u -r1.47 memprobe.c
--- arch/i386/stand/libsa/memprobe.c 2 Jul 2010 00:36:52 -0000 1.47
+++ arch/i386/stand/libsa/memprobe.c 6 Dec 2010 18:00:06 -0000
@@ -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];
Index: arch/i386/stand/pxeboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/pxeboot/conf.c,v
retrieving revision 1.18
diff -p -u -r1.18 conf.c
--- arch/i386/stand/pxeboot/conf.c 11 Aug 2010 14:18:52 -0000 1.18
+++ arch/i386/stand/pxeboot/conf.c 6 Dec 2010 18:00:06 -0000
@@ -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
Index: arch/i386/stand/pxeboot/devopen.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/pxeboot/devopen.c,v
retrieving revision 1.4
diff -p -u -r1.4 devopen.c
--- arch/i386/stand/pxeboot/devopen.c 27 Jul 2007 17:46:57 -0000 1.4
+++ arch/i386/stand/pxeboot/devopen.c 6 Dec 2010 18:00:06 -0000
@@ -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
Index: arch/landisk/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/landisk/stand/boot/conf.c,v
retrieving revision 1.3
diff -p -u -r1.3 conf.c
--- arch/landisk/stand/boot/conf.c 19 Apr 2008 23:20:22 -0000 1.3
+++ arch/landisk/stand/boot/conf.c 6 Dec 2010 18:00:06 -0000
@@ -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);
Index: arch/landisk/stand/xxboot/boot1.c
===================================================================
RCS file: /cvs/src/sys/arch/landisk/stand/xxboot/boot1.c,v
retrieving revision 1.2
diff -p -u -r1.2 boot1.c
--- arch/landisk/stand/xxboot/boot1.c 26 Jun 2008 05:42:11 -0000 1.2
+++ arch/landisk/stand/xxboot/boot1.c 6 Dec 2010 18:00:06 -0000
@@ -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)
Index: arch/loongson/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/loongson/stand/boot/conf.c,v
retrieving revision 1.4
diff -p -u -r1.4 conf.c
--- arch/loongson/stand/boot/conf.c 3 Apr 2010 19:13:27 -0000 1.4
+++ arch/loongson/stand/boot/conf.c 6 Dec 2010 18:00:06 -0000
@@ -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
Index: arch/socppc/stand/boot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/socppc/stand/boot/conf.c,v
retrieving revision 1.5
diff -p -u -r1.5 conf.c
--- arch/socppc/stand/boot/conf.c 14 Feb 2010 15:16:49 -0000 1.5
+++ arch/socppc/stand/boot/conf.c 6 Dec 2010 18:00:07 -0000
@@ -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
Index: arch/socppc/stand/boot/dev_socppc.c
===================================================================
RCS file: /cvs/src/sys/arch/socppc/stand/boot/dev_socppc.c,v
retrieving revision 1.1
diff -p -u -r1.1 dev_socppc.c
--- arch/socppc/stand/boot/dev_socppc.c 10 May 2008 20:06:26 -0000 1.1
+++ arch/socppc/stand/boot/dev_socppc.c 6 Dec 2010 18:00:07 -0000
@@ -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)
Index: arch/zaurus/stand/zboot/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/zaurus/stand/zboot/conf.c,v
retrieving revision 1.4
diff -p -u -r1.4 conf.c
--- arch/zaurus/stand/zboot/conf.c 24 May 2005 20:38:20 -0000 1.4
+++ arch/zaurus/stand/zboot/conf.c 6 Dec 2010 18:00:07 -0000
@@ -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[] = {
Index: arch/zaurus/stand/zboot/devopen.c
===================================================================
RCS file: /cvs/src/sys/arch/zaurus/stand/zboot/devopen.c,v
retrieving revision 1.6
diff -p -u -r1.6 devopen.c
--- arch/zaurus/stand/zboot/devopen.c 27 Jun 2007 20:29:38 -0000 1.6
+++ arch/zaurus/stand/zboot/devopen.c 6 Dec 2010 18:00:07 -0000
@@ -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
Index: kern/vfs_subr.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_subr.c,v
retrieving revision 1.191
diff -p -u -r1.191 vfs_subr.c
--- kern/vfs_subr.c 10 Sep 2010 16:34:08 -0000 1.191
+++ kern/vfs_subr.c 6 Dec 2010 18:00:09 -0000
@@ -2185,10 +2185,9 @@ vfs_vnode_print(void *v, int full, int (
{
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",
Index: lib/libsa/stand.h
===================================================================
RCS file: /cvs/src/sys/lib/libsa/stand.h,v
retrieving revision 1.47
diff -p -u -r1.47 stand.h
--- lib/libsa/stand.h 9 May 2010 15:30:28 -0000 1.47
+++ lib/libsa/stand.h 6 Dec 2010 18:00:09 -0000
@@ -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))