Re: arr[0] is kernel code ???

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

 



hi,

first of all: http://justfuckinggoogleit.com/
second: it allows the element in the structure to reference memory
that follows and is contiguous with the structure instance.

also known as 'flexible array member' in c99.

kind regards
anupam

On Thu, Apr 30, 2009 at 8:43 AM, Onkar <onkar.n.m@xxxxxxxxx> wrote:
> Hi All ,
>        Why is 0 length arrays
>
> for instance
>
> struct ext2_xattr_entry {
>     __u8    e_name_len;    /* length of name */
>     __u8    e_name_index;    /* attribute name index */
>     __le16    e_value_offs;    /* offset in disk block of value */
>     __le32    e_value_block;    /* disk block attribute is stored on (n/i)
> */
>     __le32    e_value_size;    /* size of attribute value */
>     __le32    e_hash;        /* hash value of name and value */
>     char    e_name[0];    /* attribute name */
> <<<-------------------------------------------- Why ??
> };
>
> AND
>
> struct mb_cache_entry {
>     struct list_head        e_lru_list;
>     struct mb_cache            *e_cache;
>     unsigned short            e_used;
>     unsigned short            e_queued;
>     struct block_device        *e_bdev;
>     sector_t            e_block;
>     struct list_head        e_block_list;
>     struct {
>         struct list_head    o_list;
>         unsigned int        o_key;
>     } e_indexes[0]; <<<-------------------------------------------- Why ??
> };
>
>  used in many structures in the kernel code ? What is their significance ?
> and Why is
>
> do {
>  // exp 1
> //exp 2
> //exp 3
> }while (0) ;
>
> used ?
>
> Regards,
> Onkar
>
>
>
>



-- 
In the beginning was the lambda, and the lambda was with Emacs, and
Emacs was the lambda.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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