0
嗨,我有問題psched_time_t定義在下面的結構中它給出標識符預期的錯誤,我認爲這個錯誤當沒有包含相應的頭文件時會發生這種情況,並且我確實包含了它是#include,並在此文件中聲明瞭psched_time_t。所以我做錯了什麼?請幫助包括/淨/ sch_generic.h:199:錯誤:預期說明符 - 限定符列表之前'psched_time_t'
#ifndef __NET_SCHED_GENERIC_H
#define __NET_SCHED_GENERIC_H
#include <linux/netdevice.h>
#include <linux/types.h>
#include <linux/rcupdate.h>
#include <linux/module.h>
#include <linux/pkt_sched.h>
#include <linux/pkt_cls.h>
#include <net/gen_stats.h>
#include <net/rtnetlink.h>
struct agg_queue {
__be32 dest;
__u32 currSize;
__u32 maxSize;
psched_time_t timestamp; //this is where the error is
struct agg_queue *next;
struct sk_buff_head skb_head;
};
下面的文件是淨/ pkt_sched.h這也正是psched_time_t定義:
#ifndef __NET_PKT_SCHED_H
#define __NET_PKT_SCHED_H
#include <linux/jiffies.h>
#include <linux/ktime.h>
#include <net/sch_generic.h>
struct qdisc_walker {
int stop;
int skip;
int count;
int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
};
#define QDISC_ALIGNTO 64
#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
static inline void *qdisc_priv(struct Qdisc *q)
{
return (char *) q + QDISC_ALIGN(sizeof(struct Qdisc));
}
typedef u64 psched_time_t;
typedef long psched_tdiff_t;
/* Avoid doing 64 bit divide */
#define PSCHED_SHIFT 6
#define PSCHED_TICKS2NS(x) ((s64)(x) << PSCHED_SHIFT)
#define PSCHED_NS2TICKS(x) ((x) >> PSCHED_SHIFT)
#define PSCHED_TICKS_PER_SEC PSCHED_NS2TICKS(NSEC_PER_SEC)
#define PSCHED_PASTPERFECT 0
static inline psched_time_t psched_get_time(void)
{
return PSCHED_NS2TICKS(ktime_to_ns(ktime_get()));
}
我沒有包括整個代碼,否則它確實有代碼末尾的#endif我只包含給我問題的部分 – docas
請有人幫助我,我仍然卡住 – docas
請參閱編輯答案。 –