From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: qemu-devel@nongnu.org, aliguori@amazon.com, mst@redhat.com
Cc: aneesh.kumar@linux.vnet.ibm.com,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
armbru@redhat.com
Subject: [Qemu-devel] [PATCH 3/4] hw/9pfs: make get_st_gen() return ENOTTY error on special files
Date: Tue, 28 Jan 2014 17:08:26 +0200 [thread overview]
Message-ID: <1390921707-15109-3-git-send-email-kirill.shutemov@linux.intel.com> (raw)
In-Reply-To: <1390921707-15109-1-git-send-email-kirill.shutemov@linux.intel.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 <kirill.shutemov@linux.intel.com>
---
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
next prev parent reply other threads:[~2014-01-28 15:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 15:08 [Qemu-devel] [PATCH 1/4] hw/9pfs: fix error handing in local_ioc_getversion() Kirill A. Shutemov
2014-01-28 15:08 ` [Qemu-devel] [PATCH 2/4] hw/9pfs: handle undefined FS_IOC_GETVERSION case in handle_ioc_getversion() Kirill A. Shutemov
2014-02-02 16:20 ` Aneesh Kumar K.V
2014-01-28 15:08 ` Kirill A. Shutemov [this message]
2014-02-02 16:28 ` [Qemu-devel] [PATCH 3/4] hw/9pfs: make get_st_gen() return ENOTTY error on special files Aneesh Kumar K.V
2014-01-28 15:08 ` [Qemu-devel] [PATCH 4/4] hw/9pfs: fix P9_STATS_GEN handling Kirill A. Shutemov
2014-02-02 16:27 ` Aneesh Kumar K.V
2014-02-02 16:20 ` [Qemu-devel] [PATCH 1/4] hw/9pfs: fix error handing in local_ioc_getversion() Aneesh Kumar K.V
[not found] ` <878utx5tw1.fsf@linux.vnet.ibm.com>
[not found] ` <87bnyp4e7k.fsf@linux.vnet.ibm.com>
2014-02-02 21:32 ` [Qemu-devel] 9pfs troubles (was Re: [PATCH 1/4] hw/9pfs: fix error handing in local_ioc_getversion()) Michael S. Tsirkin
2014-02-03 9:35 ` Aneesh Kumar K.V
2014-02-03 11:03 ` Michael S. Tsirkin
2014-02-04 7:21 ` Aneesh Kumar K.V
2014-02-05 21:31 ` Michael S. Tsirkin
2014-02-06 12:58 ` Aneesh Kumar K.V
2014-02-06 13:24 ` Michael S. Tsirkin
2014-02-07 9:02 ` Greg Kurz
2014-02-09 12:05 ` Michael S. Tsirkin
2014-03-12 11:34 ` Michael S. Tsirkin
2014-03-17 9:12 ` Greg Kurz
2015-01-20 15:36 ` Marc-André Lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390921707-15109-3-git-send-email-kirill.shutemov@linux.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=aliguori@amazon.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=armbru@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).