All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] coccinelle problems with kernel code
@ 2015-09-08 18:07 Jörn Engel
  2015-09-08 21:17 ` Julia Lawall
  0 siblings, 1 reply; 9+ messages in thread
From: Jörn Engel @ 2015-09-08 18:07 UTC (permalink / raw)
  To: cocci

Tried to use coccinelle on the linux kernel for the first time.  It
seems to get things mostly right, but not quite.  Here is the semantic
patch:

@@ expression E; @@
-down_read(&E->mmap_sem)
+mm_read_lock(E)
@@ expression E; @@
-down_read_trylock(&E->mmap_sem)
+mm_read_trylock(E)
@@ expression E; @@
-up_read(&E->mmap_sem)
+mm_read_unlock(E)
@@ expression E; @@
-down_write(&E->mmap_sem)
+mm_write_lock(E)
@@ expression E; @@
-down_write_trylock(&E->mmap_sem)
+mm_write_trylock(E)
@@ expression E; @@
-up_write(&E->mmap_sem)
+mm_write_unlock(E)

I run into problems whenever handling system calls.  Looks like the
SYSCALL_DEFINE5() macro and friends are causing problems.  Here is my
attempt to handle things.

#define SYSCALL_DEFINE1(func, t1, a1) \
	asmlinkage unsigned long func(t1 a1)
#define SYSCALL_DEFINE2(func, t1, a1, t2, a2) \
	asmlinkage unsigned long func(t1 a1, t2 a2)
#define SYSCALL_DEFINE3(func, t1, a1, t2, a2, t3, a3) \
	asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3)
#define SYSCALL_DEFINE4(func, t1, a1, t2, a2, t3, a3, t4, a4) \
	asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3, t4 a4)
#define SYSCALL_DEFINE5(func, t1, a1, t2, a2, t3, a3, t4, a4, t5, a5) \
	asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5)
#define SYSCALL_DEFINE6(func, t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6) \
	asmlinkage unsigned long func(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6)

Should that be included into standard.h?

J?rn

--
It is a clich? that most clich?s are true, but then, like most clich?s,
that clich? is untrue.
-- Stephen Fry

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-09 17:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-08 18:07 [Cocci] coccinelle problems with kernel code Jörn Engel
2015-09-08 21:17 ` Julia Lawall
2015-09-08 21:45   ` Jörn Engel
2015-09-09  5:24     ` Julia Lawall
2015-09-09  5:57       ` Jörn Engel
2015-09-09  8:22         ` SF Markus Elfring
2015-09-09 10:08         ` Julia Lawall
2015-09-09 16:40           ` Jörn Engel
2015-09-09 17:50             ` Julia Lawall

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.