Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 02-22-2008, 02:38 AM   #1
LQ Newbie
Registered: Feb 2008
Posts: 4

Rep: Reputation: 0
Unhappy Please explain arrayq_put() in arrayq.c

Hi ,

I am a novice programmer in Device Driver and Kernel Programming.I have come through a function in arrayq.c whose main work is to put element in the Queue.The function is given below:-

int arrayq_put(arrayq_t *q, void *base, arrayq_elem_t *data)

if (arrayq_full(q))
return 10;
if ((data->size + sizeof(arrayq_elem_t)) > q->elem_size)
printk ("<%d> <%d> : <%d>\n", data->size, sizeof(arrayq_elem_t), q->elem_size);

return 0;
memcpy(base + q->put * q->elem_size,
data->size + sizeof(arrayq_elem_t));
q->put &= q->mask;

return 1;
The thing here I don't understand is use of arrayq_elem_t *data which is used both as Source Pointer and Size in memcpy() method.The various structure used are given as follows:-

typedef struct
unsigned exponent;
unsigned size;
unsigned mask;
unsigned put;
unsigned get;
unsigned elem_size;
spinlock_t lock;

typedef struct
unsigned size;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone explain this to me, please? Hammett Linux - Software 3 02-16-2006 08:02 PM
explain. bruse Linux - Newbie 6 09-08-2005 11:48 PM
Can somebody explain this to me? SyBEX Linux - Software 3 10-24-2004 05:32 PM
can anyone explain this? log Linux - Software 2 06-10-2003 12:30 AM
Please explain pilotgi Linux - Software 9 05-09-2002 06:47 PM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration