Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/geom_dev.c
Show First 20 Lines • Show All 371 Lines • ▼ Show 20 Lines | if (error != 0) { | ||||
g_destroy_consumer(cp); | g_destroy_consumer(cp); | ||||
g_destroy_geom(gp); | g_destroy_geom(gp); | ||||
mtx_destroy(&sc->sc_mtx); | mtx_destroy(&sc->sc_mtx); | ||||
g_free(sc); | g_free(sc); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
dev = sc->sc_dev; | dev = sc->sc_dev; | ||||
dev->si_flags |= SI_UNMAPPED; | dev->si_flags |= SI_UNMAPPED; | ||||
dev->si_iosize_max = MAXPHYS; | dev->si_iosize_max = maxphys; | ||||
error = init_dumpdev(dev); | error = init_dumpdev(dev); | ||||
if (error != 0) | if (error != 0) | ||||
printf("%s: init_dumpdev() failed (gp->name=%s, error=%d)\n", | printf("%s: init_dumpdev() failed (gp->name=%s, error=%d)\n", | ||||
__func__, gp->name, error); | __func__, gp->name, error); | ||||
g_dev_attrchanged(cp, "GEOM::physpath"); | g_dev_attrchanged(cp, "GEOM::physpath"); | ||||
snprintf(buf, sizeof(buf), "cdev=%s", gp->name); | snprintf(buf, sizeof(buf), "cdev=%s", gp->name); | ||||
devctl_notify("GEOM", "DEV", "CREATE", buf); | devctl_notify("GEOM", "DEV", "CREATE", buf); | ||||
▲ Show 20 Lines • Show All 319 Lines • ▼ Show 20 Lines | case DIOCZONECMD: { | ||||
old_entries = NULL; | old_entries = NULL; | ||||
new_entries = NULL; | new_entries = NULL; | ||||
rep = NULL; | rep = NULL; | ||||
alloc_size = 0; | alloc_size = 0; | ||||
if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES) { | if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES) { | ||||
rep = &zone_args->zone_params.report; | rep = &zone_args->zone_params.report; | ||||
#define MAXENTRIES (MAXPHYS / sizeof(struct disk_zone_rep_entry)) | #define MAXENTRIES (maxphys / sizeof(struct disk_zone_rep_entry)) | ||||
if (rep->entries_allocated > MAXENTRIES) | if (rep->entries_allocated > MAXENTRIES) | ||||
rep->entries_allocated = MAXENTRIES; | rep->entries_allocated = MAXENTRIES; | ||||
alloc_size = rep->entries_allocated * | alloc_size = rep->entries_allocated * | ||||
sizeof(struct disk_zone_rep_entry); | sizeof(struct disk_zone_rep_entry); | ||||
if (alloc_size != 0) | if (alloc_size != 0) | ||||
new_entries = g_malloc(alloc_size, | new_entries = g_malloc(alloc_size, | ||||
M_WAITOK| M_ZERO); | M_WAITOK | M_ZERO); | ||||
old_entries = rep->entries; | old_entries = rep->entries; | ||||
rep->entries = new_entries; | rep->entries = new_entries; | ||||
} | } | ||||
error = g_io_zonecmd(zone_args, cp); | error = g_io_zonecmd(zone_args, cp); | ||||
if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES && | if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES && | ||||
alloc_size != 0 && error == 0) | alloc_size != 0 && error == 0) | ||||
error = copyout(new_entries, old_entries, alloc_size); | error = copyout(new_entries, old_entries, alloc_size); | ||||
if (old_entries != NULL && rep != NULL) | if (old_entries != NULL && rep != NULL) | ||||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |