i have next simple code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/libevent.h"
void onMessage(redisAsyncContext *c, void *reply, void *privdata) {
redisReply *r = reply;
if (reply == NULL) return;
int j;
if (r->type == REDIS_REPLY_ARRAY) {
for (j = 0; j < r->elements; j++) {
printf("%u) %s\n", j, r->element[j]->str);
}
}*/
}
int main (int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);
struct event_base *base = event_base_new();
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
if (c->err) {
printf("error: %s\n", c->errstr);
return 1;
}
redisLibeventAttach(c, base);
redisAsyncCommand(c, onMessage, NULL, "SUBSCRIBE messages");
event_base_dispatch(base);
return 0;
}
program compiles and runs well. but it returns error "Segmentation fault" when executes. if i comment redisAsyncCommand() function error disappears.
where is the error in my code?
added:
when i compile my code i have warnings:
make all
'Building file: ../src/redis.c'
'Invoking: Cross GCC Compiler'
arm-linux-gnueabihf-gcc -I"C:\SysGCC\Raspberry\include" -I"C:\SysGCC\Raspberry\include\hiredis" -I"C:\SysGCC\Raspberry\include\event2" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/redis.d" -MT"src/redis.o" -o "src/redis.o" "../src/redis.c"
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventAddRead':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:56:15: warning: passing argument 1 of 'event_add' from incompatible pointer type
event_add(&e->rev,NULL);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:937:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_add(struct event *ev, const struct timeval *timeout);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventDelRead':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:61:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->rev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventAddWrite':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:66:15: warning: passing argument 1 of 'event_add' from incompatible pointer type
event_add(&e->wev,NULL);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:937:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_add(struct event *ev, const struct timeval *timeout);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventDelWrite':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:71:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->wev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventCleanup':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:76:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->rev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:77:15: warning: passing argument 1 of 'event_del' from incompatible pointer type
event_del(&e->wev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:950:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_del(struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h: In function 'redisLibeventAttach':
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:102:5: warning: implicit declaration of function 'event_set' [-Wimplicit-function-declaration]
event_set(&e->rev,c->fd,EV_READ,redisLibeventReadEvent,e);
^
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:104:25: warning: passing argument 2 of 'event_base_set' from incompatible pointer type
event_base_set(base,&e->rev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:627:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_base_set(struct event_base *, struct event *);
^
In file included from ../src/redis.c:7:0:
C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:105:25: warning: passing argument 2 of 'event_base_set' from incompatible pointer type
event_base_set(base,&e->wev);
^
In file included from C:\SysGCC\Raspberry\include\hiredis/adapters/libevent.h:33:0,
from ../src/redis.c:7:
C:\SysGCC\Raspberry\include\event2/event.h:627:5: note: expected 'struct event *' but argument is of type 'struct event **'
int event_base_set(struct event_base *, struct event *);
^
'Finished building: ../src/redis.c'
' '
'Building target: redis'
'Invoking: Cross GCC Linker'
arm-linux-gnueabihf-gcc -L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\usr\local\lib" -L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\lib" -o "redis" ./src/redis.o -lhiredis -levent_core -lpthread
'Finished building target: redis'
' '
00:20:55 Build Finished (took 1s.130ms)
EDIT
It seems the main issue was in the included adapter file.
The issue I pointed towards was unrelated.
Here is just one quick issue I noticed:
if (r->type == REDIS_REPLY_ARRAY) {
for (j = 0; j < r->elements; j++) {
printf("%u) %s\n", j, r->element[j]->str);
}
}
Your code assumes that the reply is an array of Strings.
This is incorrect.
The Subscribe command also returns an Array response and the last member of that response is a NUMBER (not a string).
Hence, the assumption that it's an array of strings will fail.
I'm not sure if that's the cause, but it is likely to be an important issue.
Good Luck!
P.S.
I might be shamelessly promoting my own project here, but you might enjoy using facil.io's integrated Redis Pub/Sub engine. If you need Websocket or HTTP support, it might save you a lot of coding.
Related
I like to know what is HISTOGRAMS in EBPF.
So for example below ebpf program creates histogram
Compiling it cause warning then bunch of errors udp.c:7:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] BPF_HISTOGRAM(counter, u64);
SO in this tutorial about XDP it tells to create histogram I need to do BPF_HISTOGRAM(counter, u64); so where BPF_HISTOGRAM is #defined. Also what needed to be a type specifier in above waring so if I am doing BPF_HISTOGRAM(counter, u64); so I am assuming it wil be expended to something like u64 counter so if thats the case there here u go I have type specifier than what else is it complaining about in clang command root#fawad:/home/fawad/bpf# clang -I /usr/include/x86_64-linux-gnu/ -O2 -Wall -target bpf -c udp.c -o udp.o
How how to get rid of these errors and a warning if I try to compile with above command
Errors like : IPPROTO_UDP not found
use of undeclared u64
use of undeclared counter,(if I am assuming right in above question text why this warning and error about counter and histogram)
So I have this simple code
#define KBUILD_MODNAME "udp_counter"
#include <linux/bpf.h>
#include <linux/if_ether.h>
#include <linux/ip.h>
#include <linux/udp.h>
BPF_HISTOGRAM(counter, u64);
int udp_counter(struct xdp_md *ctx)
{
void *data = (void *)(long)ctx->data;
void *data_end = (void *)(long)ctx->data_end;
struct ethhdr *eth = data;
if ((void *)eth + sizeof(*eth) <= data_end)
{
struct iphdr *ip = data + sizeof(*eth);
if ((void *)ip + sizeof(*ip) <= data_end)
{
if (ip->protocol == IPPROTO_UDP)
{
struct udphdr *udp = (void *)ip + sizeof(*ip);
if ((void *)udp + sizeof(*udp) <= data_end)
{
u64 value = htons(udp->dest);
counter.increment(value);
}
}
}
}
return XDP_PASS;
}
Throws error
udp.c:7:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
BPF_HISTOGRAM(counter, u64);
^
udp.c:7:15: error: a parameter list without types is only allowed in a function definition
BPF_HISTOGRAM(counter, u64);
^
udp.c:22:33: error: use of undeclared identifier 'IPPROTO_UDP'
if (ip->protocol == IPPROTO_UDP)
^
udp.c:28:21: error: use of undeclared identifier 'u64'
u64 value = htons(udp->dest);
^
udp.c:29:21: error: use of undeclared identifier 'counter'
counter.increment(value);
^
udp.c:29:39: error: use of undeclared identifier 'value'
counter.increment(value);
^
1 warning and 5 errors generated.
root#fawad:/home/fawad/bpf# gedit udp.c
(gedit:7386): Gtk-WARNING **: 13:24:34.572
https://dev.to/satrobit/absolute-beginner-s-guide-to-bcc-xdp-and-ebpf-47oi
I am trying to use some old devices called sensinodes . There are a couple of pieces of software needed for this, contiki, sdcc and the some nano_usb_programmer
I'm working from these instruction and I can't seem to make the nano_usb_programmer on ubuntu 16.04 LTS as this pretty old now and things have moved on.
https://github.com/avian2/contiki
When making the nano element I get the error *Edited
In file included from main.c:17:0:
opts.h:25:2: error: redefinition of typedef ‘mode_t’ with different type
}mode_t;
^
In file included from /usr/include/stdlib.h:314:0,
from main.c:10:
/usr/include/x86_64-linux-gnu/sys/types.h:70:18: note: previous declaration of ‘mode_t’ was here
typedef __mode_t mode_t;
^
main.c: In function ‘main’:
main.c:57:6: warning: implicit declaration of function ‘opts_parse’ [-Wimplicit-function-declaration]
if (opts_parse(argc, argv) < 0)
^
main.c:77:4: warning: implicit declaration of function ‘prog_scan’ [-Wimplicit-function-declaration]
prog_scan();
^
main.c:178:7: warning: implicit declaration of function ‘hexfile_out’ [-Wimplicit-function-declaration]
hexfile_out(line_data, 0x04, 0, ptr, 2);
^
main.c:220:15: warning: implicit declaration of function ‘hexfile_build_tables’ [-Wimplicit-function-declaration]
if((rval = hexfile_build_tables(opts.filename, page_buffer, page_table)) == -1)
^
main.c:231:4: warning: implicit declaration of function ‘hexfile_program’ [-Wimplicit-function-declaration]
hexfile_program(page_buffer, page_table);
^
Makefile:25: recipe for target 'main.o' failed
make: *** [main.o] Error 1
It is pointing to line 25 the following file, my c knowledge just isn't any where near good enough to fix this. Any help would be great.
/*
* opts.h
*
* Created on: Dec 21, 2009
* Author: martti
*/
#ifndef OPTS_H_
#define OPTS_H_
#include "cdi.h"
typedef enum
{
USAGE,
VERSION,
SCAN,
WRITE,
WRITE_FAST,
READ,
WRITE_MAC,
READ_MAC,
LOCK,
ERASE
}mode_t;
typedef struct opts_t
{
int port;
chip_t chip;
mode_t mode;
uint8_t write_mac[8];
ramcode_t code_in_ram;
char *filename;
}opts_t;
extern opts_t opts;
#endif /* OPTS_H_ */
I've been given function called statPrint to handle printing of the system call stat(). The function is provided with another .o file. I'm getting errors when compiling my implementation with that function:
In function ‘main’:
statcall.c:9:19: error: expected expression before ‘,’ token
statPrint(argv[1]*,sb*);
^
statcall.c:9:19: error: incompatible type for argument 2 of ‘statPrint’
statcall.c:4:8: note: expected ‘struct stat *’ but argument is of type ‘struct stat’
extern statPrint(char*,struct stat*);
Here is my code:
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
extern statPrint(char∗,struct stat∗);
int main(int argc, char *argv[])
{
struct stat sb;
stat(argv[1],&sb); ///argv[1] contains input from the terminal/shell
statPrint(argv[1]*,sb*);
}
I compile it with(libstat contains the external function):
gcc -o statcall statcall.c libstat.o
How do I get rid of the errors?
This line makes no sense:
statPrint(argv[1]*,sb*);
There's no valid syntax that ends with *.
I think you want:
statPrint(argv[1], &sb);
Recommend you read up on addresses of variables and pointers.
Your function expects char * please provide it
statPrint(argv[1],sb);
I really didn't get what is argv[1]*
I want to pass a string > 1024 chars to my module (filesystem).
As kernel parameters are limited to 1024 chars, someone recommended to use sysfs instead.
I tried to include this example in my super.c class to create a string 'filename' & string 'code' entry in sysfs for my module.
static decl_subsys(myfs, NULL, NULL);
struct myfs_attr {
struct attribute attr;
char *value;
};
static struct myfs_attr fname = {
.attr.name="filename",
.attr.owner = THIS_MODULE,
.attr.mode = 0644,
.value = "/my/test/path",
};
static struct myfs_attr code = {
.attr.name="code",
.attr.owner = THIS_MODULE,
.attr.mode = 0644,
.value = "0101",
};
When compiling my module I get a lot of errors (line 41 is decl_subsys):
fs/myfs/super.c:41:26: error: expected ‘)’ before ‘(’ token
fs/myfs/super.c:50:2: error: unknown field ‘owner’ specified in initializer
fs/myfs/super.c:50:2: warning: initialization from incompatible pointer type [enabled by default]
fs/myfs/super.c:50:2: warning: (near initialization for ‘fname.attr.name’) [enabled by default]
...
fs/myfs/super.c: At top level:
fs/myfs/super.c:83:15: error: variable ‘myfsops’ has initializer but incomplete type
fs/myfs/super.c:84:2: error: unknown field ‘show’ specified in initializer
fs/myfs/super.c:84:2: warning: excess elements in struct initializer [enabled by default]
fs/myfs/super.c:84:2: warning: (near initialization for ‘myfsops’) [enabled by default]
fs/myfs/super.c:85:2: error: unknown field ‘store’ specified in initializer
fs/myfs/super.c:85:2: warning: excess elements in struct initializer [enabled by default]
fs/myfs/super.c:85:2: warning: (near initialization for ‘myfsops’) [enabled by default]
fs/myfs/super.c:89:2: error: unknown field ‘myfs_ops’ specified in initializer
fs/myfs/super.c:89:2: warning: initialization from incompatible pointer type [enabled by default]
fs/myfs/super.c:89:2: warning: (near initialization for ‘myfstype.release’) [enabled by default]
fs/myfs/super.c: In function ‘init_myfs_fs’:
fs/myfs/super.c:1554:2: error: implicit declaration of function ‘kobj_set_kset_s’ [-Werror=implicit-function-declaration]
fs/myfs/super.c:1554:19: error: ‘myfs_subsys’ undeclared (first use in this function)
fs/myfs/super.c:1554:19: note: each undeclared identifier is reported only once for each function it appears in
fs/myfs/super.c:1554:32: error: ‘fs_subsys’ undeclared (first use in this function)
fs/myfs/super.c:1557:2: error: implicit declaration of function ‘subsystem_register’ [-Werror=implicit-function-declaration]
fs/myfs/super.c: In function ‘exit_myfs_fs’:
fs/myfs/super.c:1579:2: error: implicit declaration of function ‘subsystem_unregister’ [-Werror=implicit-function-declaration]
fs/myfs/super.c:1579:24: error: ‘myfs_subsys’ undeclared (first use in this function)
Is this tutorial just outdated for my 3.5 kernel or am I missing something else?
How could I create 2 char string entries for my module in sysfs?
Here is the source code for transmitting data to a "param_buf" string. As requested, without read method. Only store.
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <asm/string.h>
static struct kobject *register_kobj;
static char *param_buf;
// function for many symbol data enter
static ssize_t __used store_value(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count){
printk(KERN_ALERT "you entered %s\n", buf);
strncpy(param_buf, buf, PAGE_SIZE - 1);
return count;
}
// register function to attribute
static struct kobj_attribute store_val_attribute = __ATTR( put_parameters, 0220, NULL, store_value);
// put attribute to attribute group
static struct attribute *register_attrs[] = {
&store_val_attribute.attr,
NULL, /* NULL terminate the list*/
};
static struct attribute_group reg_attr_group = {
.attrs = register_attrs
};
static int hello_init(void){
param_buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
// create sysfs object ( /sys/kernel/test_1025_sym directory )
register_kobj = kobject_create_and_add("test_1025_sym", kernel_kobj);
if (!register_kobj)
return -ENOMEM;
//create attributes (files)
if(sysfs_create_group(register_kobj, ®_attr_group)){
kobject_put(register_kobj);
return -ENOMEM;
}
return 0;
}
static void hello_exit(void){
printk(KERN_ALERT "last value was %s\n", param_buf);
kfree(param_buf);
kobject_put(register_kobj);
}
MODULE_LICENSE("Dual BSD/GPL");
module_init(hello_init);
module_exit(hello_exit);
You can test it in such a way:
cat /etc/fstab > /sys/kernel/test_1025_sym/put_parameters
For two string entries: copy a store_value function, register one more store_val_attribute and put it to attributes list.
I'm trying to compile a video driver on Ubuntu 10.04 LTS, here's the error:
**************************************************************************
* Building Techwell TW686x driver... *
* Type "make help" for a list of available targets. *
**************************************************************************
make -C /lib/modules/`uname -r`/build M="/home/v4/driver-686x-0.1.1" clean
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-43-generic'
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-43-generic'
make -C /lib/modules/`uname -r`/build M="/home/v4/driver-686x-0.1.1" modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-43-generic'
CC [M] /home/v4/driver-686x-0.1.1/tw686x-core.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-video.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-i2c.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-device.o
CC [M] /home/v4/driver-686x-0.1.1/i2c-sw.o
CC [M] /home/v4/driver-686x-0.1.1/tw686x-alsa.o
CC [M] /home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.o
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:341: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:343: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: error: unknown field ‘vaddr’ specified in initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: excess elements in struct initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: (near initialization for ‘qops’)
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c: In function ‘videobuf_queue_dma_contig_init_tw’:
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:357: warning: passing argument 2 of ‘videobuf_queue_core_init’ discards qualifiers from pointer target type
include/media/videobuf-core.h:197: note: expected ‘struct videobuf_queue_ops *’ but argument is of type ‘const struct videobuf_queue_ops *’
make[2]: *** [/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.o] Error 1
make[1]: *** [_module_/home/v4/driver-686x-0.1.1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-43-generic'
make: *** [modules] Error 2
My kernel is 2.6.32-43. My C is very rusty, so I'm asking the gurus.
From what I can see, the problem refers to variable videobuf_queue_ops in file videobuf-core.h, which i found in these locations:
/usr/src/linux-headers-2.6.24-24/include/media/videobuf-core.h
/usr/src/linux-headers-2.6.32-43/include/media/videobuf-core.h
/usr/src/linux-headers-2.6.24-32/include/media/videobuf-core.h
Here's the offending file (extract) videobuf-dma-contig-tw.c:
static struct videobuf_qtype_ops qops = {
.magic = MAGIC_QTYPE_OPS,
.alloc = __videobuf_alloc,
.iolock = __videobuf_iolock,
.mmap_mapper = __videobuf_mmap_mapper,
.vaddr = __videobuf_to_vaddr,
};
The definition of videobuf_qtype_ops in the header file looks like this :
struct videobuf_queue_ops {
int (*buf_setup)(struct videobuf_queue *q,
unsigned int *count, unsigned int *size);
int (*buf_prepare)(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field);
void (*buf_queue)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
void (*buf_release)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
};
#define MAGIC_QTYPE_OPS 0x12261003
/* Helper operations - device type dependent */
struct videobuf_qtype_ops {
u32 magic;
void *(*alloc) (size_t size);
void *(*vmalloc) (struct videobuf_buffer *buf);
int (*iolock) (struct videobuf_queue* q,
struct videobuf_buffer *vb,
struct v4l2_framebuffer *fbuf);
int (*mmap) (struct videobuf_queue *q,
unsigned int *count,
unsigned int *size,
enum v4l2_memory memory);
int (*sync) (struct videobuf_queue* q,
struct videobuf_buffer *buf);
int (*video_copy_to_user)(struct videobuf_queue *q,
char __user *data,
size_t count,
int nonblocking);
int (*copy_stream) (struct videobuf_queue *q,
char __user *data,
size_t count,
size_t pos,
int vbihack,
int nonblocking);
int (*mmap_free) (struct videobuf_queue *q);
int (*mmap_mapper) (struct videobuf_queue *q,
struct vm_area_struct *vma);
};
Should I change this header file? I'm not sure what the fix is, or whether I should even be changing Linux files - scary stuff!
Thanks for your help.
This part alone
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:343: warning: initialization from incompatible pointer type
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: error: unknown field ‘vaddr’ specified in initializer
/home/v4/driver-686x-0.1.1/videobuf-dma-contig-tw.c:344: warning: excess elements in struct initializer
tells us that the initializer and the struct are using different types, different field names, and different number of elements.
Definitely not the correct include file. :-)
You will have to figure out what version you should use, and make sure that one is in the include path (and not the others).
For some reason the compiler doesn't like this part:
static struct videobuf_qtype_ops qops = {
.magic = MAGIC_QTYPE_OPS,
.alloc = __videobuf_alloc,
.iolock = __videobuf_iolock,
.mmap_mapper = __videobuf_mmap_mapper,
.vaddr = __videobuf_to_vaddr,
};
The compiler told you the line number where the error had occurred:
videobuf-dma-contig-tw.c:344: error: unknown field ‘vaddr’ specified in initializer
Now the question is why there isn't a vaddr member in struct videobuf_qtype_ops. It could be under #if, but I don't know for sure. struct videobuf_qtype_ops isn't defined in this file.
You should've looked at this yourself. Posting lots of irrelevant code isn't a good use of people's time.