MCPcopy Create free account
hub / github.com/F-Stack/f-stack / get_memseg

Function get_memseg

freebsd/amd64/vmm/vmm_dev.c:254–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252CTASSERT(sizeof(((struct vm_memseg *)0)->name) >= VM_MAX_SUFFIXLEN + 1);
253
254static int
255get_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg, size_t len)
256{
257 struct devmem_softc *dsc;
258 int error;
259 bool sysmem;
260
261 error = vm_get_memseg(sc->vm, mseg->segid, &mseg->len, &sysmem, NULL);
262 if (error || mseg->len == 0)
263 return (error);
264
265 if (!sysmem) {
266 SLIST_FOREACH(dsc, &sc->devmem, link) {
267 if (dsc->segid == mseg->segid)
268 break;
269 }
270 KASSERT(dsc != NULL, ("%s: devmem segment %d not found",
271 __func__, mseg->segid));
272 error = copystr(dsc->name, mseg->name, len, NULL);
273 } else {
274 bzero(mseg->name, len);
275 }
276
277 return (error);
278}
279
280static int
281alloc_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg, size_t len)

Callers 1

vmmdev_ioctlFunction · 0.85

Calls 3

vm_get_memsegFunction · 0.85
copystrFunction · 0.85
bzeroFunction · 0.85

Tested by

no test coverage detected