zfs/patches/rhel5-spl-export-symbols.patch

92 lines
3.1 KiB
Diff
Raw Normal View History

Linux VM Integration Cleanup Remove all instances of functions being reimplemented in the SPL. When the prototypes are available in the linux headers but the function address itself is not exported use kallsyms_lookup_name() to find the address. The function name itself can them become a define which calls a function pointer. This is preferable to reimplementing the function in the SPL because it ensures we get the correct version of the function for the running kernel. This is actually pretty safe because the prototype is defined in the headers so we know we are calling the function properly. This patch also includes a rhel5 kernel patch we exports the needed symbols so we don't need to use kallsyms_lookup_name(). There are autoconf checks to detect if the symbol is exported and if so to use it directly. We should add patches for stock upstream kernels as needed if for no other reason than so we can easily track which additional symbols we needed exported. Those patches can also be used by anyone willing to rebuild their kernel, but this should not be a requirement. The rhel5 version of the export-symbols patch has been applied to the chaos kernel. Additional fixes: 1) Implement vmem_size() function using get_vmalloc_info() 2) SPL_CHECK_SYMBOL_EXPORT macro updated to use $LINUX_OBJ instead of $LINUX because Module.symvers is a build product. When $LINUX_OBJ != $LINUX we will not properly detect exported symbols. 3) SPL_LINUX_COMPILE_IFELSE macro updated to add include2 and $LINUX/include search paths to allow proper compilation when the kernel target build directory is not the source directory.
2009-02-25 21:20:40 +00:00
Index: linux+rh+chaos/kernel/sched.c
===================================================================
--- linux+rh+chaos.orig/kernel/sched.c
+++ linux+rh+chaos/kernel/sched.c
@@ -1034,10 +1034,11 @@ static inline void resched_task(struct t
* task_curr - is this task currently executing on a CPU?
* @p: the task in question.
*/
-inline int task_curr(const struct task_struct *p)
+int task_curr(const struct task_struct *p)
{
return cpu_curr(task_cpu(p)) == p;
}
+EXPORT_SYMBOL(task_curr); /* Request export upstream */
/* Used instead of source_load when we know the type == 0 */
unsigned long weighted_cpuload(const int cpu)
Index: linux+rh+chaos/kernel/time.c
===================================================================
--- linux+rh+chaos.orig/kernel/time.c
+++ linux+rh+chaos/kernel/time.c
@@ -605,6 +605,7 @@ void set_normalized_timespec(struct time
ts->tv_sec = sec;
ts->tv_nsec = nsec;
}
+EXPORT_SYMBOL(set_normalized_timespec); /* Exported as of 2.6.26 */
/**
* ns_to_timespec - Convert nanoseconds to timespec
Index: linux+rh+chaos/kernel/kallsyms.c
===================================================================
--- linux+rh+chaos.orig/kernel/kallsyms.c
+++ linux+rh+chaos/kernel/kallsyms.c
@@ -154,6 +154,7 @@ unsigned long kallsyms_lookup_name(const
}
return module_kallsyms_lookup_name(name);
}
+EXPORT_SYMBOL(kallsyms_lookup_name); /* Exported prior to 2.6.19 */
/*
* Lookup an address
Index: linux+rh+chaos/fs/proc/mmu.c
===================================================================
--- linux+rh+chaos.orig/fs/proc/mmu.c
+++ linux+rh+chaos/fs/proc/mmu.c
@@ -75,3 +75,4 @@ void get_vmalloc_info(struct vmalloc_inf
read_unlock(&vmlist_lock);
}
}
+EXPORT_SYMBOL(get_vmalloc_info); /* Request clean upstream API for this */
Index: linux+rh+chaos/mm/mmzone.c
===================================================================
--- linux+rh+chaos.orig/mm/mmzone.c
+++ linux+rh+chaos/mm/mmzone.c
@@ -14,7 +14,7 @@ struct pglist_data *first_online_pgdat(v
return NODE_DATA(first_online_node);
}
-EXPORT_UNUSED_SYMBOL(first_online_pgdat); /* June 2006 */
+EXPORT_SYMBOL(first_online_pgdat); /* Exported prior to 2.6.18 */
struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
{
@@ -24,7 +24,7 @@ struct pglist_data *next_online_pgdat(st
return NULL;
return NODE_DATA(nid);
}
-EXPORT_UNUSED_SYMBOL(next_online_pgdat); /* June 2006 */
+EXPORT_SYMBOL(next_online_pgdat); /* Exported prior to 2.6.18 */
/*
@@ -45,5 +45,5 @@ struct zone *next_zone(struct zone *zone
}
return zone;
}
-EXPORT_UNUSED_SYMBOL(next_zone); /* June 2006 */
+EXPORT_SYMBOL(next_zone); /* Exported prior to 2.6.18 */
Index: linux+rh+chaos/mm/vmstat.c
===================================================================
--- linux+rh+chaos.orig/mm/vmstat.c
+++ linux+rh+chaos/mm/vmstat.c
@@ -45,6 +45,7 @@ void get_zone_counts(unsigned long *acti
*free += n;
}
}
+EXPORT_SYMBOL(get_zone_counts); /* Request clean upstream API for this */
#ifdef CONFIG_VM_EVENT_COUNTERS
DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};