Skip to content

Commit 1888531

Browse files
committed
Always follow Kbuild for module name resolving
1 parent a528c08 commit 1888531

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

common.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

http_server.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,30 @@
44
#include <linux/sched/signal.h>
55
#include <linux/tcp.h>
66

7-
#include "common.h"
7+
#include "http_parser.h"
8+
#include "http_server.h"
89

910
#define CRLF "\r\n"
1011

1112
#define HTTP_RESPONSE_200_DUMMY \
1213
"" \
13-
"HTTP/1.1 200 OK" CRLF "Server: " MODULE_NAME CRLF \
14+
"HTTP/1.1 200 OK" CRLF "Server: " KBUILD_MODNAME CRLF \
1415
"Content-Type: text/plain" CRLF "Content-Length: 8" CRLF \
1516
"Connection: Close" CRLF CRLF "200 OK" CRLF
1617
#define HTTP_RESPONSE_200_KEEPALIVE_DUMMY \
1718
"" \
18-
"HTTP/1.1 200 OK" CRLF "Server: " MODULE_NAME CRLF \
19+
"HTTP/1.1 200 OK" CRLF "Server: " KBUILD_MODNAME CRLF \
1920
"Content-Type: text/plain" CRLF "Content-Length: 8" CRLF \
2021
"Connection: Keep-Alive" CRLF CRLF "200 OK" CRLF
21-
#define HTTP_RESPONSE_501 \
22-
"" \
23-
"HTTP/1.1 501 Not Implemented" CRLF "Server: " MODULE_NAME CRLF \
24-
"Content-Type: text/plain" CRLF "Content-Length: 21" CRLF \
22+
#define HTTP_RESPONSE_501 \
23+
"" \
24+
"HTTP/1.1 501 Not Implemented" CRLF "Server: " KBUILD_MODNAME CRLF \
25+
"Content-Type: text/plain" CRLF "Content-Length: 21" CRLF \
2526
"Connection: Close" CRLF CRLF "501 Not Implemented" CRLF
26-
#define HTTP_RESPONSE_501_KEEPALIVE \
27-
"" \
28-
"HTTP/1.1 501 Not Implemented" CRLF "Server: " MODULE_NAME CRLF \
29-
"Content-Type: text/plain" CRLF "Content-Length: 21" CRLF \
27+
#define HTTP_RESPONSE_501_KEEPALIVE \
28+
"" \
29+
"HTTP/1.1 501 Not Implemented" CRLF "Server: " KBUILD_MODNAME CRLF \
30+
"Content-Type: text/plain" CRLF "Content-Length: 21" CRLF \
3031
"Connection: KeepAlive" CRLF CRLF "501 Not Implemented" CRLF
3132

3233
#define RECV_BUFFER_SIZE 4096
@@ -200,7 +201,7 @@ int http_server_daemon(void *arg)
200201
pr_err("kernel_accept() error: %d\n", err);
201202
continue;
202203
}
203-
worker = kthread_run(http_server_worker, socket, MODULE_NAME);
204+
worker = kthread_run(http_server_worker, socket, KBUILD_MODNAME);
204205
if (IS_ERR(worker)) {
205206
pr_err("can't create more worker process\n");
206207
continue;

main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <linux/tcp.h>
66
#include <net/sock.h>
77

8-
#include "common.h"
8+
#include "http_server.h"
99

1010
#define DEFAULT_PORT 8081
1111
#define DEFAULT_BACKLOG 100
@@ -109,7 +109,7 @@ static int __init khttpd_init(void)
109109
return err;
110110
}
111111
param.listen_socket = listen_socket;
112-
http_server = kthread_run(http_server_daemon, &param, MODULE_NAME);
112+
http_server = kthread_run(http_server_daemon, &param, KBUILD_MODNAME);
113113
if (IS_ERR(http_server)) {
114114
pr_err("can't start http server daemon\n");
115115
close_listen_socket(listen_socket);

0 commit comments

Comments
 (0)