Re: Perplexed with a compilation problem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Thu, Aug 6, 2009 at 5:45 PM, Belisko Marek <marek.belisko@xxxxxxxxx> wrote:
Hi,

On Thu, Aug 6, 2009 at 1:04 PM, Prasad Joshi<prasadjoshi124@xxxxxxxxx> wrote:
> Hi All,
>
> I am porting a Windows device driver to Linux.
>
> I defined a macro for CONTANING_RECORD  like
> #define CONTAINING_RECORD(ptr, type, member) list_entry((ptr), (type),
> (member))
>
> When i compiled my module, i got following errors
>
> $ make 2>&1 | grep 1132
> alloc.c:1132: error: expected _expression_ before ‘)’ token
> alloc.c:1132: error: expected identifier before ‘(’ token
> alloc.c:1132: warning: type defaults to ‘int’ in declaration of ‘__mptr’
> alloc.c:1132: warning: initialization from incompatible pointer type
> alloc.c:1132: error: expected _expression_ before ‘)’ token
>
>
> Corresponding code snippet
>
> 1130     list_for_each(Entry, &Ptr->ActiveList[target]) {
> 1131
> 1132         node = CONTAINING_RECORD(Entry, IFTL_EU, link);
Could you please post also what type is IFTL_EU?

This is how IFTL_EU is declared

 typedef struct _IFTL_EU {
    EU_TYPE         eu_type;              /* Type of EU */
    EU_STATE        eu_state;             /* State of EU */
    UINT8           eu_live;              /* number of live pages */
    UINT8           eu_next_free_page;    /*next page to allocate from this EU*/
    UINT8           eu_written_page;      /* last written page in this EU */
    ftl_atomic_t    eu_erase_cnt;         /* erase count */
    UINT64          eu;                   /* eu number */
    UINT64          eu_live_bitmask[2];   /* bitmask of live pages */
    LIST_ENTRY link;                 /* list pointers */
} IFTL_EU, *PIFTL_EU;
 

list_entry is just wrapper
for container_of and I think there could be a problem.


Yes, list_entry is just a wrapper around container_of. But i don't see any difference between the two versions of CONTAINING_RECORD i am using. Can you please elaborate on problem you see?


> 1133
> 1134         die = DIE_FROM_EU(node->eu);
> 1135
> 1136         if (Ptr->LastDie != die) {
> 1137             Ptr->LastDie = die;
> 1138             break;
> 1139         }
> 1140     }
>
>
>
> Then I changed macro with
> #define CONTAINING_RECORD list_entry
> $ make 2>&1 | grep 1132
> $
>
> And it worked, but I am not getting what was problem with the first macro
> definition.
>
> Thanks and Regards,
> Prasad
>
>
>
>
>

good luck,

Marek

--
as simple as primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux