]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
hw/9pfs: make get_st_gen() return ENOTTY error on special files
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 28 Jan 2014 15:08:26 +0000 (17:08 +0200)
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Sun, 2 Feb 2014 16:39:04 +0000 (22:09 +0530)
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>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs/virtio-9p-handle.c
hw/9pfs/virtio-9p-local.c
hw/9pfs/virtio-9p-proxy.c

index ed8c126e1d6c8da43ad6e07c400bbc72645da9cd..17002a3d286731a33b58f5d5d92a0b8ed033c1a6 100644 (file)
@@ -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) {
index 9be8854e9148f3ea34a06d0c4cd37fb073521629..df0dbffa7ac4578e18c95dd6531a475a079557aa 100644 (file)
@@ -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) {
index 5f44bb758b35a974dde31a567a43d3b1ec094f76..b57966d9d8830b27d546742420b273c0d567a78f 100644 (file)
@@ -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) {