FreeBSD/sys/geom/vinum/geom_vinum_subr.c
/* Return the type of object identified by string 'name'. */
Return the type of object identified by string 'name'.
Return the type of object identified by string ' name ' .
int
gv_object_type(struct gv_softc *sc, char *name)
{
	struct gv_drive *d;
	struct gv_plex *p;
	struct gv_sd *s;
	struct gv_volume *v;
	LIST_FOREACH(v, &sc->volumes, volume) {
		if (!strncmp(v->name, name, GV_MAXVOLNAME))
			return (GV_TYPE_VOL);
	}
	LIST_FOREACH(p, &sc->plexes, plex) {
		if (!strncmp(p->name, name, GV_MAXPLEXNAME))
			return (GV_TYPE_PLEX);
	}
	LIST_FOREACH(s, &sc->subdisks, sd) {
		if (!strncmp(s->name, name, GV_MAXSDNAME))
			return (GV_TYPE_SD);
	}
	LIST_FOREACH(d, &sc->drives, drive) {
		if (!strncmp(d->name, name, GV_MAXDRIVENAME))
			return (GV_TYPE_DRIVE);
	}
	return (GV_ERR_NOTFOUND);
}
int gv_object_type ( struct gv_softc * sc , char * name ) { struct gv_drive * d ; struct gv_plex * p ; struct gv_sd * s ; struct gv_volume * v ; LIST_FOREACH ( v , & sc -> volumes , volume ) { if ( ! strncmp ( v -> name , name , GV_MAXVOLNAME ) ) return ( GV_TYPE_VOL ) ; } LIST_FOREACH ( p , & sc -> plexes , plex ) { if ( ! strncmp ( p -> name , name , GV_MAXPLEXNAME ) ) return ( GV_TYPE_PLEX ) ; } LIST_FOREACH ( s , & sc -> subdisks , sd ) { if ( ! strncmp ( s -> name , name , GV_MAXSDNAME ) ) return ( GV_TYPE_SD ) ; } LIST_FOREACH ( d , & sc -> drives , drive ) { if ( ! strncmp ( d -> name , name , GV_MAXDRIVENAME ) ) return ( GV_TYPE_DRIVE ) ; } return ( GV_ERR_NOTFOUND ) ; }
Return the type of object identified by string 'name'.
Return the type of object identified by string ' name ' .