Lines Matching full:gp

127 	struct g_geom *gp;  in g_load_class()  local
171 LIST_FOREACH(gp, &mp2->geom, geom) { in g_load_class()
172 LIST_FOREACH(pp, &gp->provider, provider) { in g_load_class()
183 struct g_geom *gp; in g_unload_class() local
192 LIST_FOREACH(gp, &mp->geom, geom) { in g_unload_class()
194 LIST_FOREACH(pp, &gp->provider, provider) in g_unload_class()
199 LIST_FOREACH(cp, &gp->consumer, consumer) in g_unload_class()
205 if (gp->flags & G_GEOM_WITHER) { in g_unload_class()
223 LIST_FOREACH(gp, &mp->geom, geom) { in g_unload_class()
224 error = mp->destroy_geom(NULL, mp, gp); in g_unload_class()
232 gp = LIST_FIRST(&mp->geom); in g_unload_class()
233 if (gp == NULL) in g_unload_class()
235 KASSERT(gp->flags & G_GEOM_WITHER, in g_unload_class()
304 struct g_geom *gp; in g_retaste_event() local
325 LIST_FOREACH(gp, &mp2->geom, geom) { in g_retaste_event()
326 LIST_FOREACH(pp, &gp->provider, provider) { in g_retaste_event()
373 struct g_geom *gp; in g_new_geomf() local
384 gp = g_malloc(sizeof *gp, M_WAITOK | M_ZERO); in g_new_geomf()
385 gp->name = g_malloc(sbuf_len(sb) + 1, M_WAITOK | M_ZERO); in g_new_geomf()
386 gp->class = mp; in g_new_geomf()
387 gp->rank = 1; in g_new_geomf()
388 LIST_INIT(&gp->consumer); in g_new_geomf()
389 LIST_INIT(&gp->provider); in g_new_geomf()
390 LIST_INSERT_HEAD(&mp->geom, gp, geom); in g_new_geomf()
391 TAILQ_INSERT_HEAD(&geoms, gp, geoms); in g_new_geomf()
392 strcpy(gp->name, sbuf_data(sb)); in g_new_geomf()
395 gp->start = mp->start; in g_new_geomf()
396 gp->spoiled = mp->spoiled; in g_new_geomf()
397 gp->attrchanged = mp->attrchanged; in g_new_geomf()
398 gp->providergone = mp->providergone; in g_new_geomf()
399 gp->dumpconf = mp->dumpconf; in g_new_geomf()
400 gp->access = mp->access; in g_new_geomf()
401 gp->orphan = mp->orphan; in g_new_geomf()
402 gp->ioctl = mp->ioctl; in g_new_geomf()
403 gp->resize = mp->resize; in g_new_geomf()
404 return (gp); in g_new_geomf()
408 g_destroy_geom(struct g_geom *gp) in g_destroy_geom() argument
412 G_VALID_GEOM(gp); in g_destroy_geom()
413 g_trace(G_T_TOPOLOGY, "g_destroy_geom(%p(%s))", gp, gp->name); in g_destroy_geom()
414 KASSERT(LIST_EMPTY(&gp->consumer), in g_destroy_geom()
416 gp->name, LIST_FIRST(&gp->consumer))); in g_destroy_geom()
417 KASSERT(LIST_EMPTY(&gp->provider), in g_destroy_geom()
419 gp->name, LIST_FIRST(&gp->provider))); in g_destroy_geom()
420 g_cancel_event(gp); in g_destroy_geom()
421 LIST_REMOVE(gp, geom); in g_destroy_geom()
422 TAILQ_REMOVE(&geoms, gp, geoms); in g_destroy_geom()
423 g_free(gp->name); in g_destroy_geom()
424 g_free(gp); in g_destroy_geom()
431 g_wither_geom(struct g_geom *gp, int error) in g_wither_geom() argument
436 G_VALID_GEOM(gp); in g_wither_geom()
437 g_trace(G_T_TOPOLOGY, "g_wither_geom(%p(%s))", gp, gp->name); in g_wither_geom()
438 if (!(gp->flags & G_GEOM_WITHER)) { in g_wither_geom()
439 gp->flags |= G_GEOM_WITHER; in g_wither_geom()
440 LIST_FOREACH(pp, &gp->provider, provider) in g_wither_geom()
463 g_wither_geom_close(struct g_geom *gp, int error) in g_wither_geom_close() argument
468 G_VALID_GEOM(gp); in g_wither_geom_close()
469 g_trace(G_T_TOPOLOGY, "g_wither_geom_close(%p(%s))", gp, gp->name); in g_wither_geom_close()
470 LIST_FOREACH(cp, &gp->consumer, consumer) in g_wither_geom_close()
473 g_wither_geom(gp, error); in g_wither_geom_close()
484 struct g_geom *gp, *gp2; in g_wither_washer() local
490 LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) { in g_wither_washer()
491 LIST_FOREACH_SAFE(pp, &gp->provider, provider, pp2) { in g_wither_washer()
497 if (!(gp->flags & G_GEOM_WITHER)) in g_wither_washer()
499 LIST_FOREACH_SAFE(pp, &gp->provider, provider, pp2) { in g_wither_washer()
503 LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp2) { in g_wither_washer()
510 if (LIST_EMPTY(&gp->provider) && in g_wither_washer()
511 LIST_EMPTY(&gp->consumer)) in g_wither_washer()
512 g_destroy_geom(gp); in g_wither_washer()
518 g_new_consumer(struct g_geom *gp) in g_new_consumer() argument
523 G_VALID_GEOM(gp); in g_new_consumer()
524 KASSERT(!(gp->flags & G_GEOM_WITHER), in g_new_consumer()
526 gp->name, gp->class->name)); in g_new_consumer()
527 KASSERT(gp->orphan != NULL, in g_new_consumer()
529 gp->name, gp->class->name)); in g_new_consumer()
532 cp->geom = gp; in g_new_consumer()
535 LIST_INSERT_HEAD(&gp->consumer, cp, consumer); in g_new_consumer()
542 struct g_geom *gp; in g_destroy_consumer() local
552 gp = cp->geom; in g_destroy_consumer()
556 if (gp->flags & G_GEOM_WITHER) in g_destroy_consumer()
598 g_new_providerf(struct g_geom *gp, const char *fmt, ...) in g_new_providerf() argument
605 G_VALID_GEOM(gp); in g_new_providerf()
606 KASSERT(gp->access != NULL, in g_new_providerf()
608 gp->name, gp->class->name)); in g_new_providerf()
609 KASSERT(gp->start != NULL, in g_new_providerf()
611 gp->name, gp->class->name)); in g_new_providerf()
612 KASSERT(!(gp->flags & G_GEOM_WITHER), in g_new_providerf()
614 gp->name, gp->class->name)); in g_new_providerf()
627 pp->geom = gp; in g_new_providerf()
630 LIST_INSERT_HEAD(&gp->provider, pp, provider); in g_new_providerf()
631 g_post_event(g_new_provider_event, pp, M_WAITOK, pp, gp, NULL); in g_new_providerf()
679 struct g_geom *gp; in g_resize_provider_event() local
699 gp = cp->geom; in g_resize_provider_event()
700 if (gp->resize == NULL && size < pp->mediasize) { in g_resize_provider_event()
717 gp = cp->geom; in g_resize_provider_event()
718 if ((gp->flags & G_GEOM_WITHER) == 0 && gp->resize != NULL) in g_resize_provider_event()
719 gp->resize(cp); in g_resize_provider_event()
762 struct g_geom *gp; in g_provider_by_name() local
770 LIST_FOREACH(gp, &cp->geom, geom) { in g_provider_by_name()
771 LIST_FOREACH(pp, &gp->provider, provider) { in g_provider_by_name()
774 if ((gp->flags & G_GEOM_WITHER) == 0 && in g_provider_by_name()
789 struct g_geom *gp; in g_destroy_provider() local
801 gp = pp->geom; in g_destroy_provider()
807 if (gp->providergone != NULL) in g_destroy_provider()
808 gp->providergone(pp); in g_destroy_provider()
812 if ((gp->flags & G_GEOM_WITHER)) in g_destroy_provider()
834 redo_rank(struct g_geom *gp) in redo_rank() argument
841 G_VALID_GEOM(gp); in redo_rank()
844 gp1 = TAILQ_NEXT(gp, geoms); in redo_rank()
846 gp->rank = 0; in redo_rank()
847 TAILQ_REMOVE(&geoms, gp, geoms); in redo_rank()
848 TAILQ_INSERT_TAIL(&geoms, gp, geoms); in redo_rank()
850 gp1 = gp; in redo_rank()
875 if (gp == gp1) in redo_rank()
944 struct g_geom *gp; in g_access() local
956 gp = pp->geom; in g_access()
968 KASSERT(gp->access != NULL, ("NULL geom->access")); in g_access()
992 while ((gp->flags & G_GEOM_IN_ACCESS) != 0) { in g_access()
995 __func__, gp->name, pp->name, cp->geom->name); in g_access()
996 gp->flags |= G_GEOM_ACCESS_WAIT; in g_access()
997 g_topology_sleep(gp, 0); in g_access()
1015 if ((g_debugflags & G_F_FOOTSHOOTING) && gp->rank == 1) in g_access()
1037 gp->flags |= G_GEOM_IN_ACCESS; in g_access()
1038 error = gp->access(pp, dcr, dcw, dce); in g_access()
1041 "closing ->access()", gp->class->name, pp->name, dcr, dcw, in g_access()
1045 gp->flags &= ~G_GEOM_IN_ACCESS; in g_access()
1048 if ((gp->flags & G_GEOM_ACCESS_WAIT) != 0) { in g_access()
1049 gp->flags &= ~G_GEOM_ACCESS_WAIT; in g_access()
1050 wakeup(gp); in g_access()
1062 !(gp->flags & G_GEOM_WITHER)) in g_access()
1172 struct g_geom *gp; in g_std_spoiled() local
1180 gp = cp->geom; in g_std_spoiled()
1181 LIST_FOREACH(pp, &gp->provider, provider) in g_std_spoiled()
1184 if (LIST_EMPTY(&gp->provider) && LIST_EMPTY(&gp->consumer)) in g_std_spoiled()
1185 g_destroy_geom(gp); in g_std_spoiled()
1187 gp->flags |= G_GEOM_WITHER; in g_std_spoiled()
1354 struct g_geom *gp; in g_valid_obj() local
1366 LIST_FOREACH(gp, &mp->geom, geom) { in g_valid_obj()
1367 if (ptr == gp) in g_valid_obj()
1369 LIST_FOREACH(cp, &gp->consumer, consumer) in g_valid_obj()
1372 LIST_FOREACH(pp, &gp->provider, provider) in g_valid_obj()
1417 geom_flags_to_string(struct g_geom *gp, char *str, size_t size) in geom_flags_to_string() argument
1422 if (gp->flags == 0) { in geom_flags_to_string()
1426 ADDFLAG(gp, G_GEOM_WITHER, "G_GEOM_WITHER"); in geom_flags_to_string()
1503 db_show_geom_geom(int indent, struct g_geom *gp) in db_show_geom_geom() argument
1510 gprintln("geom: %s (%p)", gp->name, gp); in db_show_geom_geom()
1511 gprintln(" class: %s (%p)", gp->class->name, gp->class); in db_show_geom_geom()
1513 geom_flags_to_string(gp, flags, sizeof(flags)), gp->flags); in db_show_geom_geom()
1514 gprintln(" rank: %d", gp->rank); in db_show_geom_geom()
1515 if (LIST_EMPTY(&gp->provider)) in db_show_geom_geom()
1517 if (LIST_EMPTY(&gp->consumer)) in db_show_geom_geom()
1520 gprintf("geom: %s (%p), rank=%d", gp->name, gp, gp->rank); in db_show_geom_geom()
1521 if (gp->flags != 0) { in db_show_geom_geom()
1523 geom_flags_to_string(gp, flags, sizeof(flags)), in db_show_geom_geom()
1524 gp->flags); in db_show_geom_geom()
1528 if (!LIST_EMPTY(&gp->provider)) { in db_show_geom_geom()
1529 LIST_FOREACH(pp, &gp->provider, provider) { in db_show_geom_geom()
1535 if (!LIST_EMPTY(&gp->consumer)) { in db_show_geom_geom()
1536 LIST_FOREACH(cp, &gp->consumer, consumer) { in db_show_geom_geom()
1547 struct g_geom *gp; in db_show_geom_class() local
1550 LIST_FOREACH(gp, &mp->geom, geom) { in db_show_geom_class()
1551 db_show_geom_geom(2, gp); in db_show_geom_class()