Hi all,
While compiling a driver, I am getting this error:
error: dereferencing pointer to incomplete type
int __kc_adapter_cl ean(struct net_device *netdev, int *budget)
{
/*some initialization stuff */
struct adapter_struct *adapter = netdev_priv(net dev);
struct napi_struct *napi = &adapter->rx_ring[0].napi; /*
<<<<<<<<<<<th e error is on this line */
/* some other function stuff */
}
struct adapter_struct is defined as:
#define adapter_struct e1000_adapter
which is defined as:
struct e1000_adapter {
/* other members */
struct e1000_rx_ring *rx_ring;
/* other members */
};
struct e1000_rx_ring {
struct e1000_adapter *adapter;
#ifdef CONFIG_E1000_NA PI
struct napi_struct napi;
#endif
/* other members */
};
For netdev_priv() either the macro or the inline function is used:
#define netdev_priv(x) x->priv
OR
static inline void *netdev_priv(st ruct net_device *dev)
{
return (char *)dev + ((sizeof(struct net_device)
+ NETDEV_ALIGN_CO NST)
& ~NETDEV_ALIGN_C ONST);
}
struct net_device
{
void *priv;
/* other data */
}
In the particular line "&adapter->rx_ring[0].napi", after macro
substitution, dereferencing is not done in correct way, but I am not
able to figure out exactly where and how. I have tried casting the
void * part to particular struct type but, even that doesn't eliminate
the problem.
I think I have already provided all info related, if anything is
missing please point out.
I have looked for the problem around on net, couldn't find same thing,
so if this question is asked elsewhere please point to the same and I
apologize for adding the noise.
I think that problem is more of typical C compilation problem, so I
have assumed that this community is most relevant for asking this
question.
I apologize if I have unknowingly violated any community rule.
Thanks
Regards
Anuz 5 9468
On Nov 17, 10:19 am, Richard Heathfield <r...@see.sig.i nvalidwrote:
Anuz said:
Hi all,
While compiling a driver, I am getting this error:
error: dereferencing pointer to incomplete type
This normally means that you've got some kind of structure type for which a
declaration is visible (e.g. struct foo;) but not a definition. Perhaps
you've omitted a header or something like that.
int __kc_adapter_cl ean(struct net_device *netdev, int *budget)
{
/*some initialization stuff */
struct adapter_struct *adapter = netdev_priv(net dev);
struct napi_struct *napi = &adapter->rx_ring[0].napi; /*
<<<<<<<<<<<th e error is on this line */
The adapter object is of type struct adapter_struct. Make sure you have a
definition of this struct type in scope. If it is your own type, this
shouldn't be hard. If it's a platform-specific structure, check your
documentation to discover which header you need.
Assuming that's all fine, look up the type of its rx_ring member, and go
through the same deal again.
/* some other function stuff */
}
All these structures are locally defined in a single header, which is
included in very first line, so that should not be the problem.
struct adapter_struct is defined as:
#define adapter_struct e1000_adapter
You'd be better off with:
typedef e1000_adapter adapter_struct;
but I'm puzzled as to what you think the synonym offers you.
Sorry, I have skipped the following:
#ifdef DRIVER_E1000
#define adapter_struct e1000_adapter
#endif
so this is used only if particular macro is defined.
Thanks
Anuz
Anuz wrote:
Sorry, I have skipped the following:
#ifdef DRIVER_E1000
#define adapter_struct e1000_adapter
#endif
so this is used only if particular macro is defined.
The obvious guess would be that 'DRIVER_E1000' macro is not defined,
which in turn disables the definition of 'adapter_struct ' macro. The
rest follows.
--
Best regards,
Andrey Tarasevich
Anuz wrote:
>
The header is included in the very first line, which contains all the
definitions of the relevant structures. And all macros like
DRIVER_E1000 are all defined my Makefile itself.
Well, I'd re-verify that. Add an obvious error next to the definition of
'adapter_struct ' macro and see whether the compiler catches it
#ifdef DRIVER_E1000
#define adapter_struct e1000_adapter
jasbdxjkasbcfjd a /* just to make the compiler complain */
#endif
If it doesn't, then 'DRIVER_E1000' is _not_ defined.
I suspect that when at this line:
struct adapter_struct *adapter = netdev_priv(net dev);
it becomes:
adapter = netdev->priv;/* this is a (void *) data type */
What "is a (void *) data type"? netdev->priv? If so, it doesn't really
matter, since 'adapter' is not a 'void*'.
now when
struct napi_struct *napi = &adapter->rx_ring[0].napi;
this becomes
napi = &netdev->priv->rx_ring[0].napi; /* priv is (void *) data type
*/
No, things don't "become" like that in C. 'adapter' is not a macro, so
it doesn't just get substituted they way you seem to suggest.
--
Best regards,
Andrey Tarasevich
Andrey Tarasevich said:
Anuz wrote:
>> The header is included in the very first line, which contains all the definitions of the relevant structures. And all macros like DRIVER_E1000 are all defined my Makefile itself.
Well, I'd re-verify that. Add an obvious error next to the definition of
'adapter_struct ' macro and see whether the compiler catches it
#ifdef DRIVER_E1000
#define adapter_struct e1000_adapter
jasbdxjkasbcfjd a /* just to make the compiler complain */
#endif
If it doesn't, then 'DRIVER_E1000' is _not_ defined.
Slightly more elegantly:
#ifdef DRIVER_E1000
#define adapter_struct e1000_adapter
#error DRIVER_E1000 is defined - now remove this error message
#endif
Note, too, that the OP should be using typedef, not #define, for type
synonyms.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
On Nov 17, 12:23 pm, Andrey Tarasevich <andreytarasev. ..@hotmail.com>
wrote:
Anuz wrote:
The header is included in the very first line, which contains all the
definitions of the relevant structures. And all macros like
DRIVER_E1000 are all defined my Makefile itself.
Well, I'd re-verify that. Add an obvious error next to the definition of
'adapter_struct ' macro and see whether the compiler catches it
#ifdef DRIVER_E1000
#define adapter_struct e1000_adapter
jasbdxjkasbcfjd a /* just to make the compiler complain */
#endif
If it doesn't, then 'DRIVER_E1000' is _not_ defined.
I suspect that when at this line:
struct adapter_struct *adapter = netdev_priv(net dev);
it becomes:
adapter = netdev->priv;/* this is a (void *) data type */
What "is a (void *) data type"? netdev->priv? If so, it doesn't really
matter, since 'adapter' is not a 'void*'.
now when
struct napi_struct *napi = &adapter->rx_ring[0].napi;
this becomes
napi = &netdev->priv->rx_ring[0].napi; /* priv is (void *) data type
*/
No, things don't "become" like that in C. 'adapter' is not a macro, so
it doesn't just get substituted they way you seem to suggest.
"become" is the wrong word, my mistake.
Yes, right, E1000_DRIVER is not defined, I have tried using #error.
Thanks a loads.
Regards
Anuz This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pushkar Pradhan |
last post by:
I tried to read the archives and solve this problem, but now I think I
better post my problem:
int main() {
int blkSz = { {2,2},
{2,3},
.....,
{6,6} };
write_bc_perf(mflops1, blkSz, NUMBASECASES);
|
by: Neo |
last post by:
Hi Folks,
#include<stdio.h>
int main()
{
int (*p);
int arr;
int i;
|
by: Alexei A. Frounze |
last post by:
Hi all,
I have a question regarding the gcc behavior (gcc version 3.3.4).
On the following test program it emits a warning:
#include <stdio.h>
int aInt2 = {0,1,2,4,9,16};
int aInt3 = {0,1,2,4,9};
|
by: Steven |
last post by:
Hello,
I get the following message during compilation:
`dereferencing pointer to incomplete type'
It stems from the compare function I use with qsort() and I am not
quite sure how to fix it.
I have a struct like:
struct node {
|
by: friend.05 |
last post by:
I have three files.
graph.h:
My header file where I have typedef for my structure and function
delcaration
typedef struct _ipc_actors ipc_graph_actors;
typedef ipc_graph_type *ipc_graph_pointer;
| |
by: Pritam |
last post by:
line 7: error: dereferencing pointer to incomplete type
1. #include<stdio.h>
2. #include<sys/stat.h>
3. #include<stdlib.h>
4. void execname() {
5. struct task_struct *my;
6. my = find_task_by_id(getpid());
7. printf("%s",my->comm); error: dereferencing pointer to incomplete
type
|
by: tejesh |
last post by:
I am trying to compile the following code
int backend_sm_run(struct interface_data *ctx)
{
xsup_assert((ctx != NULL), "ctx != NULL", TRUE);
xsup_assert((ctx->statemachine != NULL), "ctx->statemachine != NULL",
TRUE);
backend_sm_check_globals(check);
|
by: hnshashi |
last post by:
I have written kernel(2.4) module to communicate with user application using
"Netlink Socket".
I am getting compilation error "Dereferencing pointer to incomplete type"
in kernel module for "nlh = (struct nlmsghdr *) skb->data" line and also
not able include "net/sock.h" header file.
plz help me how can solve this
Thanks
|
by: Juha Nieminen |
last post by:
I asked a long time ago in this group how to make a smart pointer
which works with incomplete types. I got this answer (only relevant
parts included):
//------------------------------------------------------------------
template<typename Data_t>
class SmartPointer
{
Data_t* data;
void(*deleterFunc)(Data_t*);
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |