svn commit: r365799 - in stable/12/sys: dev/ksyms dev/xen/gntdev kern

Konstantin Belousov kib at FreeBSD.org
Wed Sep 16 14:16:11 UTC 2020


Author: kib
Date: Wed Sep 16 14:16:09 2020
New Revision: 365799
URL: https://svnweb.freebsd.org/changeset/base/365799

Log:
  MFC r365485:
  Convert allocations of the phys pager to vm_pager_allocate().

Modified:
  stable/12/sys/dev/ksyms/ksyms.c
  stable/12/sys/dev/xen/gntdev/gntdev.c
  stable/12/sys/kern/link_elf.c
  stable/12/sys/kern/link_elf_obj.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ksyms/ksyms.c
==============================================================================
--- stable/12/sys/dev/ksyms/ksyms.c	Wed Sep 16 14:14:26 2020	(r365798)
+++ stable/12/sys/dev/ksyms/ksyms.c	Wed Sep 16 14:16:09 2020	(r365799)
@@ -41,6 +41,7 @@
 #include <sys/proc.h>
 #include <sys/queue.h>
 #include <sys/resourcevar.h>
+#include <sys/rwlock.h>
 #include <sys/stat.h>
 #include <sys/sx.h>
 #include <sys/uio.h>
@@ -51,6 +52,8 @@
 #include <vm/vm.h>
 #include <vm/vm_extern.h>
 #include <vm/vm_object.h>
+#include <vm/vm_page.h>
+#include <vm/vm_pager.h>
 
 #include "linker_if.h"
 
@@ -435,8 +438,8 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus
 		ksyms_size_calc(&ts);
 		elfsz = sizeof(struct ksyms_hdr) + ts.ts_symsz + ts.ts_strsz;
 
-		object = vm_object_allocate(OBJT_PHYS,
-		    OFF_TO_IDX(round_page(elfsz)));
+		object = vm_pager_allocate(OBJT_PHYS, NULL, round_page(elfsz),
+		    VM_PROT_ALL, 0, td->td_ucred);
 		sc->sc_obj = object;
 		sc->sc_objsz = elfsz;
 

Modified: stable/12/sys/dev/xen/gntdev/gntdev.c
==============================================================================
--- stable/12/sys/dev/xen/gntdev/gntdev.c	Wed Sep 16 14:14:26 2020	(r365798)
+++ stable/12/sys/dev/xen/gntdev/gntdev.c	Wed Sep 16 14:16:09 2020	(r365799)
@@ -1073,7 +1073,8 @@ mmap_gref(struct per_user_data *priv_user, struct gntd
 	vm_object_t mem_obj;
 	struct gntdev_gref *gref;
 
-	mem_obj = vm_object_allocate(OBJT_PHYS, size);
+	mem_obj = vm_pager_allocate(OBJT_PHYS, NULL, size, VM_PROT_ALL, 0,
+	    curthread->td_ucred);
 	if (mem_obj == NULL)
 		return (ENOMEM);
 

Modified: stable/12/sys/kern/link_elf.c
==============================================================================
--- stable/12/sys/kern/link_elf.c	Wed Sep 16 14:14:26 2020	(r365798)
+++ stable/12/sys/kern/link_elf.c	Wed Sep 16 14:16:09 2020	(r365799)
@@ -995,7 +995,8 @@ link_elf_load_file(linker_class_t cls, const char* fil
 
 	ef = (elf_file_t) lf;
 #ifdef SPARSE_MAPPING
-	ef->object = vm_object_allocate(OBJT_PHYS, atop(mapsize));
+	ef->object = vm_pager_allocate(OBJT_PHYS, NULL, mapsize, VM_PROT_ALL,
+	    0, thread0.td_ucred);
 	if (ef->object == NULL) {
 		error = ENOMEM;
 		goto out;

Modified: stable/12/sys/kern/link_elf_obj.c
==============================================================================
--- stable/12/sys/kern/link_elf_obj.c	Wed Sep 16 14:14:26 2020	(r365798)
+++ stable/12/sys/kern/link_elf_obj.c	Wed Sep 16 14:16:09 2020	(r365799)
@@ -34,16 +34,17 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/fcntl.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
+#include <sys/linker.h>
 #include <sys/mutex.h>
 #include <sys/mount.h>
-#include <sys/proc.h>
 #include <sys/namei.h>
-#include <sys/fcntl.h>
+#include <sys/proc.h>
+#include <sys/rwlock.h>
 #include <sys/vnode.h>
-#include <sys/linker.h>
 
 #include <machine/elf.h>
 
@@ -53,11 +54,13 @@ __FBSDID("$FreeBSD$");
 
 #include <vm/vm.h>
 #include <vm/vm_param.h>
-#include <vm/vm_object.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_extern.h>
 #include <vm/pmap.h>
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
 #include <vm/vm_map.h>
+#include <vm/vm_object.h>
+#include <vm/vm_page.h>
+#include <vm/vm_pager.h>
 
 #include <sys/link_elf.h>
 
@@ -888,7 +891,8 @@ link_elf_load_file(linker_class_t cls, const char *fil
 	 * This stuff needs to be in a single chunk so that profiling etc
 	 * can get the bounds and gdb can associate offsets with modules
 	 */
-	ef->object = vm_object_allocate(OBJT_PHYS, atop(round_page(mapsize)));
+	ef->object = vm_pager_allocate(OBJT_PHYS, NULL, round_page(mapsize),
+	    VM_PROT_ALL, 0, thread0.td_ucred);
 	if (ef->object == NULL) {
 		error = ENOMEM;
 		goto out;


More information about the svn-src-all mailing list