From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8AHw-0007HE-Fi for qemu-devel@nongnu.org; Tue, 28 Jan 2014 10:09:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8AHn-0002Ko-Lk for qemu-devel@nongnu.org; Tue, 28 Jan 2014 10:09:20 -0500 Received: from mga02.intel.com ([134.134.136.20]:21797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8AHn-0002KZ-FT for qemu-devel@nongnu.org; Tue, 28 Jan 2014 10:09:11 -0500 From: "Kirill A. Shutemov" Date: Tue, 28 Jan 2014 17:08:26 +0200 Message-Id: <1390921707-15109-3-git-send-email-kirill.shutemov@linux.intel.com> In-Reply-To: <1390921707-15109-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1390921707-15109-1-git-send-email-kirill.shutemov@linux.intel.com> Subject: [Qemu-devel] [PATCH 3/4] hw/9pfs: make get_st_gen() return ENOTTY error on special files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, aliguori@amazon.com, mst@redhat.com Cc: aneesh.kumar@linux.vnet.ibm.com, "Kirill A. Shutemov" , armbru@redhat.com Currently we silently ignore getversion requests for anything except file or directory. Let's instead return ENOTTY error to indicate that getversion is not supported. It makes implementation consistent on all not-supported cases. Signed-off-by: Kirill A. Shutemov --- hw/9pfs/virtio-9p-handle.c | 3 ++- hw/9pfs/virtio-9p-local.c | 3 ++- hw/9pfs/virtio-9p-proxy.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c index ed8c126e1d6c..17002a3d2867 100644 --- a/hw/9pfs/virtio-9p-handle.c +++ b/hw/9pfs/virtio-9p-handle.c @@ -591,7 +591,8 @@ static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path, * We can get fd for regular files and directories only */ if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { - return 0; + errno = ENOTTY; + return -1; } err = handle_open(ctx, path, O_RDONLY, &fid_open); if (err < 0) { diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 9be8854e9148..df0dbffa7ac4 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -1077,7 +1077,8 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, * We can get fd for regular files and directories only */ if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { - return 0; + errno = ENOTTY; + return -1; } err = local_open(ctx, path, O_RDONLY, &fid_open); if (err < 0) { diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c index 5f44bb758b35..b57966d9d883 100644 --- a/hw/9pfs/virtio-9p-proxy.c +++ b/hw/9pfs/virtio-9p-proxy.c @@ -1086,7 +1086,8 @@ static int proxy_ioc_getversion(FsContext *fs_ctx, V9fsPath *path, * we can get fd for regular files and directories only */ if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { - return 0; + errno = ENOTTY; + return -1; } err = v9fs_request(fs_ctx->private, T_GETVERSION, st_gen, "s", path); if (err < 0) { -- 1.8.5.2