Lines Matching +full:- +full:gp

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2002, 2005-2009 Marcel Moolenaar
67 { "apple-apfs", G_PART_ALIAS_APPLE_APFS },
68 { "apple-boot", G_PART_ALIAS_APPLE_BOOT },
69 { "apple-core-storage", G_PART_ALIAS_APPLE_CORE_STORAGE },
70 { "apple-hfs", G_PART_ALIAS_APPLE_HFS },
71 { "apple-label", G_PART_ALIAS_APPLE_LABEL },
72 { "apple-raid", G_PART_ALIAS_APPLE_RAID },
73 { "apple-raid-offline", G_PART_ALIAS_APPLE_RAID_OFFLINE },
74 { "apple-tv-recovery", G_PART_ALIAS_APPLE_TV_RECOVERY },
75 { "apple-ufs", G_PART_ALIAS_APPLE_UFS },
76 { "apple-zfs", G_PART_ALIAS_APPLE_ZFS },
77 { "bios-boot", G_PART_ALIAS_BIOS_BOOT },
78 { "chromeos-firmware", G_PART_ALIAS_CHROMEOS_FIRMWARE },
79 { "chromeos-kernel", G_PART_ALIAS_CHROMEOS_KERNEL },
80 { "chromeos-reserved", G_PART_ALIAS_CHROMEOS_RESERVED },
81 { "chromeos-root", G_PART_ALIAS_CHROMEOS_ROOT },
82 { "dragonfly-ccd", G_PART_ALIAS_DFBSD_CCD },
83 { "dragonfly-hammer", G_PART_ALIAS_DFBSD_HAMMER },
84 { "dragonfly-hammer2", G_PART_ALIAS_DFBSD_HAMMER2 },
85 { "dragonfly-label32", G_PART_ALIAS_DFBSD },
86 { "dragonfly-label64", G_PART_ALIAS_DFBSD64 },
87 { "dragonfly-legacy", G_PART_ALIAS_DFBSD_LEGACY },
88 { "dragonfly-swap", G_PART_ALIAS_DFBSD_SWAP },
89 { "dragonfly-ufs", G_PART_ALIAS_DFBSD_UFS },
90 { "dragonfly-vinum", G_PART_ALIAS_DFBSD_VINUM },
97 { "freebsd-boot", G_PART_ALIAS_FREEBSD_BOOT },
98 { "freebsd-nandfs", G_PART_ALIAS_FREEBSD_NANDFS },
99 { "freebsd-swap", G_PART_ALIAS_FREEBSD_SWAP },
100 { "freebsd-ufs", G_PART_ALIAS_FREEBSD_UFS },
101 { "freebsd-vinum", G_PART_ALIAS_FREEBSD_VINUM },
102 { "freebsd-zfs", G_PART_ALIAS_FREEBSD_ZFS },
103 { "hifive-fsbl", G_PART_ALIAS_HIFIVE_FSBL },
104 { "hifive-bbl", G_PART_ALIAS_HIFIVE_BBL },
105 { "linux-data", G_PART_ALIAS_LINUX_DATA },
106 { "linux-lvm", G_PART_ALIAS_LINUX_LVM },
107 { "linux-raid", G_PART_ALIAS_LINUX_RAID },
108 { "linux-swap", G_PART_ALIAS_LINUX_SWAP },
110 { "ms-basic-data", G_PART_ALIAS_MS_BASIC_DATA },
111 { "ms-ldm-data", G_PART_ALIAS_MS_LDM_DATA },
112 { "ms-ldm-metadata", G_PART_ALIAS_MS_LDM_METADATA },
113 { "ms-recovery", G_PART_ALIAS_MS_RECOVERY },
114 { "ms-reserved", G_PART_ALIAS_MS_RESERVED },
115 { "ms-spaces", G_PART_ALIAS_MS_SPACES },
116 { "netbsd-ccd", G_PART_ALIAS_NETBSD_CCD },
117 { "netbsd-cgd", G_PART_ALIAS_NETBSD_CGD },
118 { "netbsd-ffs", G_PART_ALIAS_NETBSD_FFS },
119 { "netbsd-lfs", G_PART_ALIAS_NETBSD_LFS },
120 { "netbsd-raid", G_PART_ALIAS_NETBSD_RAID },
121 { "netbsd-swap", G_PART_ALIAS_NETBSD_SWAP },
123 { "openbsd-data", G_PART_ALIAS_OPENBSD_DATA },
124 { "prep-boot", G_PART_ALIAS_PREP_BOOT },
125 { "solaris-boot", G_PART_ALIAS_SOLARIS_BOOT },
126 { "solaris-root", G_PART_ALIAS_SOLARIS_ROOT },
127 { "solaris-swap", G_PART_ALIAS_SOLARIS_SWAP },
128 { "solaris-backup", G_PART_ALIAS_SOLARIS_BACKUP },
129 { "solaris-var", G_PART_ALIAS_SOLARIS_VAR },
130 { "solaris-home", G_PART_ALIAS_SOLARIS_HOME },
131 { "solaris-altsec", G_PART_ALIAS_SOLARIS_ALTSEC },
132 { "solaris-reserved", G_PART_ALIAS_SOLARIS_RESERVED },
133 { "u-boot-env", G_PART_ALIAS_U_BOOT_ENV },
134 { "vmware-reserved", G_PART_ALIAS_VMRESERVED },
135 { "vmware-vmfs", G_PART_ALIAS_VMFS },
136 { "vmware-vmkdiag", G_PART_ALIAS_VMKDIAG },
137 { "vmware-vsanhdr", G_PART_ALIAS_VMVSANHDR },
256 table->gpt_fixgeom = 0; in g_part_geometry()
257 table->gpt_heads = 0; in g_part_geometry()
258 table->gpt_sectors = 0; in g_part_geometry()
270 table->gpt_sectors == 1)) { in g_part_geometry()
272 table->gpt_heads = heads; in g_part_geometry()
273 table->gpt_sectors = sectors; in g_part_geometry()
282 table->gpt_heads = 255; in g_part_geometry()
283 table->gpt_sectors = 63; in g_part_geometry()
286 table->gpt_fixgeom = 1; in g_part_geometry()
287 table->gpt_heads = heads; in g_part_geometry()
288 table->gpt_sectors = sectors; in g_part_geometry()
295 struct g_geom *gp; in g_part_get_physpath_done() local
301 pbp = bp->bio_parent; in g_part_get_physpath_done()
302 pp = pbp->bio_to; in g_part_get_physpath_done()
303 gp = pp->geom; in g_part_get_physpath_done()
304 table = gp->softc; in g_part_get_physpath_done()
305 entry = pp->private; in g_part_get_physpath_done()
307 if (bp->bio_error == 0) { in g_part_get_physpath_done()
310 len = strlcat(bp->bio_data, "/", bp->bio_length); in g_part_get_physpath_done()
311 if (len < bp->bio_length) { in g_part_get_physpath_done()
312 end = bp->bio_data + len; in g_part_get_physpath_done()
313 remainder = bp->bio_length - len; in g_part_get_physpath_done()
333 pp = cp->provider; in g_part_check_integrity()
334 if (table->gpt_last < table->gpt_first) { in g_part_check_integrity()
336 (intmax_t)table->gpt_last, (intmax_t)table->gpt_first); in g_part_check_integrity()
339 if (table->gpt_last > pp->mediasize / pp->sectorsize - 1) { in g_part_check_integrity()
341 "%jd > %jd\n", (intmax_t)table->gpt_last, in g_part_check_integrity()
342 (intmax_t)pp->mediasize / pp->sectorsize - 1); in g_part_check_integrity()
345 LIST_FOREACH(e1, &table->gpt_entry, gpe_entry) { in g_part_check_integrity()
346 if (e1->gpe_deleted || e1->gpe_internal) in g_part_check_integrity()
348 if (e1->gpe_start < table->gpt_first) { in g_part_check_integrity()
350 "LBA: %jd < %jd\n", e1->gpe_index, in g_part_check_integrity()
351 (intmax_t)e1->gpe_start, in g_part_check_integrity()
352 (intmax_t)table->gpt_first); in g_part_check_integrity()
355 if (e1->gpe_start > table->gpt_last) { in g_part_check_integrity()
357 "LBA: %jd > %jd\n", e1->gpe_index, in g_part_check_integrity()
358 (intmax_t)e1->gpe_start, in g_part_check_integrity()
359 (intmax_t)table->gpt_last); in g_part_check_integrity()
362 if (e1->gpe_end < e1->gpe_start) { in g_part_check_integrity()
364 "offset: %jd < %jd\n", e1->gpe_index, in g_part_check_integrity()
365 (intmax_t)e1->gpe_end, in g_part_check_integrity()
366 (intmax_t)e1->gpe_start); in g_part_check_integrity()
369 if (e1->gpe_end > table->gpt_last) { in g_part_check_integrity()
371 "LBA: %jd > %jd\n", e1->gpe_index, in g_part_check_integrity()
372 (intmax_t)e1->gpe_end, in g_part_check_integrity()
373 (intmax_t)table->gpt_last); in g_part_check_integrity()
376 if (pp->stripesize > 0) { in g_part_check_integrity()
377 offset = e1->gpe_start * pp->sectorsize; in g_part_check_integrity()
378 if (e1->gpe_offset > offset) in g_part_check_integrity()
379 offset = e1->gpe_offset; in g_part_check_integrity()
380 if ((offset + pp->stripeoffset) % pp->stripesize) { in g_part_check_integrity()
382 "aligned on %ju bytes\n", e1->gpe_index, in g_part_check_integrity()
383 pp->name, table->gpt_scheme->name, in g_part_check_integrity()
384 (uintmax_t)pp->stripesize); in g_part_check_integrity()
390 if (e2->gpe_deleted || e2->gpe_internal) in g_part_check_integrity()
392 if (e1->gpe_start >= e2->gpe_start && in g_part_check_integrity()
393 e1->gpe_start <= e2->gpe_end) { in g_part_check_integrity()
397 e1->gpe_index, e2->gpe_index, in g_part_check_integrity()
398 e2->gpe_index, (intmax_t)e2->gpe_start, in g_part_check_integrity()
399 e1->gpe_index, (intmax_t)e1->gpe_start, in g_part_check_integrity()
400 e2->gpe_index, (intmax_t)e2->gpe_end); in g_part_check_integrity()
403 if (e1->gpe_end >= e2->gpe_start && in g_part_check_integrity()
404 e1->gpe_end <= e2->gpe_end) { in g_part_check_integrity()
408 e1->gpe_index, e2->gpe_index, in g_part_check_integrity()
409 e2->gpe_index, (intmax_t)e2->gpe_start, in g_part_check_integrity()
410 e1->gpe_index, (intmax_t)e1->gpe_end, in g_part_check_integrity()
411 e2->gpe_index, (intmax_t)e2->gpe_end); in g_part_check_integrity()
414 if (e1->gpe_start < e2->gpe_start && in g_part_check_integrity()
415 e1->gpe_end > e2->gpe_end) { in g_part_check_integrity()
419 e1->gpe_index, e2->gpe_index, in g_part_check_integrity()
420 e1->gpe_index, (intmax_t)e1->gpe_start, in g_part_check_integrity()
421 e2->gpe_index, (intmax_t)e2->gpe_start, in g_part_check_integrity()
422 e2->gpe_index, (intmax_t)e2->gpe_end, in g_part_check_integrity()
423 e1->gpe_index, (intmax_t)e1->gpe_end); in g_part_check_integrity()
430 pp->name, table->gpt_scheme->name); in g_part_check_integrity()
433 table->gpt_corrupt = 1; in g_part_check_integrity()
446 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_new_entry()
447 if (entry->gpe_index == index) in g_part_new_entry()
449 if (entry->gpe_index > index) { in g_part_new_entry()
456 entry = g_malloc(table->gpt_scheme->gps_entrysz, in g_part_new_entry()
458 entry->gpe_index = index; in g_part_new_entry()
460 LIST_INSERT_HEAD(&table->gpt_entry, entry, gpe_entry); in g_part_new_entry()
464 entry->gpe_offset = 0; in g_part_new_entry()
465 entry->gpe_start = start; in g_part_new_entry()
466 entry->gpe_end = end; in g_part_new_entry()
471 g_part_new_provider(struct g_geom *gp, struct g_part_table *table, in g_part_new_provider() argument
479 cp = LIST_FIRST(&gp->consumer); in g_part_new_provider()
480 pp = cp->provider; in g_part_new_provider()
482 offset = entry->gpe_start * pp->sectorsize; in g_part_new_provider()
483 if (entry->gpe_offset < offset) in g_part_new_provider()
484 entry->gpe_offset = offset; in g_part_new_provider()
486 if (entry->gpe_pp == NULL) { in g_part_new_provider()
487 entry->gpe_pp = G_PART_NEW_PROVIDER(table, gp, entry, gp->name); in g_part_new_provider()
495 LIST_FOREACH(gap, &pp->aliases, ga_next) in g_part_new_provider()
496 G_PART_ADD_ALIAS(table, entry->gpe_pp, entry, gap->ga_alias); in g_part_new_provider()
497 entry->gpe_pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; in g_part_new_provider()
498 entry->gpe_pp->private = entry; /* Close the circle. */ in g_part_new_provider()
500 entry->gpe_pp->index = entry->gpe_index - 1; /* index is 1-based. */ in g_part_new_provider()
501 entry->gpe_pp->mediasize = (entry->gpe_end - entry->gpe_start + 1) * in g_part_new_provider()
502 pp->sectorsize; in g_part_new_provider()
503 entry->gpe_pp->mediasize -= entry->gpe_offset - offset; in g_part_new_provider()
504 entry->gpe_pp->sectorsize = pp->sectorsize; in g_part_new_provider()
505 entry->gpe_pp->stripesize = pp->stripesize; in g_part_new_provider()
506 entry->gpe_pp->stripeoffset = pp->stripeoffset + entry->gpe_offset; in g_part_new_provider()
507 if (pp->stripesize > 0) in g_part_new_provider()
508 entry->gpe_pp->stripeoffset %= pp->stripesize; in g_part_new_provider()
509 entry->gpe_pp->flags |= pp->flags & G_PF_ACCEPT_UNMAPPED; in g_part_new_provider()
510 g_error_provider(entry->gpe_pp, 0); in g_part_new_provider()
516 struct g_geom *gp; in g_part_find_geom() local
517 LIST_FOREACH(gp, &g_part_class.geom, geom) { in g_part_find_geom()
518 if ((gp->flags & G_GEOM_WITHER) == 0 && in g_part_find_geom()
519 strcmp(name, gp->name) == 0) in g_part_find_geom()
522 return (gp); in g_part_find_geom()
528 struct g_geom *gp; in g_part_parm_geom() local
534 if (strncmp(gname, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) in g_part_parm_geom()
535 gname += sizeof(_PATH_DEV) - 1; in g_part_parm_geom()
536 gp = g_part_find_geom(gname); in g_part_parm_geom()
537 if (gp == NULL) { in g_part_parm_geom()
541 *v = gp; in g_part_parm_geom()
596 if (!strcasecmp(s->name, p)) in g_part_parm_scheme()
674 g_part_probe(struct g_geom *gp, struct g_consumer *cp, int depth) in g_part_probe() argument
680 table = gp->softc; in g_part_probe()
681 scheme = (table != NULL) ? table->gpt_scheme : NULL; in g_part_probe()
695 table->gpt_gp = gp; in g_part_probe()
696 table->gpt_scheme = iter; in g_part_probe()
697 table->gpt_depth = depth; in g_part_probe()
702 if (gp->softc != NULL) in g_part_probe()
703 kobj_delete((kobj_t)gp->softc, M_GEOM); in g_part_probe()
704 gp->softc = table; in g_part_probe()
722 struct g_geom *gp; in g_part_ctl_add() local
731 gp = gpp->gpp_geom; in g_part_ctl_add()
732 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_add()
735 pp = LIST_FIRST(&gp->consumer)->provider; in g_part_ctl_add()
736 table = gp->softc; in g_part_ctl_add()
737 end = gpp->gpp_start + gpp->gpp_size - 1; in g_part_ctl_add()
739 if (gpp->gpp_start < table->gpt_first || in g_part_ctl_add()
740 gpp->gpp_start > table->gpt_last) { in g_part_ctl_add()
742 (intmax_t)gpp->gpp_start); in g_part_ctl_add()
745 if (end < gpp->gpp_start || end > table->gpt_last) { in g_part_ctl_add()
747 (intmax_t)gpp->gpp_size); in g_part_ctl_add()
750 if (gpp->gpp_index > table->gpt_entries) { in g_part_ctl_add()
751 gctl_error(req, "%d index '%d'", EINVAL, gpp->gpp_index); in g_part_ctl_add()
756 index = (gpp->gpp_index > 0) ? gpp->gpp_index : 1; in g_part_ctl_add()
757 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_add()
758 if (entry->gpe_deleted) { in g_part_ctl_add()
759 if (entry->gpe_index == index) in g_part_ctl_add()
763 if (entry->gpe_index == index) in g_part_ctl_add()
764 index = entry->gpe_index + 1; in g_part_ctl_add()
765 if (entry->gpe_index < index) in g_part_ctl_add()
767 if (entry->gpe_internal) in g_part_ctl_add()
769 if (gpp->gpp_start >= entry->gpe_start && in g_part_ctl_add()
770 gpp->gpp_start <= entry->gpe_end) { in g_part_ctl_add()
772 (intmax_t)gpp->gpp_start); in g_part_ctl_add()
775 if (end >= entry->gpe_start && end <= entry->gpe_end) { in g_part_ctl_add()
779 if (gpp->gpp_start < entry->gpe_start && end > entry->gpe_end) { in g_part_ctl_add()
781 (intmax_t)gpp->gpp_size); in g_part_ctl_add()
785 if (gpp->gpp_index > 0 && index != gpp->gpp_index) { in g_part_ctl_add()
786 gctl_error(req, "%d index '%d'", EEXIST, gpp->gpp_index); in g_part_ctl_add()
789 if (index > table->gpt_entries) { in g_part_ctl_add()
794 entry = (delent == NULL) ? g_malloc(table->gpt_scheme->gps_entrysz, in g_part_ctl_add()
796 entry->gpe_index = index; in g_part_ctl_add()
797 entry->gpe_start = gpp->gpp_start; in g_part_ctl_add()
798 entry->gpe_end = end; in g_part_ctl_add()
808 LIST_INSERT_HEAD(&table->gpt_entry, entry, gpe_entry); in g_part_ctl_add()
811 entry->gpe_created = 1; in g_part_ctl_add()
813 entry->gpe_deleted = 0; in g_part_ctl_add()
814 entry->gpe_modified = 1; in g_part_ctl_add()
816 g_part_new_provider(gp, table, entry); in g_part_ctl_add()
819 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_add()
821 G_PART_FULLNAME(table, entry, sb, gp->name); in g_part_ctl_add()
822 if (pp->stripesize > 0 && entry->gpe_pp->stripeoffset != 0) in g_part_ctl_add()
824 "aligned on %ju bytes\n", (uintmax_t)pp->stripesize); in g_part_ctl_add()
837 struct g_geom *gp; in g_part_ctl_bootcode() local
842 gp = gpp->gpp_geom; in g_part_ctl_bootcode()
843 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_bootcode()
846 table = gp->softc; in g_part_ctl_bootcode()
847 sz = table->gpt_scheme->gps_bootcodesz; in g_part_ctl_bootcode()
852 if (gpp->gpp_codesize > sz) { in g_part_ctl_bootcode()
862 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_bootcode()
864 sbuf_printf(sb, "bootcode written to %s\n", gp->name); in g_part_ctl_bootcode()
880 struct g_geom *gp; in g_part_ctl_commit() local
887 gp = gpp->gpp_geom; in g_part_ctl_commit()
888 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_commit()
891 table = gp->softc; in g_part_ctl_commit()
892 if (!table->gpt_opened) { in g_part_ctl_commit()
899 cp = LIST_FIRST(&gp->consumer); in g_part_ctl_commit()
900 if ((table->gpt_smhead | table->gpt_smtail) != 0) { in g_part_ctl_commit()
901 pp = cp->provider; in g_part_ctl_commit()
902 buf = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); in g_part_ctl_commit()
903 while (table->gpt_smhead != 0) { in g_part_ctl_commit()
904 i = ffs(table->gpt_smhead) - 1; in g_part_ctl_commit()
905 error = g_write_data(cp, i * pp->sectorsize, buf, in g_part_ctl_commit()
906 pp->sectorsize); in g_part_ctl_commit()
911 table->gpt_smhead &= ~(1 << i); in g_part_ctl_commit()
913 while (table->gpt_smtail != 0) { in g_part_ctl_commit()
914 i = ffs(table->gpt_smtail) - 1; in g_part_ctl_commit()
915 error = g_write_data(cp, pp->mediasize - (i + 1) * in g_part_ctl_commit()
916 pp->sectorsize, buf, pp->sectorsize); in g_part_ctl_commit()
921 table->gpt_smtail &= ~(1 << i); in g_part_ctl_commit()
926 if (table->gpt_scheme == &g_part_null_scheme) { in g_part_ctl_commit()
928 g_access(cp, -1, -1, -1); in g_part_ctl_commit()
929 g_part_wither(gp, ENXIO); in g_part_ctl_commit()
937 LIST_FOREACH_SAFE(entry, &table->gpt_entry, gpe_entry, tmp) { in g_part_ctl_commit()
938 if (!entry->gpe_deleted) { in g_part_ctl_commit()
940 if (entry->gpe_modified && ( in g_part_ctl_commit()
941 entry->gpe_pp->acw + entry->gpe_pp->ace + in g_part_ctl_commit()
942 entry->gpe_pp->acr) == 0) in g_part_ctl_commit()
943 g_media_changed(entry->gpe_pp, M_NOWAIT); in g_part_ctl_commit()
944 entry->gpe_created = 0; in g_part_ctl_commit()
945 entry->gpe_modified = 0; in g_part_ctl_commit()
951 table->gpt_created = 0; in g_part_ctl_commit()
952 table->gpt_opened = 0; in g_part_ctl_commit()
955 g_access(cp, -1, -1, -1); in g_part_ctl_commit()
968 struct g_geom *gp; in g_part_ctl_create() local
975 pp = gpp->gpp_provider; in g_part_ctl_create()
976 scheme = gpp->gpp_scheme; in g_part_ctl_create()
977 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, pp->name)); in g_part_ctl_create()
981 gp = g_part_find_geom(pp->name); in g_part_ctl_create()
982 if (gp != NULL) { in g_part_ctl_create()
983 null = gp->softc; in g_part_ctl_create()
984 if (null->gpt_scheme != &g_part_null_scheme) { in g_part_ctl_create()
985 gctl_error(req, "%d geom '%s'", EEXIST, pp->name); in g_part_ctl_create()
991 if ((gpp->gpp_parms & G_PART_PARM_ENTRIES) && in g_part_ctl_create()
992 (gpp->gpp_entries < scheme->gps_minent || in g_part_ctl_create()
993 gpp->gpp_entries > scheme->gps_maxent)) { in g_part_ctl_create()
994 gctl_error(req, "%d entries '%d'", EINVAL, gpp->gpp_entries); in g_part_ctl_create()
999 gp = g_new_geom(&g_part_class, pp->name); in g_part_ctl_create()
1000 gp->softc = kobj_create((kobj_class_t)gpp->gpp_scheme, M_GEOM, in g_part_ctl_create()
1002 table = gp->softc; in g_part_ctl_create()
1003 table->gpt_gp = gp; in g_part_ctl_create()
1004 table->gpt_scheme = gpp->gpp_scheme; in g_part_ctl_create()
1005 table->gpt_entries = (gpp->gpp_parms & G_PART_PARM_ENTRIES) ? in g_part_ctl_create()
1006 gpp->gpp_entries : scheme->gps_defent; in g_part_ctl_create()
1007 LIST_INIT(&table->gpt_entry); in g_part_ctl_create()
1009 cp = g_new_consumer(gp); in g_part_ctl_create()
1010 cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; in g_part_ctl_create()
1015 g_part_wither(gp, error); in g_part_ctl_create()
1016 gctl_error(req, "%d geom '%s'", error, pp->name); in g_part_ctl_create()
1019 table->gpt_opened = 1; in g_part_ctl_create()
1021 cp = LIST_FIRST(&gp->consumer); in g_part_ctl_create()
1022 table->gpt_opened = null->gpt_opened; in g_part_ctl_create()
1023 table->gpt_smhead = null->gpt_smhead; in g_part_ctl_create()
1024 table->gpt_smtail = null->gpt_smtail; in g_part_ctl_create()
1030 if (pp->mediasize == 0 || pp->sectorsize == 0) { in g_part_ctl_create()
1042 table->gpt_depth = (!error) ? attr + 1 : 0; in g_part_ctl_create()
1048 * scheme-independent code. in g_part_ctl_create()
1050 g_part_geometry(table, cp, pp->mediasize / pp->sectorsize); in g_part_ctl_create()
1058 table->gpt_created = 1; in g_part_ctl_create()
1066 gpp->gpp_parms |= G_PART_PARM_GEOM; in g_part_ctl_create()
1067 gpp->gpp_geom = gp; in g_part_ctl_create()
1070 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_create()
1072 sbuf_printf(sb, "%s created\n", gp->name); in g_part_ctl_create()
1082 g_access(cp, -1, -1, -1); in g_part_ctl_create()
1083 g_part_wither(gp, error); in g_part_ctl_create()
1085 kobj_delete((kobj_t)gp->softc, M_GEOM); in g_part_ctl_create()
1086 gp->softc = null; in g_part_ctl_create()
1095 struct g_geom *gp; in g_part_ctl_delete() local
1101 gp = gpp->gpp_geom; in g_part_ctl_delete()
1102 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_delete()
1105 table = gp->softc; in g_part_ctl_delete()
1107 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_delete()
1108 if (entry->gpe_deleted || entry->gpe_internal) in g_part_ctl_delete()
1110 if (entry->gpe_index == gpp->gpp_index) in g_part_ctl_delete()
1114 gctl_error(req, "%d index '%d'", ENOENT, gpp->gpp_index); in g_part_ctl_delete()
1118 pp = entry->gpe_pp; in g_part_ctl_delete()
1120 if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0) { in g_part_ctl_delete()
1125 pp->private = NULL; in g_part_ctl_delete()
1126 entry->gpe_pp = NULL; in g_part_ctl_delete()
1133 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_delete()
1135 G_PART_FULLNAME(table, entry, sb, gp->name); in g_part_ctl_delete()
1142 if (entry->gpe_created) { in g_part_ctl_delete()
1146 entry->gpe_modified = 0; in g_part_ctl_delete()
1147 entry->gpe_deleted = 1; in g_part_ctl_delete()
1156 struct g_geom *gp; in g_part_ctl_destroy() local
1163 gp = gpp->gpp_geom; in g_part_ctl_destroy()
1164 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_destroy()
1167 table = gp->softc; in g_part_ctl_destroy()
1169 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_destroy()
1170 if (entry->gpe_deleted || entry->gpe_internal) in g_part_ctl_destroy()
1172 if (gpp->gpp_force) { in g_part_ctl_destroy()
1173 pp = entry->gpe_pp; in g_part_ctl_destroy()
1176 if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) in g_part_ctl_destroy()
1183 if (gpp->gpp_force) { in g_part_ctl_destroy()
1185 LIST_FOREACH_SAFE(entry, &table->gpt_entry, gpe_entry, tmp) { in g_part_ctl_destroy()
1186 pp = entry->gpe_pp; in g_part_ctl_destroy()
1188 pp->private = NULL; in g_part_ctl_destroy()
1202 gp->softc = kobj_create((kobj_class_t)&g_part_null_scheme, M_GEOM, in g_part_ctl_destroy()
1204 null = gp->softc; in g_part_ctl_destroy()
1205 null->gpt_gp = gp; in g_part_ctl_destroy()
1206 null->gpt_scheme = &g_part_null_scheme; in g_part_ctl_destroy()
1207 LIST_INIT(&null->gpt_entry); in g_part_ctl_destroy()
1209 cp = LIST_FIRST(&gp->consumer); in g_part_ctl_destroy()
1210 pp = cp->provider; in g_part_ctl_destroy()
1211 null->gpt_last = pp->mediasize / pp->sectorsize - 1; in g_part_ctl_destroy()
1213 null->gpt_depth = table->gpt_depth; in g_part_ctl_destroy()
1214 null->gpt_opened = table->gpt_opened; in g_part_ctl_destroy()
1215 null->gpt_smhead = table->gpt_smhead; in g_part_ctl_destroy()
1216 null->gpt_smtail = table->gpt_smtail; in g_part_ctl_destroy()
1218 while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) { in g_part_ctl_destroy()
1225 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_destroy()
1227 sbuf_printf(sb, "%s destroyed\n", gp->name); in g_part_ctl_destroy()
1238 struct g_geom *gp; in g_part_ctl_modify() local
1244 gp = gpp->gpp_geom; in g_part_ctl_modify()
1245 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_modify()
1248 table = gp->softc; in g_part_ctl_modify()
1250 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_modify()
1251 if (entry->gpe_deleted || entry->gpe_internal) in g_part_ctl_modify()
1253 if (entry->gpe_index == gpp->gpp_index) in g_part_ctl_modify()
1257 gctl_error(req, "%d index '%d'", ENOENT, gpp->gpp_index); in g_part_ctl_modify()
1267 if (!entry->gpe_created) in g_part_ctl_modify()
1268 entry->gpe_modified = 1; in g_part_ctl_modify()
1271 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_modify()
1273 G_PART_FULLNAME(table, entry, sb, gp->name); in g_part_ctl_modify()
1293 struct g_geom *gp; in g_part_ctl_recover() local
1297 gp = gpp->gpp_geom; in g_part_ctl_recover()
1298 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_recover()
1300 table = gp->softc; in g_part_ctl_recover()
1303 if (table->gpt_corrupt) { in g_part_ctl_recover()
1307 LIST_FIRST(&gp->consumer)); in g_part_ctl_recover()
1310 error, gp->name); in g_part_ctl_recover()
1316 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_recover()
1319 sbuf_printf(sb, "%s recovered\n", gp->name); in g_part_ctl_recover()
1322 gp->name); in g_part_ctl_recover()
1333 struct g_geom *gp; in g_part_ctl_resize() local
1342 gp = gpp->gpp_geom; in g_part_ctl_resize()
1343 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_resize()
1345 table = gp->softc; in g_part_ctl_resize()
1348 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_resize()
1349 if (entry->gpe_deleted || entry->gpe_internal) in g_part_ctl_resize()
1351 if (entry->gpe_index == gpp->gpp_index) in g_part_ctl_resize()
1355 gctl_error(req, "%d index '%d'", ENOENT, gpp->gpp_index); in g_part_ctl_resize()
1360 end = entry->gpe_start + gpp->gpp_size - 1; in g_part_ctl_resize()
1361 if (gpp->gpp_size < 1 || end > table->gpt_last) { in g_part_ctl_resize()
1363 (intmax_t)gpp->gpp_size); in g_part_ctl_resize()
1367 LIST_FOREACH(pe, &table->gpt_entry, gpe_entry) { in g_part_ctl_resize()
1368 if (pe->gpe_deleted || pe->gpe_internal || pe == entry) in g_part_ctl_resize()
1370 if (end >= pe->gpe_start && end <= pe->gpe_end) { in g_part_ctl_resize()
1375 if (entry->gpe_start < pe->gpe_start && end > pe->gpe_end) { in g_part_ctl_resize()
1377 (intmax_t)gpp->gpp_size); in g_part_ctl_resize()
1382 pp = entry->gpe_pp; in g_part_ctl_resize()
1384 (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) { in g_part_ctl_resize()
1385 if (entry->gpe_end - entry->gpe_start + 1 > gpp->gpp_size) { in g_part_ctl_resize()
1400 if (!entry->gpe_created) in g_part_ctl_resize()
1401 entry->gpe_modified = 1; in g_part_ctl_resize()
1404 mediasize = (entry->gpe_end - entry->gpe_start + 1) * in g_part_ctl_resize()
1405 pp->sectorsize; in g_part_ctl_resize()
1409 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_resize()
1411 G_PART_FULLNAME(table, entry, sb, gp->name); in g_part_ctl_resize()
1424 struct g_geom *gp; in g_part_ctl_setunset() local
1430 gp = gpp->gpp_geom; in g_part_ctl_setunset()
1431 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_setunset()
1434 table = gp->softc; in g_part_ctl_setunset()
1436 if (gpp->gpp_parms & G_PART_PARM_INDEX) { in g_part_ctl_setunset()
1437 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_setunset()
1438 if (entry->gpe_deleted || entry->gpe_internal) in g_part_ctl_setunset()
1440 if (entry->gpe_index == gpp->gpp_index) in g_part_ctl_setunset()
1445 gpp->gpp_index); in g_part_ctl_setunset()
1451 error = G_PART_SETUNSET(table, entry, gpp->gpp_attrib, set); in g_part_ctl_setunset()
1453 gctl_error(req, "%d attrib '%s'", error, gpp->gpp_attrib); in g_part_ctl_setunset()
1458 if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { in g_part_ctl_setunset()
1460 sbuf_printf(sb, "%s %sset on ", gpp->gpp_attrib, in g_part_ctl_setunset()
1463 G_PART_FULLNAME(table, entry, sb, gp->name); in g_part_ctl_setunset()
1465 sbuf_cat(sb, gp->name); in g_part_ctl_setunset()
1479 struct g_geom *gp; in g_part_ctl_undo() local
1484 gp = gpp->gpp_geom; in g_part_ctl_undo()
1485 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); in g_part_ctl_undo()
1488 table = gp->softc; in g_part_ctl_undo()
1489 if (!table->gpt_opened) { in g_part_ctl_undo()
1494 cp = LIST_FIRST(&gp->consumer); in g_part_ctl_undo()
1495 LIST_FOREACH_SAFE(entry, &table->gpt_entry, gpe_entry, tmp) { in g_part_ctl_undo()
1496 entry->gpe_modified = 0; in g_part_ctl_undo()
1497 if (entry->gpe_created) { in g_part_ctl_undo()
1498 pp = entry->gpe_pp; in g_part_ctl_undo()
1500 pp->private = NULL; in g_part_ctl_undo()
1501 entry->gpe_pp = NULL; in g_part_ctl_undo()
1504 entry->gpe_deleted = 1; in g_part_ctl_undo()
1506 if (entry->gpe_deleted) { in g_part_ctl_undo()
1514 reprobe = (table->gpt_scheme == &g_part_null_scheme || in g_part_ctl_undo()
1515 table->gpt_created) ? 1 : 0; in g_part_ctl_undo()
1518 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_undo()
1519 if (entry->gpe_internal) in g_part_ctl_undo()
1524 while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) { in g_part_ctl_undo()
1528 error = g_part_probe(gp, cp, table->gpt_depth); in g_part_ctl_undo()
1531 g_access(cp, -1, -1, -1); in g_part_ctl_undo()
1532 g_part_wither(gp, error); in g_part_ctl_undo()
1535 table = gp->softc; in g_part_ctl_undo()
1541 * scheme-independent code. in g_part_ctl_undo()
1543 pp = cp->provider; in g_part_ctl_undo()
1544 g_part_geometry(table, cp, pp->mediasize / pp->sectorsize); in g_part_ctl_undo()
1555 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_ctl_undo()
1556 if (!entry->gpe_internal) in g_part_ctl_undo()
1557 g_part_new_provider(gp, table, entry); in g_part_ctl_undo()
1560 table->gpt_opened = 0; in g_part_ctl_undo()
1561 g_access(cp, -1, -1, -1); in g_part_ctl_undo()
1571 g_part_wither(struct g_geom *gp, int error) in g_part_wither() argument
1577 table = gp->softc; in g_part_wither()
1579 gp->softc = NULL; in g_part_wither()
1580 while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) { in g_part_wither()
1582 pp = entry->gpe_pp; in g_part_wither()
1583 entry->gpe_pp = NULL; in g_part_wither()
1585 pp->private = NULL; in g_part_wither()
1593 g_wither_geom(gp, error); in g_part_wither()
1611 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s,%s)", __func__, mp->name, verb)); in g_part_ctlreq()
1700 for (i = 0; i < req->narg; i++) { in g_part_ctlreq()
1701 ap = &req->arg[i]; in g_part_ctlreq()
1703 switch (ap->name[0]) { in g_part_ctlreq()
1705 if (!strcmp(ap->name, "arg0")) { in g_part_ctlreq()
1709 if (!strcmp(ap->name, "attrib")) in g_part_ctlreq()
1713 if (!strcmp(ap->name, "bootcode")) in g_part_ctlreq()
1717 if (!strcmp(ap->name, "class")) in g_part_ctlreq()
1721 if (!strcmp(ap->name, "entries")) in g_part_ctlreq()
1725 if (!strcmp(ap->name, "flags")) in g_part_ctlreq()
1727 else if (!strcmp(ap->name, "force")) in g_part_ctlreq()
1731 if (!strcmp(ap->name, "index")) in g_part_ctlreq()
1735 if (!strcmp(ap->name, "label")) in g_part_ctlreq()
1739 if (!strcmp(ap->name, "output")) in g_part_ctlreq()
1743 if (!strcmp(ap->name, "scheme")) in g_part_ctlreq()
1745 else if (!strcmp(ap->name, "size")) in g_part_ctlreq()
1747 else if (!strcmp(ap->name, "start")) in g_part_ctlreq()
1749 else if (!strcmp(ap->name, "skip_dsn")) in g_part_ctlreq()
1753 if (!strcmp(ap->name, "type")) in g_part_ctlreq()
1757 if (!strcmp(ap->name, "verb")) in g_part_ctlreq()
1759 else if (!strcmp(ap->name, "version")) in g_part_ctlreq()
1764 gctl_error(req, "%d param '%s'", EINVAL, ap->name); in g_part_ctlreq()
1769 error = g_part_parm_str(req, ap->name, in g_part_ctlreq()
1773 error = g_part_parm_bootcode(req, ap->name, in g_part_ctlreq()
1777 error = g_part_parm_intmax(req, ap->name, in g_part_ctlreq()
1781 error = g_part_parm_str(req, ap->name, &gpp.gpp_flags); in g_part_ctlreq()
1784 error = g_part_parm_uint32(req, ap->name, in g_part_ctlreq()
1788 error = g_part_parm_geom(req, ap->name, &gpp.gpp_geom); in g_part_ctlreq()
1791 error = g_part_parm_intmax(req, ap->name, in g_part_ctlreq()
1795 error = g_part_parm_str(req, ap->name, &gpp.gpp_label); in g_part_ctlreq()
1798 error = 0; /* Write-only parameter */ in g_part_ctlreq()
1801 error = g_part_parm_provider(req, ap->name, in g_part_ctlreq()
1805 error = g_part_parm_scheme(req, ap->name, in g_part_ctlreq()
1809 error = g_part_parm_quad(req, ap->name, &gpp.gpp_size); in g_part_ctlreq()
1812 error = g_part_parm_uint32(req, ap->name, in g_part_ctlreq()
1816 error = g_part_parm_quad(req, ap->name, in g_part_ctlreq()
1820 error = g_part_parm_str(req, ap->name, &gpp.gpp_type); in g_part_ctlreq()
1823 error = g_part_parm_uint32(req, ap->name, in g_part_ctlreq()
1828 gctl_error(req, "%d %s", error, ap->name); in g_part_ctlreq()
1834 ap->name); in g_part_ctlreq()
1841 parm = mparms - (gpp.gpp_parms & mparms); in g_part_ctlreq()
1850 table = gpp.gpp_geom->softc; in g_part_ctlreq()
1851 if (table != NULL && table->gpt_corrupt && in g_part_ctlreq()
1856 EPERM, gpp.gpp_geom->name); in g_part_ctlreq()
1859 if (table != NULL && !table->gpt_opened) { in g_part_ctlreq()
1860 error = g_access(LIST_FIRST(&gpp.gpp_geom->consumer), in g_part_ctlreq()
1864 gpp.gpp_geom->name); in g_part_ctlreq()
1867 table->gpt_opened = 1; in g_part_ctlreq()
1876 gctl_error(req, "%d pre-check failed", error); in g_part_ctlreq()
1940 g_access(LIST_FIRST(&gpp.gpp_geom->consumer), -1, -1, -1); in g_part_ctlreq()
1941 table->gpt_opened = 0; in g_part_ctlreq()
1947 struct g_geom *gp) in g_part_destroy_geom() argument
1950 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s,%s)", __func__, mp->name, gp->name)); in g_part_destroy_geom()
1953 g_part_wither(gp, EINVAL); in g_part_destroy_geom()
1961 struct g_geom *gp; in g_part_taste() local
1968 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s,%s)", __func__, mp->name, pp->name)); in g_part_taste()
1972 if (pp->acw > 0) in g_part_taste()
1980 gp = g_new_geom(mp, pp->name); in g_part_taste()
1981 cp = g_new_consumer(gp); in g_part_taste()
1982 cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; in g_part_taste()
1987 if (cp->provider) in g_part_taste()
1990 g_destroy_geom(gp); in g_part_taste()
1994 rht = root_mount_hold(mp->name); in g_part_taste()
1998 * Short-circuit the whole probing galore when there's no in g_part_taste()
2001 if (pp->mediasize == 0 || pp->sectorsize == 0) { in g_part_taste()
2015 error = g_part_probe(gp, cp, depth); in g_part_taste()
2019 table = gp->softc; in g_part_taste()
2025 * scheme-independent code. in g_part_taste()
2027 g_part_geometry(table, cp, pp->mediasize / pp->sectorsize); in g_part_taste()
2037 LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { in g_part_taste()
2038 if (!entry->gpe_internal) in g_part_taste()
2039 g_part_new_provider(gp, table, entry); in g_part_taste()
2043 g_access(cp, -1, 0, 0); in g_part_taste()
2044 return (gp); in g_part_taste()
2049 g_access(cp, -1, 0, 0); in g_part_taste()
2052 g_destroy_geom(gp); in g_part_taste()
2065 G_PART_TRACE((G_T_ACCESS, "%s(%s,%d,%d,%d)", __func__, pp->name, dr, in g_part_access()
2068 cp = LIST_FIRST(&pp->geom->consumer); in g_part_access()
2070 /* We always gain write-exclusive access. */ in g_part_access()
2075 g_part_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, in g_part_dumpconf() argument
2082 KASSERT(sb != NULL && gp != NULL, ("%s", __func__)); in g_part_dumpconf()
2083 table = gp->softc; in g_part_dumpconf()
2087 entry = pp->private; in g_part_dumpconf()
2090 sbuf_printf(sb, " i %u o %ju ty %s", entry->gpe_index, in g_part_dumpconf()
2091 (uintmax_t)entry->gpe_offset, in g_part_dumpconf()
2094 * libdisk compatibility quirk - the scheme dumps the in g_part_dumpconf()
2104 entry = pp->private; in g_part_dumpconf()
2108 (uintmax_t)entry->gpe_start); in g_part_dumpconf()
2110 (uintmax_t)entry->gpe_end); in g_part_dumpconf()
2112 entry->gpe_index); in g_part_dumpconf()
2116 (uintmax_t)entry->gpe_offset); in g_part_dumpconf()
2118 (uintmax_t)pp->mediasize); in g_part_dumpconf()
2122 table->gpt_scheme->name); in g_part_dumpconf()
2124 table->gpt_entries); in g_part_dumpconf()
2126 (uintmax_t)table->gpt_first); in g_part_dumpconf()
2128 (uintmax_t)table->gpt_last); in g_part_dumpconf()
2130 table->gpt_sectors); in g_part_dumpconf()
2132 table->gpt_heads); in g_part_dumpconf()
2134 table->gpt_corrupt ? "CORRUPT": "OK"); in g_part_dumpconf()
2136 table->gpt_opened ? "true": "false"); in g_part_dumpconf()
2141 /*-
2142 * This start routine is only called for non-trivial requests, all the
2145 * bio, and return non-zero to indicate to the slice code that we did so.
2156 table = pp->geom->softc; in g_part_ioctl()
2165 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, cp->provider->name)); in g_part_resize()
2171 table = cp->geom->softc; in g_part_resize()
2172 if (table->gpt_opened == 0) { in g_part_resize()
2175 table->gpt_opened = 1; in g_part_resize()
2180 "`gpart undo %s` to revert them.\n", cp->geom->name, in g_part_resize()
2181 cp->geom->name, cp->geom->name); in g_part_resize()
2183 g_access(cp, -1, -1, -1); in g_part_resize()
2184 table->gpt_opened = 0; in g_part_resize()
2185 g_part_wither(table->gpt_gp, ENXIO); in g_part_resize()
2195 pp = cp->provider; in g_part_orphan()
2197 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, pp->name)); in g_part_orphan()
2200 KASSERT(pp->error != 0, ("%s", __func__)); in g_part_orphan()
2201 table = cp->geom->softc; in g_part_orphan()
2202 if (table != NULL && table->gpt_opened) in g_part_orphan()
2203 g_access(cp, -1, -1, -1); in g_part_orphan()
2204 g_part_wither(cp->geom, pp->error); in g_part_orphan()
2211 G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, cp->provider->name)); in g_part_spoiled()
2214 cp->flags |= G_CF_ORPHAN; in g_part_spoiled()
2215 g_part_wither(cp->geom, ENXIO); in g_part_spoiled()
2223 struct g_geom *gp; in g_part_start() local
2233 pp = bp->bio_to; in g_part_start()
2234 gp = pp->geom; in g_part_start()
2235 table = gp->softc; in g_part_start()
2236 cp = LIST_FIRST(&gp->consumer); in g_part_start()
2238 G_PART_TRACE((G_T_BIO, "%s: cmd=%d, provider=%s", __func__, bp->bio_cmd, in g_part_start()
2239 pp->name)); in g_part_start()
2241 entry = pp->private; in g_part_start()
2247 switch(bp->bio_cmd) { in g_part_start()
2251 if (bp->bio_offset >= pp->mediasize) { in g_part_start()
2260 if (bp2->bio_offset + bp2->bio_length > pp->mediasize) in g_part_start()
2261 bp2->bio_length = pp->mediasize - bp2->bio_offset; in g_part_start()
2262 bp2->bio_done = g_std_done; in g_part_start()
2263 bp2->bio_offset += entry->gpe_offset; in g_part_start()
2270 if (g_handleattr_int(bp, "GEOM::fwheads", table->gpt_heads)) in g_part_start()
2272 if (g_handleattr_int(bp, "GEOM::fwsectors", table->gpt_sectors)) in g_part_start()
2279 table->gpt_isleaf && in g_part_start()
2280 (allow_nesting == 0 || entry->gpe_offset == 0))) in g_part_start()
2282 if (g_handleattr_int(bp, "PART::depth", table->gpt_depth)) in g_part_start()
2285 table->gpt_scheme->name)) in g_part_start()
2290 if (!strcmp("GEOM::physpath", bp->bio_attribute)) { in g_part_start()
2294 if (!strcmp("GEOM::kerneldump", bp->bio_attribute)) { in g_part_start()
2301 if ((bp->bio_from == NULL || in g_part_start()
2302 bp->bio_from->geom->class != &g_part_class) && in g_part_start()
2307 pp->name); in g_part_start()
2310 gkd = (struct g_kerneldump *)bp->bio_data; in g_part_start()
2311 if (gkd->offset >= pp->mediasize) { in g_part_start()
2315 if (gkd->offset + gkd->length > pp->mediasize) in g_part_start()
2316 gkd->length = pp->mediasize - gkd->offset; in g_part_start()
2317 gkd->offset += entry->gpe_offset; in g_part_start()
2330 bp2->bio_done = done_func; in g_part_start()
2352 struct g_geom *gp; in g_part_unload_event() local
2368 LIST_FOREACH(gp, &g_part_class.geom, geom) { in g_part_unload_event()
2369 table = gp->softc; in g_part_unload_event()
2370 if (table->gpt_scheme != scheme) in g_part_unload_event()
2374 LIST_FOREACH(pp, &gp->provider, provider) in g_part_unload_event()
2375 acc += pp->acr + pp->acw + pp->ace; in g_part_unload_event()
2376 LIST_FOREACH(cp, &gp->consumer, consumer) in g_part_unload_event()
2377 acc += cp->acr + cp->acw + cp->ace; in g_part_unload_event()
2380 g_part_wither(gp, ENOSYS); in g_part_unload_event()
2404 "registered!\n", scheme->name); in g_part_modevent()