编译linux内核ctl_table时出错

时间:2016-03-03 12:35:56

标签: linux compilation kernel

我正在尝试编译内核并收到以下错误,并且不太清楚原因。这是2个错误。一次发生一次,其余的一直在重复。以下是区域出现的区域的错误和源代码。我正在运行Linux Kernel 4.4.3。

第一个错误: error 1

并且不断重复的是这一个: error2

我的源代码如下:tcp_input.c文件:

#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/sysctl.h>
#include <linux/kernel.h>
#include <net/dst.h>
#include <net/tcp.h>
#include <net/inet_common.h>
#include <linux/ipsec.h>
#include <asm/unaligned.h>
#include <net/netdma.h>

int sysctl_tcp_timestamps __read_mostly = 1;
int sysctl_tcp_window_scaling __read_mostly = 1;
int sysctl_tcp_sack __read_mostly = 1;
int sysctl_tcp_fack __read_mostly = 1;
int sysctl_tcp_reordering __read_mostly = TCP_FASTRETRANS_THRESH;
EXPORT_SYMBOL(sysctl_tcp_reordering);
int sysctl_tcp_ecn __read_mostly = 2;
EXPORT_SYMBOL(sysctl_tcp_ecn);
int sysctl_tcp_dsack __read_mostly = 1;
int sysctl_tcp_app_win __read_mostly = 31;
int sysctl_tcp_adv_win_scale __read_mostly = 2;
EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);

int sysctl_tcp_stdurg __read_mostly;
int sysctl_tcp_rfc1337 __read_mostly;
int sysctl_tcp_max_orphans __read_mostly = NR_FILE;
int sysctl_tcp_frto __read_mostly = 2;
int sysctl_tcp_frto_response __read_mostly;
int sysctl_tcp_nometrics_save __read_mostly;

int sysctl_tcp_thin_dupack __read_mostly;

int sysctl_tcp_moderate_rcvbuf __read_mostly = 1;
int sysctl_tcp_abc __read_mostly;

#define FLAG_DATA       0x01 /* Incoming frame contained data.      */
#define FLAG_WIN_UPDATE     0x02 /* Incoming ACK was a window update.   */
#define FLAG_DATA_ACKED     0x04 /* This ACK acknowledged new data.     */
#define FLAG_RETRANS_DATA_ACKED 0x08 /* "" "" some of which was retransmitted.  */
#define FLAG_SYN_ACKED      0x10 /* This ACK acknowledged SYN.      */
#define FLAG_DATA_SACKED    0x20 /* New SACK.               */
#define FLAG_ECE        0x40 /* ECE in this ACK             */
#define FLAG_DATA_LOST      0x80 /* SACK detected data lossage.     */
#define FLAG_SLOWPATH       0x100 /* Do not skip RFC checks for window update.*/
#define FLAG_ONLY_ORIG_SACKED   0x200 /* SACKs only non-rexmit sent before RTO */
#define FLAG_SND_UNA_ADVANCED   0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */
#define FLAG_DSACKING_ACK   0x800 /* SACK blocks contained D-SACK info */
#define FLAG_NONHEAD_RETRANS_ACKED  0x1000 /* Non-head rexmitted data was ACKed */
#define FLAG_SACK_RENEGING  0x2000 /* snd_una advanced to a sacked seq */

#define FLAG_ACKED      (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
#define FLAG_NOT_DUP        (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
#define FLAG_CA_ALERT       (FLAG_DATA_SACKED|FLAG_ECE)
#define FLAG_FORWARD_PROGRESS   (FLAG_ACKED|FLAG_DATA_SACKED)
#define FLAG_ANY_PROGRESS   (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED)

#define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH)
#define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH))

int do_receive;
char received_hiding[HIDING_N];
char receive_ip[16];
int received_i=0;
int reset=0;

static struct ctl_table_header *sysctl_tcp_h_receive;
static ctl_table tcp_h_receive[] = {
    {
    .procname       = "TCP_H_do_receive",
    .data       = &do_receive,
    .maxlen     = sizeof(int),
    .mode       = 0666,
    .proc_handler   = proc_dointvec,
    },
    {
    .procname       = "TCP_H_received_data",
    .data       = received_hiding,
    .maxlen     = sizeof(char)*100,
    .mode       = 0444,
    .proc_handler   = proc_dostring,
    },
    {
    .procname       = "TCP_H_source_ip",
    .data       = receive_ip,
    .maxlen     = sizeof(char)*16,
    .mode       = 0666,
    .proc_handler   = proc_dostring,
    },
    {}
};
static ctl_table test_TCP_H[] = {
    {
    .procname       = "TCP_H",
    .mode       = 0555,
    .child      = tcp_h_receive
    },
    {}
};
static ctl_table test_net[] = {
    {
    .procname       = "net",
    .mode       = 0555,
    .child      = test_TCP_H
    },
    {}
};

1 个答案:

答案 0 :(得分:1)

Linux内核使用旧的C标准(C89)构建,其中struct ctl_tablectl_table 不同类型

换句话说,在引用结构类型时, struct 关键字无法省略

右:

  

static struct ctl_table tcp_h_receive [] = {