Patchwork [-v2,16/22] virtio-9p: Add support for hardlink

login
register
mail settings
Submitter Aneesh Kumar K.V
Date March 16, 2010, 9:15 a.m.
Message ID <1268730920-14584-17-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/47829/
State New
Headers show

Comments

Aneesh Kumar K.V - March 16, 2010, 9:15 a.m.
link count for files and directories are encoded as
a tagged string in the extension field for a .u protocol
extension.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/virtio-9p.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index e8a9eeb..3ddf2b9 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -674,6 +674,9 @@  static void stat_to_v9stat(V9fsState *s, V9fsString *name,
             v9fs_string_sprintf(&v9stat->extension, "%c %u %u",
                     S_ISCHR(stbuf->st_mode) ? 'c' : 'b',
                     major(stbuf->st_rdev), minor(stbuf->st_rdev));
+        } else if (S_ISDIR(stbuf->st_mode) || S_ISREG(stbuf->st_mode)) {
+            v9fs_string_sprintf(&v9stat->extension, "%s %u",
+                    "HARDLINKCOUNT", stbuf->st_nlink);
         }
     }