[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 15/18] Fix unavailable fields in stbuf under Win
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 15/18] Fix unavailable fields in stbuf under Windows. |
Date: |
Mon, 6 Nov 2017 15:36:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 29/09/2017 13:13, Michael Fritscher wrote:
> @@ -886,14 +886,34 @@ static void stat_to_v9stat_dotl(V9fsState *s, const
> struct stat *stbuf,
> v9lstat->st_gid = stbuf->st_gid;
> v9lstat->st_rdev = stbuf->st_rdev;
> v9lstat->st_size = stbuf->st_size;
> +#ifdef _WIN32
> + /* Blksize is the optimal EA-block,
> + while blocks always refers to 512 byte blocks
> + */
> + v9lstat->st_blksize = 4096;
> + v9lstat->st_blocks = ((stbuf->st_size + 1) / 512) + 1;
> +#else
> v9lstat->st_blksize = stbuf->st_blksize;
> v9lstat->st_blocks = stbuf->st_blocks;
> +#endif
> v9lstat->st_atime_sec = stbuf->st_atime;
> +#ifdef _WIN32
> + v9lstat->st_atime_nsec = 0;
> +#else
> v9lstat->st_atime_nsec = stbuf->st_atim.tv_nsec;
> +#endif
> v9lstat->st_mtime_sec = stbuf->st_mtime;
> +#ifdef _WIN32
> + v9lstat->st_mtime_nsec = 0;
> +#else
> v9lstat->st_mtime_nsec = stbuf->st_mtim.tv_nsec;
> +#endif
> v9lstat->st_ctime_sec = stbuf->st_ctime;
> +#ifdef _WIN32
> + v9lstat->st_ctime_nsec = 0;
> +#else
> v9lstat->st_ctime_nsec = stbuf->st_ctim.tv_nsec;
> +#endif
> /* Currently we only support BASIC fields in stat */
> v9lstat->st_result_mask = P9_STATS_BASIC;
>
Likewise, I think it should be struct FileOperations's lstat member that
uses struct V9fsStatDotl instead of struct stat. Then
stat_to_v9stat_dotl would be hidden inside 9p-local.c (and 9p-local.c
isn't going to be used by Windows at all, so this patch disappears).
Paolo
- Re: [Qemu-devel] [PATCH 15/18] Fix unavailable fields in stbuf under Windows.,
Paolo Bonzini <=