[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48A8D98B.9020701@cn.fujitsu.com>
Date: Mon, 18 Aug 2008 10:08:11 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: Theodore Tso <tytso@....edu>
CC: linux-ext4@...r.kernel.org
Subject: Re: [PATCH 1/3] ext4: add EXT4_IOC_GETCRTIME ioctl
(sorry for the so dealyed reply, I was offline last week.)
Theodore Tso wrote:
> On Wed, Aug 06, 2008 at 05:09:07PM +0800, Li Zefan wrote:
>> + case EXT4_IOC_GETCRTIME:
>> + return put_user(ei->i_crtime, (struct timespec __user *)arg);
>> +
>
> I'm worried about writing a struct timespec directly to user space,
> because the kernel's idea of what is struct timespec might not be the
> same as the userspace's understanding of struct timespec ---
We have system call nanosleep(), which copies a struct timespec directly
from user space.
> specifically, because of the question of the width of time_t might be
> different in the kernel and in userspace on different architectures.
>
But timeval.tv_sec is also of type time_t. Also sys_time() writes a time_t
directry to user space.
I should not use put_user() though...
+ return copy_to_user((struct timespec __user *)arg,
+ &ei->i_crtime, sizeof(ei->i_crtime));
> I think we would be better off explicitly defining a structure, or
> just returning the seconds and nanoseconds in explicit primitive
> types.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists