Staging: speakup: Added EXPORT_SYMBOL_GPL() markings.
Subsystems (2)
RFC PATCH 1/1 Staging: speakup: Added EXPORT_SYMBOL_GPL() markings.
Changed drivers/char/selection.c so that drivers/staging/speakup/selections.c could export. Also delete some lines that were unessary since I used EXPORT_SYMBOL_GPL().
Greg can you review this and tell me if I did it right.
--- drivers/char/selection.c | 7 +++++++ drivers/staging/speakup/selection.c | 29 +++++++---------------------- 2 files changed, 14 insertions(+), 22 deletions(-)
drivers/char/selection.c +7 -0
@@ -64,6 +64,8 @@ sel_pos(int n) use_unicode); } +EXPORT_SYMBOL_GPL (sel_pos); +/* remove the current selection highlight, if any, from the console holding the selection. */ void
@@ -75,6 +77,8 @@ clear_selection(void) { } } +EXPORT_SYMBOL_GPL (clear_selection); +/* * User settable table: what characters are to be considered alphabetic? * 256 bits
@@ -106,12 +110,15 @@ static inline int atedge(const int p, int size_row)return (!(p % size_row) || !((p +2 ) % size_row)); } +EXPORT_SYMBOL_GPL (atedge); +/* constrain v such that v <= u */ static inline unsigned short limit (const unsigned short v,const unsigned short u) {return (v > u) ? u : v; } +EXPORT_SYMBOL_GPL (limit);/* stores the char in UTF8 and returns the number of bytes used (1-3) */ static int store_utf8 (u16 c,char *p) {
drivers/staging/speakup/selection.c +7 -22
@@ -3,6 +3,7 @@#include <linux/interrupt.h> #include <linux/sched.h> #include <linux/selection.h> +#include <linux/module.h> #include "speakup.h"
@@ -21,27 +22,11 @@ static int sel_end;static int sel_buffer_lth;static char *sel_buffer; -static unsigned char sel_pos (int n) -{ -return inverse_translate (spk_sel_cons,screen_glyph (spk_sel_cons, n),0 ); -} - -void speakup_clear_selection (void ) -{ - sel_start =-1 ; -} +extern u16 sel_pos (int n); +extern void clear_selection (void ); +extern inline int atedge (const int p,int size_row); +extern inline unsigned short limit (const unsigned short v,const unsigned short u); -/* does screen address p correspond to character at LH/RH edge of screen? */ -static int atedge (const int p,int size_row) -{ -return (!(p % size_row) || !((p +2 ) % size_row)); -} - -/* constrain v such that v <= u */ -static unsigned short limit (const unsigned short v,const unsigned short u) -{ -return (v > u) ? u : v; -}int speakup_set_selection (struct tty_struct *tty) {
@@ -65,7 +50,7 @@ int speakup_set_selection(struct tty_struct *tty) }if (spk_sel_cons != vc_cons[fg_console].d) { -speakup_clear_selection (); +clear_selection (); spk_sel_cons = vc_cons[fg_console].d;printk (KERN_WARNING "Selection: mark console not the same as cut\n" );
@@ -95,7 +80,7 @@ int speakup_set_selection(struct tty_struct *tty) bp =kmalloc ((sel_end-sel_start)/2 +1 ,GFP_ATOMIC );if (!bp) {printk (KERN_WARNING "selection: kmalloc() failed\n" ); -speakup_clear_selection (); +clear_selection ();return -ENOMEM ; }kfree (sel_buffer);
Signature · 1 line
1.7.3.1.104.gc752e
drivers/staging/speakup/selection.c static int sel_end; · line 32
Quoted 4 lines · Tracey Dent, le Mon 11 Oct 2010 18:36:30 -0400, a écrit :
drivers/staging/speakup/selection.c +0
-4-void speakup_clear_selection (void ) -{ - sel_start =-1 ; -}
Mmm, this won't be so simple actually, as speakup_set_selection and speakup_paste_selection will still be using speakup/selection.c's sel_start variable. I guess all speakup/selection.c will need to be migrated to using drivers/char/selection.c functions at the same time.
speakup_paste_selection is basically like paste_selection, except that it can be called with in_atomic() being true. Yes, it's a hack. The calls to speakup_past_selection should first be moved to a helper thread, and then the main paste_selection function can be used instead.
speakup_set_selection is basically like set_selection, except that it doesn't take a userland structure, but gets the values from kernelland speakup. A kernel-land variant of set_selection should probably be defined that takes a kernelland structure. Apart from that, I don't think speakup_set_selection has anything particular compared to the main version. Kirk, can you confirm?
Samuel