Что касается другого вопроса, который я задавал ранее Я думаю, что, возможно, нашел свою проблему, но мне нужен глаз эксперта.
Я нашел файл /net/ipv4/tcp_zero_copy.c
, который вызывал ошибку компиляции моего ядра.
Я не очень разбираюсь в C или C ++, когда я смотрю на файл в моем редакторе C / C ++, кажется, что один и тот же код повторяется снова (я думаю, 4 раза).
Мой вопрос прост;
Этого будет достаточно, чтобы вызвать проблемы с компилятором? Если один и тот же код появляется снова и снова в одном и том же файле?
Вот исходный код файла (всего от 148 строк до конца);
/*
* Support routines for TCP zero copy transmit
*
* Created by Vladislav Bolkhovitin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
#include <linux/skbuff.h>
net_get_page_callback_t net_get_page_callback __read_mostly;
EXPORT_SYMBOL(net_get_page_callback);
net_put_page_callback_t net_put_page_callback __read_mostly;
EXPORT_SYMBOL(net_put_page_callback);
/*
* Caller of this function must ensure that at the moment when it's called
* there are no pages in the system with net_priv field set to non-zero
* value. Hence, this function, as well as net_get_page() and net_put_page(),
* don't need any protection.
*/
int net_set_get_put_page_callbacks(
net_get_page_callback_t get_callback,
net_put_page_callback_t put_callback)
{
int res = 0;
if ((net_get_page_callback != NULL) && (get_callback != NULL) &&
(net_get_page_callback != get_callback)) {
res = -EBUSY;
goto out;
}
if ((net_put_page_callback != NULL) && (put_callback != NULL) &&
(net_put_page_callback != put_callback)) {
res = -EBUSY;
goto out;
}
net_get_page_callback = get_callback;
net_put_page_callback = put_callback;
out:
return res;
}
EXPORT_SYMBOL(net_set_get_put_page_callbacks);
/*
* Support routines for TCP zero copy transmit
*
* Created by Vladislav Bolkhovitin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
#include <linux/skbuff.h>
net_get_page_callback_t net_get_page_callback __read_mostly;
EXPORT_SYMBOL(net_get_page_callback);
net_put_page_callback_t net_put_page_callback __read_mostly;
EXPORT_SYMBOL(net_put_page_callback);
/*
* Caller of this function must ensure that at the moment when it's called
* there are no pages in the system with net_priv field set to non-zero
* value. Hence, this function, as well as net_get_page() and net_put_page(),
* don't need any protection.
*/
int net_set_get_put_page_callbacks(
net_get_page_callback_t get_callback,
net_put_page_callback_t put_callback)
{
int res = 0;
if ((net_get_page_callback != NULL) && (get_callback != NULL) &&
(net_get_page_callback != get_callback)) {
res = -EBUSY;
goto out;
}
if ((net_put_page_callback != NULL) && (put_callback != NULL) &&
(net_put_page_callback != put_callback)) {
res = -EBUSY;
goto out;
}
net_get_page_callback = get_callback;
net_put_page_callback = put_callback;
out:
return res;
}
EXPORT_SYMBOL(net_set_get_put_page_callbacks);
/*
* Support routines for TCP zero copy transmit
*
* Created by Vladislav Bolkhovitin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
#include <linux/skbuff.h>
net_get_page_callback_t net_get_page_callback __read_mostly;
EXPORT_SYMBOL(net_get_page_callback);
net_put_page_callback_t net_put_page_callback __read_mostly;
EXPORT_SYMBOL(net_put_page_callback);
/*
* Caller of this function must ensure that at the moment when it's called
* there are no pages in the system with net_priv field set to non-zero
* value. Hence, this function, as well as net_get_page() and net_put_page(),
* don't need any protection.
*/
int net_set_get_put_page_callbacks(
net_get_page_callback_t get_callback,
net_put_page_callback_t put_callback)
{
int res = 0;
if ((net_get_page_callback != NULL) && (get_callback != NULL) &&
(net_get_page_callback != get_callback)) {
res = -EBUSY;
goto out;
}
if ((net_put_page_callback != NULL) && (put_callback != NULL) &&
(net_put_page_callback != put_callback)) {
res = -EBUSY;
goto out;
}
net_get_page_callback = get_callback;
net_put_page_callback = put_callback;
out:
return res;
}
EXPORT_SYMBOL(net_set_get_put_page_callbacks);
** РЕДАКТИРОВАТЬ **
Также я просто использовал Notepad ++ для сравнения отдельных блоков кода там, где они выглядели так, как будто они закончились. Согласно инструменту сравнения все 3 блока соответствуют друг другу.
Вот выходные данные компилятора с места его смерти для командной строки, которую он мне вернул.
CC net/ipv4/tcp_zero_copy.o
net/ipv4/tcp_zero_copy.c:63:1: error: redefinition of â__kcrctab_net_get_page_callbackâ
net/ipv4/tcp_zero_copy.c:14:1: note: previous definition of â__kcrctab_net_get_page_callbackâ was here
net/ipv4/tcp_zero_copy.c:63:1: error: redefinition of â__kstrtab_net_get_page_callbackâ
net/ipv4/tcp_zero_copy.c:14:1: note: previous definition of â__kstrtab_net_get_page_callbackâ was here
net/ipv4/tcp_zero_copy.c:63:1: error: redefinition of â__ksymtab_net_get_page_callbackâ
net/ipv4/tcp_zero_copy.c:14:1: note: previous definition of â__ksymtab_net_get_page_callbackâ was here
net/ipv4/tcp_zero_copy.c:66:1: error: redefinition of â__kcrctab_net_put_page_callbackâ
net/ipv4/tcp_zero_copy.c:17:1: note: previous definition of â__kcrctab_net_put_page_callbackâ was here
net/ipv4/tcp_zero_copy.c:66:1: error: redefinition of â__kstrtab_net_put_page_callbackâ
net/ipv4/tcp_zero_copy.c:17:1: note: previous definition of â__kstrtab_net_put_page_callbackâ was here
net/ipv4/tcp_zero_copy.c:66:1: error: redefinition of â__ksymtab_net_put_page_callbackâ
net/ipv4/tcp_zero_copy.c:17:1: note: previous definition of â__ksymtab_net_put_page_callbackâ was here
net/ipv4/tcp_zero_copy.c:74:5: error: redefinition of ânet_set_get_put_page_callbacksâ
net/ipv4/tcp_zero_copy.c:25:5: note: previous definition of ânet_set_get_put_page_callbacksâ was here
net/ipv4/tcp_zero_copy.c:98:1: error: redefinition of â__kcrctab_net_set_get_put_page_callbacksâ
net/ipv4/tcp_zero_copy.c:49:1: note: previous definition of â__kcrctab_net_set_get_put_page_callbacksâ was here
net/ipv4/tcp_zero_copy.c:98:1: error: redefinition of â__kstrtab_net_set_get_put_page_callbacksâ
net/ipv4/tcp_zero_copy.c:49:1: note: previous definition of â__kstrtab_net_set_get_put_page_callbacksâ was here
net/ipv4/tcp_zero_copy.c:98:1: error: redefinition of â__ksymtab_net_set_get_put_page_callbacksâ
net/ipv4/tcp_zero_copy.c:49:1: note: previous definition of â__ksymtab_net_set_get_put_page_callbacksâ was here
make[2]: *** [net/ipv4/tcp_zero_copy.o] Error 1
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
root@dev01:/usr/src/linux# ls