[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] linux-user: add name_to_handle_at/open_by_ha
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2] linux-user: add name_to_handle_at/open_by_handle_at |
Date: |
Fri, 4 Sep 2015 14:45:23 +0100 |
On 1 September 2015 at 21:27, Laurent Vivier <address@hidden> wrote:
> This patch allows to run example given by open_by_handle_at(2):
>
> The following shell session demonstrates the use of these two programs:
>
> $ echo 'Can you please think about it?' > cecilia.txt
> $ ./t_name_to_handle_at cecilia.txt > fh
> $ ./t_open_by_handle_at < fh
> open_by_handle_at: Operation not permitted
> $ sudo ./t_open_by_handle_at < fh # Need CAP_SYS_ADMIN
> Read 31 bytes
> $ rm cecilia.txt
>
> Now we delete and (quickly) re-create the file so that it has the same
> content and (by chance) the same inode.[...]
>
> $ stat --printf="%i\n" cecilia.txt # Display inode number
> 4072121
> $ rm cecilia.txt
> $ echo 'Can you please think about it?' > cecilia.txt
> $ stat --printf="%i\n" cecilia.txt # Check inode number
> 4072121
> $ sudo ./t_open_by_handle_at < fh
> open_by_handle_at: Stale NFS file handle
>
> See the man page for source code.
>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
> v2: Rename function parameters, swap fh->handle_type in both functions,
> When I have re-tested the patch I have found a bug in the size of
> the data, so I fix this too (handle_bytes is the size of f_handle[]
> only, not of the whole structure)
Reviewed-by: Peter Maydell <address@hidden>
(I guess the signalfd patch needs to be rebased on top of this,
since this adds another syscall that returns an fd...)
thanks
-- PMM