* Problem: plist_add undefined!
@ 2011-12-20 9:24 ` Monica Puig-Pey
0 siblings, 0 replies; 6+ messages in thread
From: Monica Puig-Pey @ 2011-12-20 9:24 UTC (permalink / raw)
To: linux-rt-users, linux-kernel
Hi there,
As I told in previous posts in this list I'm developing drivers for the
linux-rt kernel version in Ubuntu 10.04, based on 2.6.31 with rt_preempt
patch.
Currently I'm studying how to use priority lists (linux/plist.h) in a
module. I read some pages from the Linux Kernel Development book to
learn how linked list work in the kernel.
I made and easy example, shown below, trying to put three elements, with
their priorities, in a plist_head.
Then, I had two problems:
* First error:
An error is produced when using the MACROs:
- PLIST_HEAD_INIT(head, _lock)
- PLIST_NODE_INIT(node, __prio)
it says :
/home/monica/Escritorio/plists/priolist.c: In function 'init_module':
/home/monica/Escritorio/plists/priolist.c:67: error: expected expression
before '.' token
--> To solve this I used the functions:
- static inline void plist_head_init(struct plist_head *head, struct
spinlock *lock)
- static inline void plist_node_init(struct plist_node *node, int prio)
But I still have the problem with the MACRO
* Second error, problem using plist_add:
It says:
“WARNING: "plist_add" [/home/monica/Escritorio/plists/priolist.ko]
undefined! ”
I made the module GPL, I don't know what am I doing wrong.
Does anybody have an idea what is happening?
Thanks in advance for any help,
Cheers,
Monica
CODE:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/plist.h>
#include <linux/spinlock.h>
MODULE_LICENSE("GPL");
#define pid_miguel 1
#define fichero_miguel 1
#define prio_miguel 10
#define pid_monica 2
#define fichero_monica 1
#define prio_monica 30
#define pid_hector 3
#define fichero_hector 1
#define prio_hector 20
static DEFINE_SPINLOCK(lock);
struct misdatos
{
int pid;
int fichero;
struct plist_node token_del_plist;
};
int init_module(void)
{
struct plist_head mi_lista_de_datos;
//struct spinlock lock;
struct misdatos datos_miguel;
struct misdatos datos_monica;
struct misdatos datos_hector;
struct misdatos *elemento_iterador;
// Inicializo mi lista
//PLIST_HEAD_INIT( mi_lista_de_datos, lock);
plist_head_init( &mi_lista_de_datos, &lock);
// Creo mis datos
datos_miguel.pid = pid_miguel;
datos_miguel.fichero = fichero_miguel;
datos_monica.pid = pid_monica;
datos_monica.fichero = fichero_monica;
datos_hector.pid = pid_hector;
datos_hector.fichero = fichero_hector;
// Inicializamos los nodos CON LA PRIORIDAD
//PLIST_NODE_INIT(datos_miguel.token_del_plist, prio_miguel);
//PLIST_NODE_INIT(datos_monica.token_del_plist, prio_monica);
//PLIST_NODE_INIT(datos_hector.token_del_plist, prio_hector);
plist_node_init(&datos_miguel.token_del_plist, prio_miguel);
plist_node_init(&datos_monica.token_del_plist, prio_monica);
plist_node_init(&datos_hector.token_del_plist, prio_hector);
// Los agnadimos
plist_add(&(datos_miguel.token_del_plist), &mi_lista_de_datos);
plist_add(&(datos_monica.token_del_plist), &mi_lista_de_datos);
plist_add(&(datos_hector.token_del_plist), &mi_lista_de_datos);
plist_for_each_entry(elemento_iterador, &mi_lista_de_datos, token_del_plist)
{
printk(KERN_INFO "El pid es : %d, con prioridad %d\n",
elemento_iterador->pid, elemento_iterador->token_del_plist.prio);
}
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "cleanup_module() called\n");
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Problem: plist_add undefined!
@ 2011-12-20 9:24 ` Monica Puig-Pey
0 siblings, 0 replies; 6+ messages in thread
From: Monica Puig-Pey @ 2011-12-20 9:24 UTC (permalink / raw)
To: linux-rt-users, linux-kernel
Hi there,
As I told in previous posts in this list I'm developing drivers for the
linux-rt kernel version in Ubuntu 10.04, based on 2.6.31 with rt_preempt
patch.
Currently I'm studying how to use priority lists (linux/plist.h) in a
module. I read some pages from the Linux Kernel Development book to
learn how linked list work in the kernel.
I made and easy example, shown below, trying to put three elements, with
their priorities, in a plist_head.
Then, I had two problems:
* First error:
An error is produced when using the MACROs:
- PLIST_HEAD_INIT(head, _lock)
- PLIST_NODE_INIT(node, __prio)
it says :
/home/monica/Escritorio/plists/priolist.c: In function 'init_module':
/home/monica/Escritorio/plists/priolist.c:67: error: expected expression
before '.' token
--> To solve this I used the functions:
- static inline void plist_head_init(struct plist_head *head, struct
spinlock *lock)
- static inline void plist_node_init(struct plist_node *node, int prio)
But I still have the problem with the MACRO
* Second error, problem using plist_add:
It says:
“WARNING: "plist_add" [/home/monica/Escritorio/plists/priolist.ko]
undefined! ”
I made the module GPL, I don't know what am I doing wrong.
Does anybody have an idea what is happening?
Thanks in advance for any help,
Cheers,
Monica
CODE:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/plist.h>
#include <linux/spinlock.h>
MODULE_LICENSE("GPL");
#define pid_miguel 1
#define fichero_miguel 1
#define prio_miguel 10
#define pid_monica 2
#define fichero_monica 1
#define prio_monica 30
#define pid_hector 3
#define fichero_hector 1
#define prio_hector 20
static DEFINE_SPINLOCK(lock);
struct misdatos
{
int pid;
int fichero;
struct plist_node token_del_plist;
};
int init_module(void)
{
struct plist_head mi_lista_de_datos;
//struct spinlock lock;
struct misdatos datos_miguel;
struct misdatos datos_monica;
struct misdatos datos_hector;
struct misdatos *elemento_iterador;
// Inicializo mi lista
//PLIST_HEAD_INIT( mi_lista_de_datos, lock);
plist_head_init( &mi_lista_de_datos, &lock);
// Creo mis datos
datos_miguel.pid = pid_miguel;
datos_miguel.fichero = fichero_miguel;
datos_monica.pid = pid_monica;
datos_monica.fichero = fichero_monica;
datos_hector.pid = pid_hector;
datos_hector.fichero = fichero_hector;
// Inicializamos los nodos CON LA PRIORIDAD
//PLIST_NODE_INIT(datos_miguel.token_del_plist, prio_miguel);
//PLIST_NODE_INIT(datos_monica.token_del_plist, prio_monica);
//PLIST_NODE_INIT(datos_hector.token_del_plist, prio_hector);
plist_node_init(&datos_miguel.token_del_plist, prio_miguel);
plist_node_init(&datos_monica.token_del_plist, prio_monica);
plist_node_init(&datos_hector.token_del_plist, prio_hector);
// Los agnadimos
plist_add(&(datos_miguel.token_del_plist), &mi_lista_de_datos);
plist_add(&(datos_monica.token_del_plist), &mi_lista_de_datos);
plist_add(&(datos_hector.token_del_plist), &mi_lista_de_datos);
plist_for_each_entry(elemento_iterador, &mi_lista_de_datos, token_del_plist)
{
printk(KERN_INFO "El pid es : %d, con prioridad %d\n",
elemento_iterador->pid, elemento_iterador->token_del_plist.prio);
}
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "cleanup_module() called\n");
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Fwd: Problem: plist_add undefined!
2011-12-20 9:24 ` Monica Puig-Pey
(?)
@ 2011-12-21 21:46 ` Julie Sullivan
2011-12-21 22:34 ` Jonathan Neuschäfer
-1 siblings, 1 reply; 6+ messages in thread
From: Julie Sullivan @ 2011-12-21 21:46 UTC (permalink / raw)
To: kernelnewbies
Hi All,
If you reply to this please make sure to Cc Monica Puig-Pey
<puigpeym@unican.es> as well as kernelnewbies each time , I doubt
she's subscribed.
Cheers
Julie
---------- Forwarded message ----------
From: Monica Puig-Pey <puigpeym@unican.es>
Date: Tue, Dec 20, 2011 at 9:24 AM
Subject: Problem: plist_add undefined!
To: linux-rt-users at vger.kernel.org, linux-kernel at vger.kernel.org
Hi there,
As I told in previous posts in this list I'm developing drivers for the
linux-rt kernel version in Ubuntu 10.04, based on 2.6.31 with rt_preempt patch.
Currently I'm studying how to use priority lists (linux/plist.h) in a
module. I read some pages from the Linux Kernel Development book to
learn how linked list work in the kernel.
I made and easy example, shown below, trying to put three elements,
with their priorities, in a plist_head.
Then, I had two problems:
* First error:
?An error is produced when using the MACROs:
? ?- PLIST_HEAD_INIT(head, _lock)
? ?- PLIST_NODE_INIT(node, __prio)
?it says :
/home/monica/Escritorio/plists/priolist.c: In function 'init_module':
/home/monica/Escritorio/plists/priolist.c:67: error: expected
expression before '.' token
?--> To solve this I used the functions:
- static inline void plist_head_init(struct plist_head *head, struct
spinlock *lock)
- static inline void plist_node_init(struct plist_node *node, int prio)
?But I still have the problem with the MACRO
* Second error, problem using plist_add:
?It says:
?WARNING: "plist_add" [/home/monica/Escritorio/plists/priolist.ko] undefined! ?
?I made the module GPL, I don't know what am I doing wrong.
Does anybody have an idea what is happening?
Thanks in advance for any help,
Cheers,
? ? ? ?Monica
CODE:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/plist.h>
#include <linux/spinlock.h>
MODULE_LICENSE("GPL");
#define pid_miguel 1
#define fichero_miguel 1
#define prio_miguel 10
#define pid_monica 2
#define fichero_monica 1
#define prio_monica 30
#define pid_hector 3
#define fichero_hector 1
#define prio_hector 20
static DEFINE_SPINLOCK(lock);
struct misdatos
{
?int pid;
?int fichero;
?struct plist_node token_del_plist;
};
int init_module(void)
{
?struct plist_head mi_lista_de_datos;
?//struct spinlock lock;
?struct misdatos datos_miguel;
?struct misdatos datos_monica;
?struct misdatos datos_hector;
?struct misdatos *elemento_iterador;
?// Inicializo mi lista
?//PLIST_HEAD_INIT( mi_lista_de_datos, lock);
?plist_head_init( &mi_lista_de_datos, &lock);
?// Creo mis datos
?datos_miguel.pid = pid_miguel;
?datos_miguel.fichero = fichero_miguel;
?datos_monica.pid = pid_monica;
?datos_monica.fichero = fichero_monica;
?datos_hector.pid = pid_hector;
?datos_hector.fichero = fichero_hector;
?// Inicializamos los nodos CON LA PRIORIDAD
?//PLIST_NODE_INIT(datos_miguel.token_del_plist, prio_miguel);
?//PLIST_NODE_INIT(datos_monica.token_del_plist, prio_monica);
?//PLIST_NODE_INIT(datos_hector.token_del_plist, prio_hector);
?plist_node_init(&datos_miguel.token_del_plist, prio_miguel);
?plist_node_init(&datos_monica.token_del_plist, prio_monica);
?plist_node_init(&datos_hector.token_del_plist, prio_hector);
?// Los agnadimos
?plist_add(&(datos_miguel.token_del_plist), &mi_lista_de_datos);
?plist_add(&(datos_monica.token_del_plist), &mi_lista_de_datos);
?plist_add(&(datos_hector.token_del_plist), &mi_lista_de_datos);
plist_for_each_entry(elemento_iterador, &mi_lista_de_datos, token_del_plist)
?{
printk(KERN_INFO "El pid es : %d, con prioridad %d\n",
elemento_iterador->pid, elemento_iterador->token_del_plist.prio);
?}
?return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "cleanup_module() called\n");
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
Please read the FAQ at ?http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Fwd: Problem: plist_add undefined!
2011-12-21 21:46 ` Fwd: " Julie Sullivan
@ 2011-12-21 22:34 ` Jonathan Neuschäfer
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Neuschäfer @ 2011-12-21 22:34 UTC (permalink / raw)
To: kernelnewbies
Monica Puig-Pey <puigpeym@unican.es> wrote:
> ?An error is produced when using the MACROs:
> ? ?- PLIST_HEAD_INIT(head, _lock)
In the version i'm looking at (v3.2-rc5) PLIST_NODE_INIT takes only
one argument.
> ? ?- PLIST_NODE_INIT(node, __prio)
>
> ?it says :
>
>
> /home/monica/Escritorio/plists/priolist.c: In function 'init_module':
> /home/monica/Escritorio/plists/priolist.c:67: error: expected
> expression before '.' token
You need to use it like this:
struct plist_head head = PLIST_HEAD_INIT(head);
(it can only be used for static initializations)
> ?WARNING: "plist_add" [/home/monica/Escritorio/plists/priolist.ko] undefined! ?
>
> ?I made the module GPL, I don't know what am I doing wrong.
>
> Does anybody have an idea what is happening?
Hmm. plist_add and plist_del seem to be lacking EXPORT_SYMBOL
alltogether; could you try compiling with this patch as a workaround?
----------------------------------------
diff --git a/lib/plist.c b/lib/plist.c
index a0a4da4..e9cca99 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -133,6 +133,9 @@ void plist_del(struct plist_node *node, struct plist_head *head)
plist_check_head(head);
}
+EXPORT_SYMBOL(plist_add);
+EXPORT_SYMBOL(plist_del);
+
#ifdef CONFIG_DEBUG_PI_LIST
#include <linux/sched.h>
#include <linux/module.h>
----------------------------------------
Hope This Helps,
Jonathan Neusch?fer
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Problem: plist_add undefined!
2011-12-20 9:24 ` Monica Puig-Pey
@ 2011-12-22 3:51 ` Steven Rostedt
-1 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2011-12-22 3:51 UTC (permalink / raw)
To: Monica Puig-Pey; +Cc: linux-rt-users, linux-kernel, Thomas Gleixner
On Tue, 2011-12-20 at 10:24 +0100, Monica Puig-Pey wrote:
> Hi there,
>
> As I told in previous posts in this list I'm developing drivers for the
>
> linux-rt kernel version in Ubuntu 10.04, based on 2.6.31 with rt_preempt
> patch.
>
> Currently I'm studying how to use priority lists (linux/plist.h) in a
> module. I read some pages from the Linux Kernel Development book to
> learn how linked list work in the kernel.
>
> I made and easy example, shown below, trying to put three elements, with
> their priorities, in a plist_head.
>
> Then, I had two problems:
>
> * First error:
>
> An error is produced when using the MACROs:
> - PLIST_HEAD_INIT(head, _lock)
> - PLIST_NODE_INIT(node, __prio)
Right, the macros are for static declarations. Either global variables
or a variable marked as static:
struct plist_head myhead = PLIST_HEAD_INIT(myhead, mylock);
or
int foo() {
static struct plist_head bar = PLIST_HEAD_INIT(bar, mylock);
[...]
}
or
struct foo bar = {
.zoop = PLIST_HEAD_INIT(bar.zoop, mylock),
};
>
> it says :
>
>
> /home/monica/Escritorio/plists/priolist.c: In function 'init_module':
> /home/monica/Escritorio/plists/priolist.c:67: error: expected expression
> before '.' token
>
>
> --> To solve this I used the functions:
>
>
> - static inline void plist_head_init(struct plist_head *head, struct
> spinlock *lock)
>
> - static inline void plist_node_init(struct plist_node *node, int prio)
Right, for runtime code you must use these.
>
> But I still have the problem with the MACRO
>
>
>
>
> * Second error, problem using plist_add:
>
> It says:
>
>
> “WARNING: "plist_add" [/home/monica/Escritorio/plists/priolist.ko]
> undefined! ”
Simple, plist_add() isn't exported to modules.
Hmm, none of the plist functions are. I guess it wouldn't hurt to make
them EXPORT_SYMBOL_GPL()
Maybe we'll do that. Is this just for learning or are you planing on
adding a real GPL module to Linux that uses plists. For learning, it may
not be worth adding these symbols, but if you have a legit reason for
modules to use plists, than I don't see any harm in exporting them.
-- Steve
>
> I made the module GPL, I don't know what am I doing wrong.
>
> Does anybody have an idea what is happening?
>
> Thanks in advance for any help,
>
> Cheers,
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Problem: plist_add undefined!
@ 2011-12-22 3:51 ` Steven Rostedt
0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2011-12-22 3:51 UTC (permalink / raw)
To: Monica Puig-Pey; +Cc: linux-rt-users, linux-kernel, Thomas Gleixner
On Tue, 2011-12-20 at 10:24 +0100, Monica Puig-Pey wrote:
> Hi there,
>
> As I told in previous posts in this list I'm developing drivers for the
>
> linux-rt kernel version in Ubuntu 10.04, based on 2.6.31 with rt_preempt
> patch.
>
> Currently I'm studying how to use priority lists (linux/plist.h) in a
> module. I read some pages from the Linux Kernel Development book to
> learn how linked list work in the kernel.
>
> I made and easy example, shown below, trying to put three elements, with
> their priorities, in a plist_head.
>
> Then, I had two problems:
>
> * First error:
>
> An error is produced when using the MACROs:
> - PLIST_HEAD_INIT(head, _lock)
> - PLIST_NODE_INIT(node, __prio)
Right, the macros are for static declarations. Either global variables
or a variable marked as static:
struct plist_head myhead = PLIST_HEAD_INIT(myhead, mylock);
or
int foo() {
static struct plist_head bar = PLIST_HEAD_INIT(bar, mylock);
[...]
}
or
struct foo bar = {
.zoop = PLIST_HEAD_INIT(bar.zoop, mylock),
};
>
> it says :
>
>
> /home/monica/Escritorio/plists/priolist.c: In function 'init_module':
> /home/monica/Escritorio/plists/priolist.c:67: error: expected expression
> before '.' token
>
>
> --> To solve this I used the functions:
>
>
> - static inline void plist_head_init(struct plist_head *head, struct
> spinlock *lock)
>
> - static inline void plist_node_init(struct plist_node *node, int prio)
Right, for runtime code you must use these.
>
> But I still have the problem with the MACRO
>
>
>
>
> * Second error, problem using plist_add:
>
> It says:
>
>
> “WARNING: "plist_add" [/home/monica/Escritorio/plists/priolist.ko]
> undefined! ”
Simple, plist_add() isn't exported to modules.
Hmm, none of the plist functions are. I guess it wouldn't hurt to make
them EXPORT_SYMBOL_GPL()
Maybe we'll do that. Is this just for learning or are you planing on
adding a real GPL module to Linux that uses plists. For learning, it may
not be worth adding these symbols, but if you have a legit reason for
modules to use plists, than I don't see any harm in exporting them.
-- Steve
>
> I made the module GPL, I don't know what am I doing wrong.
>
> Does anybody have an idea what is happening?
>
> Thanks in advance for any help,
>
> Cheers,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-12-22 3:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-20 9:24 Problem: plist_add undefined! Monica Puig-Pey
2011-12-20 9:24 ` Monica Puig-Pey
2011-12-21 21:46 ` Fwd: " Julie Sullivan
2011-12-21 22:34 ` Jonathan Neuschäfer
2011-12-22 3:51 ` Steven Rostedt
2011-12-22 3:51 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.