Revise hello-5 and its output (#38)

For the example module hello_5, the book showed the incorrect output
in corresponding with its execution results.

In addition, this patch changes from myintArray[2] = {-1, -1} to
myintArray[2] = {420, 420}, which help the readers distinguish from
the kernel messages.
This commit is contained in:
RinHizakura 2021-08-04 23:42:10 +08:00 committed by GitHub
parent 40f0ff3087
commit 5940dd9faa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -13,7 +13,7 @@ static short int myshort = 1;
static int myint = 420;
static long int mylong = 9999;
static char *mystring = "blah";
static int myintArray[2] = {-1, -1};
static int myintArray[2] = {420, 420};
static int arr_argc = 0;
/*

View File

@ -408,20 +408,24 @@ I would recommend playing around with this code:
\begin{code}
$ sudo insmod hello-5.ko mystring="bebop" myintArray=-1
myshort is a short integer: 1
myint is an integer: 20
myint is an integer: 420
mylong is a long integer: 9999
mystring is a string: bebop
myintArray is -1 and 420
myintArray[0] = -1
myintArray[1] = 420
got 1 arguments for myintArray.
$ sudo rmmod hello-5
Goodbye, world 5
$ sudo insmod hello-5.ko mystring="supercalifragilisticexpialidocious" myintArray=-1,-1
myshort is a short integer: 1
myint is an integer: 20
myint is an integer: 420
mylong is a long integer: 9999
mystring is a string: supercalifragilisticexpialidocious
myintArray is -1 and -1
myintArray[0] = -1
myintArray[1] = -1
got 2 arguments for myintArray.
$ sudo rmmod hello-5
Goodbye, world 5