[완료]컴파일시 invalid use of undefined type 에러

ys2cdh의 이미지

안녕하세요.

디바이스 공부 중 컴파일 에러가 나서 도움을 요청 합니다.

net_device 구조체가 정의 되어 있지 않다고 되어 있는데 linux/netdevice.h 파일에 정의 되어 있고

그 파일에 있는 다른 구조체 쓸 때는 문제가 없습니다. net_device_stats

단지 net_device 구조체에 접근 하면 이렇습니다. 도움을 요청 합니다.

커널 : 리눅스 2.6.29-6 입니다.

************************************************
원인
#define __KERNEL__ 이 빠져서 생긴 이유 였습니다.
************************************************

에러
---------------------------------------------------------
vvm_g5_network.c:51: error: invalid use of undefined type 'struct net_device'

소스
---------------------------------------------------------

#include
#include

#include
#include
#include
#include

#include "vm_g5_network.h"

#ifndef EPERM
#define EPERM 1
#endif

struct net_device vmg5_dev;
struct net_device_stats test;
/* --------------------------------------------------------------------------
* definition of the "private" data structure used by this interface
*/
#if 0
typedef struct vmg5_private {
struct net_device_stats priv_stats;
struct net_device *priv_device; /* interface used to xmit data */
int priv_mode; /* how to drop packets */
int priv_arg1; /* arguments to the dropping mode */
int priv_arg2;
}vmg5_private;
#endif

int vmg5_init(struct net_device *dev)
{

#ifdef CONFIG_NET_FASTROUTE
dev->accept_fastpath = vmg5_accept_fastpath;
#endif


return 0;
}

//module 등록
int vmg5_init_module(void)
{
int err;
test.rx_packets = 0;
vmg5_dev.init = vmg5_init; /* init()함수의 등록 */
SET_MODULE_OWNER(&vmg5_dev);

/* Find a name for this unit */
err=dev_alloc_name(&vmg5_dev,"vmg5%d");
if(err<0)
{
return err;
}

if (register_netdev(&vmg5_dev) != 0)
{
return -EIO;
}
return 0;
}

//module 해제
void vmg5_dev_cleanup_module(void)
{
unregister_netdev(&vmg5_dev);
kfree(vmg5_dev.priv);

memset(&vmg5_dev, 0, sizeof(vmg5_dev));
vmg5_dev.init = vmg5_init;
}

module_init(vmg5_init_module);
module_exit(vmg5_dev_cleanup_module);

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.