Revision e95ead32

b/hw/file-op-9p.h
49 49
{
50 50
    int (*lstat)(FsContext *, const char *, struct stat *);
51 51
    ssize_t (*readlink)(FsContext *, const char *, char *, size_t);
52
    int (*chmod)(FsContext *, const char *, mode_t);
52
    int (*chmod)(FsContext *, const char *, FsCred *);
53 53
    int (*chown)(FsContext *, const char *, uid_t, gid_t);
54 54
    int (*mknod)(FsContext *, const char *, mode_t, dev_t);
55 55
    int (*mksock)(FsContext *, const char *);
b/hw/virtio-9p-local.c
129 129
    return writev(fd, iov, iovcnt);
130 130
}
131 131

  
132
static int local_chmod(FsContext *ctx, const char *path, mode_t mode)
132
static int local_chmod(FsContext *fs_ctx, const char *path, FsCred *credp)
133 133
{
134
    return chmod(rpath(ctx, path), mode);
134
    if (fs_ctx->fs_sm == SM_MAPPED) {
135
        return local_set_xattr(rpath(fs_ctx, path), credp);
136
    } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {
137
        return chmod(rpath(fs_ctx, path), credp->fc_mode);
138
    }
139
    return -1;
135 140
}
136 141

  
137 142
static int local_mknod(FsContext *ctx, const char *path, mode_t mode, dev_t dev)
......
253 258

  
254 259
static int local_fsync(FsContext *ctx, int fd)
255 260
{
256
    if (0) /* Just to supress the warning. Will be removed in next patch. */
257
        (void)local_set_xattr(NULL, NULL);
258 261
    return fsync(fd);
259 262
}
260 263

  
b/hw/virtio-9p.c
154 154

  
155 155
static int v9fs_do_chmod(V9fsState *s, V9fsString *path, mode_t mode)
156 156
{
157
    return s->ops->chmod(&s->ctx, path->data, mode);
157
    FsCred cred;
158
    cred_init(&cred);
159
    cred.fc_mode = mode;
160
    return s->ops->chmod(&s->ctx, path->data, &cred);
158 161
}
159 162

  
160 163
static int v9fs_do_mknod(V9fsState *s, V9fsString *path, mode_t mode, dev_t dev)

Also available in: Unified diff