Re: uvm: guard unused function for RAMDISK kernel

2017-01-22 Thread Patrick Wildt
On Mon, Jan 23, 2017 at 10:20:39AM +1000, Patrick Wildt wrote:
> Hi,
> 
> on a RAMDISK kernel this function is not used, thus clang complains.
> Simply guard it with SMALL_KERNEL, like the rest of that part of the
> code.
> 
> ok?
> 
> Patrick
> 

As requested by deraadt@, simply move the function down into the ifndef.

ok?

Patrick

diff --git a/sys/uvm/uvm_addr.c b/sys/uvm/uvm_addr.c
index af33700273b..1308a4ac446 100644
--- a/sys/uvm/uvm_addr.c
+++ b/sys/uvm/uvm_addr.c
@@ -82,19 +82,6 @@ struct uaddr_pivot_state {
struct uaddr_pivot   up_pivots[NUM_PIVOTS];
 };
 
-/*
- * Free space comparison.
- * Compares smaller free-space before larger free-space.
- */
-static inline int
-uvm_mapent_fspace_cmp(const struct vm_map_entry *e1,
-const struct vm_map_entry *e2)
-{
-   if (e1->fspace != e2->fspace)
-   return (e1->fspace < e2->fspace ? -1 : 1);
-   return (e1->start < e2->start ? -1 : e1->start > e2->start);
-}
-
 /* Forward declaration (see below). */
 extern const struct uvm_addr_functions uaddr_kernel_functions;
 struct uvm_addr_state uaddr_kbootstrap;
@@ -1435,6 +1422,19 @@ uaddr_stack_brk_create(vaddr_t minaddr, vaddr_t maxaddr)
 
 
 #ifndef SMALL_KERNEL
+/*
+ * Free space comparison.
+ * Compares smaller free-space before larger free-space.
+ */
+static inline int
+uvm_mapent_fspace_cmp(const struct vm_map_entry *e1,
+const struct vm_map_entry *e2)
+{
+   if (e1->fspace != e2->fspace)
+   return (e1->fspace < e2->fspace ? -1 : 1);
+   return (e1->start < e2->start ? -1 : e1->start > e2->start);
+}
+
 RBT_GENERATE(uaddr_free_rbtree, vm_map_entry, dfree.rbtree,
 uvm_mapent_fspace_cmp);
 #endif /* !SMALL_KERNEL */



uvm: guard unused function for RAMDISK kernel

2017-01-22 Thread Patrick Wildt
Hi,

on a RAMDISK kernel this function is not used, thus clang complains.
Simply guard it with SMALL_KERNEL, like the rest of that part of the
code.

ok?

Patrick

diff --git a/sys/uvm/uvm_addr.c b/sys/uvm/uvm_addr.c
index af33700273b..4527e1fda78 100644
--- a/sys/uvm/uvm_addr.c
+++ b/sys/uvm/uvm_addr.c
@@ -82,6 +82,7 @@ struct uaddr_pivot_state {
struct uaddr_pivot   up_pivots[NUM_PIVOTS];
 };
 
+#ifndef SMALL_KERNEL
 /*
  * Free space comparison.
  * Compares smaller free-space before larger free-space.
@@ -94,6 +95,7 @@ uvm_mapent_fspace_cmp(const struct vm_map_entry *e1,
return (e1->fspace < e2->fspace ? -1 : 1);
return (e1->start < e2->start ? -1 : e1->start > e2->start);
 }
+#endif /* !SMALL_KERNEL */
 
 /* Forward declaration (see below). */
 extern const struct uvm_addr_functions uaddr_kernel_functions;