* [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
@ 2011-08-03 1:58 Wang Sheng-Hui
2011-08-03 2:04 ` Li Zefan
0 siblings, 1 reply; 8+ messages in thread
From: Wang Sheng-Hui @ 2011-08-03 1:58 UTC (permalink / raw)
To: Theodore Ts'o, Jan Kara, linux-ext4, linux-kernel
The patch is against 3.0
The arg of kjournald/kjournald2 is void *, and points to type
journal_t. We should convert it to journal_t * explicitly in
the kjournald/kjournald2 function body.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
fs/jbd/journal.c | 2 +-
fs/jbd2/journal.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index e2d4285..32956fd 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -116,7 +116,7 @@ static void commit_timeout(unsigned long __data)
static int kjournald(void *arg)
{
- journal_t *journal = arg;
+ journal_t *journal = (journal_t *)arg;
transaction_t *transaction;
/*
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 0dfa5b5..c4f4bfc 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -129,7 +129,7 @@ static void commit_timeout(unsigned long __data)
static int kjournald2(void *arg)
{
- journal_t *journal = arg;
+ journal_t *journal = (journal_t *)arg;
transaction_t *transaction;
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
2011-08-03 1:58 [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2 Wang Sheng-Hui
@ 2011-08-03 2:04 ` Li Zefan
2011-08-03 2:17 ` Wang Sheng-Hui
2011-08-03 5:38 ` Jesper Juhl
0 siblings, 2 replies; 8+ messages in thread
From: Li Zefan @ 2011-08-03 2:04 UTC (permalink / raw)
To: Wang Sheng-Hui; +Cc: Theodore Ts'o, Jan Kara, linux-ext4, linux-kernel
09:58, Wang Sheng-Hui wrote:
> The patch is against 3.0
>
> The arg of kjournald/kjournald2 is void *, and points to type
> journal_t. We should convert it to journal_t * explicitly in
> the kjournald/kjournald2 function body.
>
Why?
Implicit convertion from void * to foo * is ok. Did the compiler
complain about this to you?
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
> ---
> fs/jbd/journal.c | 2 +-
> fs/jbd2/journal.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
> index e2d4285..32956fd 100644
> --- a/fs/jbd/journal.c
> +++ b/fs/jbd/journal.c
> @@ -116,7 +116,7 @@ static void commit_timeout(unsigned long __data)
>
> static int kjournald(void *arg)
> {
> - journal_t *journal = arg;
> + journal_t *journal = (journal_t *)arg;
> transaction_t *transaction;
>
> /*
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 0dfa5b5..c4f4bfc 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -129,7 +129,7 @@ static void commit_timeout(unsigned long __data)
>
> static int kjournald2(void *arg)
> {
> - journal_t *journal = arg;
> + journal_t *journal = (journal_t *)arg;
> transaction_t *transaction;
>
> /*
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
2011-08-03 2:04 ` Li Zefan
@ 2011-08-03 2:17 ` Wang Sheng-Hui
2011-08-03 2:31 ` Li Zefan
` (2 more replies)
2011-08-03 5:38 ` Jesper Juhl
1 sibling, 3 replies; 8+ messages in thread
From: Wang Sheng-Hui @ 2011-08-03 2:17 UTC (permalink / raw)
To: Li Zefan; +Cc: Theodore Ts'o, Jan Kara, linux-ext4, linux-kernel
On 2011年08月03日 10:04, Li Zefan wrote:
> 09:58, Wang Sheng-Hui wrote:
>> The patch is against 3.0
>>
>> The arg of kjournald/kjournald2 is void *, and points to type
>> journal_t. We should convert it to journal_t * explicitly in
>> the kjournald/kjournald2 function body.
>>
>
> Why?
>
> Implicit convertion from void * to foo * is ok. Did the compiler
> complain about this to you?
I remember any * can be assigned directly to void * in ANSI C, but
void * should be converted to specific point * type. Right?
And I checked the code of kswapd, in which explicitly conversion is
taken on the arg *. I think it should do so in journal.c too.
>
>> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
>> ---
>> fs/jbd/journal.c | 2 +-
>> fs/jbd2/journal.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
>> index e2d4285..32956fd 100644
>> --- a/fs/jbd/journal.c
>> +++ b/fs/jbd/journal.c
>> @@ -116,7 +116,7 @@ static void commit_timeout(unsigned long __data)
>>
>> static int kjournald(void *arg)
>> {
>> - journal_t *journal = arg;
>> + journal_t *journal = (journal_t *)arg;
>> transaction_t *transaction;
>>
>> /*
>> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
>> index 0dfa5b5..c4f4bfc 100644
>> --- a/fs/jbd2/journal.c
>> +++ b/fs/jbd2/journal.c
>> @@ -129,7 +129,7 @@ static void commit_timeout(unsigned long __data)
>>
>> static int kjournald2(void *arg)
>> {
>> - journal_t *journal = arg;
>> + journal_t *journal = (journal_t *)arg;
>> transaction_t *transaction;
>>
>> /*
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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] 8+ messages in thread
* Re: [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
2011-08-03 2:17 ` Wang Sheng-Hui
@ 2011-08-03 2:31 ` Li Zefan
2011-08-03 2:52 ` Américo Wang
2011-08-03 3:24 ` Arnaud Lacombe
2 siblings, 0 replies; 8+ messages in thread
From: Li Zefan @ 2011-08-03 2:31 UTC (permalink / raw)
To: Wang Sheng-Hui; +Cc: Theodore Ts'o, Jan Kara, linux-ext4, linux-kernel
Wang Sheng-Hui wrote:
> On 2011年08月03日 10:04, Li Zefan wrote:
>> 09:58, Wang Sheng-Hui wrote:
>>> The patch is against 3.0
>>>
>>> The arg of kjournald/kjournald2 is void *, and points to type
>>> journal_t. We should convert it to journal_t * explicitly in
>>> the kjournald/kjournald2 function body.
>>>
>>
>> Why?
>>
>> Implicit convertion from void * to foo * is ok. Did the compiler
>> complain about this to you?
>
> I remember any * can be assigned directly to void * in ANSI C, but
> void * should be converted to specific point * type. Right?
>
No.
> And I checked the code of kswapd, in which explicitly conversion is
> taken on the arg *. I think it should do so in journal.c too.
>
Please check more similar code.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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] 8+ messages in thread
* Re: [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
2011-08-03 2:17 ` Wang Sheng-Hui
2011-08-03 2:31 ` Li Zefan
@ 2011-08-03 2:52 ` Américo Wang
2011-08-03 2:55 ` Wang Sheng-Hui
2011-08-03 3:24 ` Arnaud Lacombe
2 siblings, 1 reply; 8+ messages in thread
From: Américo Wang @ 2011-08-03 2:52 UTC (permalink / raw)
To: Wang Sheng-Hui
Cc: Li Zefan, Theodore Ts'o, Jan Kara, linux-ext4, linux-kernel
On Wed, Aug 3, 2011 at 10:17 AM, Wang Sheng-Hui <shhuiw@gmail.com> wrote:
>
> I remember any * can be assigned directly to void * in ANSI C, but
> void * should be converted to specific point * type. Right?
>
C99 6.3.2.3
A pointer to void may be converted to or from a pointer to any
incomplete or object
type. A pointer to any incomplete or object type may be converted to a
pointer to void
and back again; the result shall compare equal to the original pointer.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
2011-08-03 2:52 ` Américo Wang
@ 2011-08-03 2:55 ` Wang Sheng-Hui
0 siblings, 0 replies; 8+ messages in thread
From: Wang Sheng-Hui @ 2011-08-03 2:55 UTC (permalink / raw)
To: Américo Wang
Cc: Li Zefan, Theodore Ts'o, Jan Kara, linux-ext4, linux-kernel
On 2011年08月03日 10:52, Américo Wang wrote:
> On Wed, Aug 3, 2011 at 10:17 AM, Wang Sheng-Hui <shhuiw@gmail.com> wrote:
>>
>> I remember any * can be assigned directly to void * in ANSI C, but
>> void * should be converted to specific point * type. Right?
>>
>
> C99 6.3.2.3
Got it. Thanks,
>
> A pointer to void may be converted to or from a pointer to any
> incomplete or object
> type. A pointer to any incomplete or object type may be converted to a
> pointer to void
> and back again; the result shall compare equal to the original pointer.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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] 8+ messages in thread
* Re: [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
2011-08-03 2:17 ` Wang Sheng-Hui
2011-08-03 2:31 ` Li Zefan
2011-08-03 2:52 ` Américo Wang
@ 2011-08-03 3:24 ` Arnaud Lacombe
2 siblings, 0 replies; 8+ messages in thread
From: Arnaud Lacombe @ 2011-08-03 3:24 UTC (permalink / raw)
To: Wang Sheng-Hui
Cc: Li Zefan, Theodore Ts'o, Jan Kara, linux-ext4, linux-kernel
Hi,
On Tue, Aug 2, 2011 at 10:17 PM, Wang Sheng-Hui <shhuiw@gmail.com> wrote:
> And I checked the code of kswapd, in which explicitly conversion is
> taken on the arg *. I think it should do so in journal.c too.
>
because it is done wrong somewhere is no argument to do it wrong here ...
- Arnaud
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2
2011-08-03 2:04 ` Li Zefan
2011-08-03 2:17 ` Wang Sheng-Hui
@ 2011-08-03 5:38 ` Jesper Juhl
1 sibling, 0 replies; 8+ messages in thread
From: Jesper Juhl @ 2011-08-03 5:38 UTC (permalink / raw)
To: Li Zefan
Cc: Wang Sheng-Hui, Theodore Ts'o, Jan Kara, linux-ext4,
linux-kernel
On Wed, 3 Aug 2011, Li Zefan wrote:
> 09:58, Wang Sheng-Hui wrote:
> > The patch is against 3.0
> >
> > The arg of kjournald/kjournald2 is void *, and points to type
> > journal_t. We should convert it to journal_t * explicitly in
> > the kjournald/kjournald2 function body.
> >
>
> Why?
>
> Implicit convertion from void * to foo * is ok. Did the compiler
> complain about this to you?
>
Not only is it perfectly OK to rely on the implicit conversion, a lot of
work has gone into actively removing such unneeded explicit casts over the
years, so let's not introduce new ones.
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-08-03 5:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-03 1:58 [PATCH] jbd/jbd2: add pointer type conversion on void *arg from void * to journal_t * explicitly in kjournald/kjournald2 Wang Sheng-Hui
2011-08-03 2:04 ` Li Zefan
2011-08-03 2:17 ` Wang Sheng-Hui
2011-08-03 2:31 ` Li Zefan
2011-08-03 2:52 ` Américo Wang
2011-08-03 2:55 ` Wang Sheng-Hui
2011-08-03 3:24 ` Arnaud Lacombe
2011-08-03 5:38 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox