FreeBSD/sys/geom/mirror/g_mirror.c
/*
 * Return the number of disks in given state.
 * If state is equal to -1, count all connected disks.
 */
Return the number of disks in given state.
If state is equal to -1, count all connected disks.
Return the number of disks in given state . If state is equal to - 1 count all connected disks .
u_int
g_mirror_ndisks(struct g_mirror_softc *sc, int state)
{
	struct g_mirror_disk *disk;
	u_int n = 0;
	sx_assert(&sc->sc_lock, SX_LOCKED);
	LIST_FOREACH(disk, &sc->sc_disks, d_next) {
		if (state == -1 || disk->d_state == state)
			n++;
	}
	return (n);
}
u_int g_mirror_ndisks ( struct g_mirror_softc * sc , int state ) { struct g_mirror_disk * disk ; u_int n = 0 ; sx_assert ( & sc -> sc_lock , SX_LOCKED ) ; LIST_FOREACH ( disk , & sc -> sc_disks , d_next ) { if ( state == -1 || disk -> d_state == state ) n ++ ; } return ( n ) ; }
Return the number of disks in given state.
Return the number of disks in given state .