From patchwork Wed Mar 19 16:04:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 3859801 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 76E44BF540 for ; Wed, 19 Mar 2014 18:18:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98F8220122 for ; Wed, 19 Mar 2014 18:18:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC9CE20123 for ; Wed, 19 Mar 2014 18:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965576AbaCSQEp (ORCPT ); Wed, 19 Mar 2014 12:04:45 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:46021 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933574AbaCSQEm (ORCPT ); Wed, 19 Mar 2014 12:04:42 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2JG4OJl023539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Mar 2014 16:04:25 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2JG4NHm017347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 19 Mar 2014 16:04:23 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2JG4MX1018052; Wed, 19 Mar 2014 16:04:22 GMT Received: from lappy.hsd1.ma.comcast.net (/10.154.149.42) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Mar 2014 09:04:22 -0700 From: Sasha Levin To: penberg@iki.fi Cc: mingo@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Levin Subject: [PATCH] kvm tools: treat uids and gids in stat structure properly Date: Wed, 19 Mar 2014 12:04:18 -0400 Message-Id: <1395245058-11154-1-git-send-email-sasha.levin@oracle.com> X-Mailer: git-send-email 1.8.3.2 X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Upstream commit "9p: Modify the stat structures to use kuid_t and kgid_t" has modified the type of uid and gid in the stat structure, which breaks build for us. This is a rather trivial conversion from u32 to kuid_t and kgid_t. Reported-by: Ingo Molnar Signed-off-by: Sasha Levin --- tools/kvm/virtio/9p-pdu.c | 4 +++- tools/kvm/virtio/9p.c | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/kvm/virtio/9p-pdu.c b/tools/kvm/virtio/9p-pdu.c index 9e95f3b..cc2e871 100644 --- a/tools/kvm/virtio/9p-pdu.c +++ b/tools/kvm/virtio/9p-pdu.c @@ -129,7 +129,9 @@ static int virtio_p9_decode(struct p9_pdu *pdu, const char *fmt, va_list ap) { struct p9_wstat *stbuf = va_arg(ap, struct p9_wstat *); memset(stbuf, 0, sizeof(struct p9_wstat)); - stbuf->n_uid = stbuf->n_gid = stbuf->n_muid = -1; + stbuf->n_uid = KUIDT_INIT(-1); + stbuf->n_gid = KGIDT_INIT(-1); + stbuf->n_muid = KUIDT_INIT(-1); retval = virtio_p9_pdu_readf(pdu, "wwdQdddqssss", &stbuf->size, &stbuf->type, &stbuf->dev, &stbuf->qid, diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index 25cdd8c..847eddb 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -441,8 +441,8 @@ static void virtio_p9_fill_stat(struct p9_dev *p9dev, memset(statl, 0, sizeof(*statl)); statl->st_mode = st->st_mode; statl->st_nlink = st->st_nlink; - statl->st_uid = st->st_uid; - statl->st_gid = st->st_gid; + statl->st_uid = KUIDT_INIT(st->st_uid); + statl->st_gid = KGIDT_INIT(st->st_gid); statl->st_rdev = st->st_rdev; statl->st_size = st->st_size; statl->st_blksize = st->st_blksize; @@ -668,12 +668,13 @@ static void virtio_p9_setattr(struct p9_dev *p9dev, ((p9attr.valid & ATTR_CTIME) && !((p9attr.valid & ATTR_MASK) & ~ATTR_CTIME))) { if (!(p9attr.valid & ATTR_UID)) - p9attr.uid = -1; + p9attr.uid = KUIDT_INIT(-1); if (!(p9attr.valid & ATTR_GID)) - p9attr.gid = -1; + p9attr.gid = KGIDT_INIT(-1); - ret = lchown(fid->abs_path, p9attr.uid, p9attr.gid); + ret = lchown(fid->abs_path, __kuid_val(p9attr.uid), + __kgid_val(p9attr.gid)); if (ret < 0) goto err_out; }