mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-11-25 17:56:36 +08:00
Remove linux-2.6 specific checks
This commit is contained in:
parent
760bbe70cb
commit
675c002b15
|
@ -8,7 +8,6 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/sched.h> /* For current */
|
#include <linux/sched.h> /* For current */
|
||||||
#include <linux/tty.h> /* For the tty declarations */
|
#include <linux/tty.h> /* For the tty declarations */
|
||||||
#include <linux/version.h> /* For LINUX_VERSION_CODE */
|
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
|
@ -17,20 +16,10 @@ static void print_string(char *str)
|
||||||
struct tty_struct *my_tty;
|
struct tty_struct *my_tty;
|
||||||
const struct tty_operations *ttyops;
|
const struct tty_operations *ttyops;
|
||||||
|
|
||||||
/*
|
|
||||||
* tty struct went into signal struct in 2.6.6
|
|
||||||
*/
|
|
||||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 5))
|
|
||||||
/*
|
|
||||||
* The tty for the current task
|
|
||||||
*/
|
|
||||||
my_tty = current->tty;
|
|
||||||
#else
|
|
||||||
/*
|
/*
|
||||||
* The tty for the current task, for 2.6.6+ kernels
|
* The tty for the current task, for 2.6.6+ kernels
|
||||||
*/
|
*/
|
||||||
my_tty = get_current_tty();
|
my_tty = get_current_tty();
|
||||||
#endif
|
|
||||||
ttyops = my_tty->driver->ops;
|
ttyops = my_tty->driver->ops;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -46,12 +35,9 @@ static void print_string(char *str)
|
||||||
*
|
*
|
||||||
* The function's 1st parameter is the tty to write to,
|
* The function's 1st parameter is the tty to write to,
|
||||||
* because the same function would normally be used for all
|
* because the same function would normally be used for all
|
||||||
* tty's of a certain type. The 2nd parameter controls
|
* tty's of a certain type.
|
||||||
* whether the function receives a string from kernel
|
* The 2nd parameter is a pointer to a string.
|
||||||
* memory (false, 0) or from user memory (true, non zero).
|
* The 3rd parameter is the length of the string.
|
||||||
* BTW: this param has been removed in Kernels > 2.6.9
|
|
||||||
* The (2nd) 3rd parameter is a pointer to a string.
|
|
||||||
* The (3rd) 4th parameter is the length of the string.
|
|
||||||
*
|
*
|
||||||
* As you will see below, sometimes it's necessary to use
|
* As you will see below, sometimes it's necessary to use
|
||||||
* preprocessor stuff to create code that works for different
|
* preprocessor stuff to create code that works for different
|
||||||
|
@ -61,10 +47,6 @@ static void print_string(char *str)
|
||||||
* linux/Documentation/SubmittingPatches
|
* linux/Documentation/SubmittingPatches
|
||||||
*/
|
*/
|
||||||
(ttyops->write)(my_tty, /* The tty itself */
|
(ttyops->write)(my_tty, /* The tty itself */
|
||||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 9))
|
|
||||||
0, /* Don't take the string
|
|
||||||
from user space */
|
|
||||||
#endif
|
|
||||||
str, /* String */
|
str, /* String */
|
||||||
strlen(str)); /* Length */
|
strlen(str)); /* Length */
|
||||||
|
|
||||||
|
@ -82,12 +64,7 @@ static void print_string(char *str)
|
||||||
* MS Windows, the ASCII standard was strictly adhered to,
|
* MS Windows, the ASCII standard was strictly adhered to,
|
||||||
* and therefore a newline requirs both a LF and a CR.
|
* and therefore a newline requirs both a LF and a CR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 9))
|
|
||||||
(ttyops->write)(my_tty, 0, "\015\012", 2);
|
|
||||||
#else
|
|
||||||
(ttyops->write)(my_tty, "\015\012", 2);
|
(ttyops->write)(my_tty, "\015\012", 2);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user