From nobody Fri Oct 24 22:14:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519721016955145.98891587207095; Tue, 27 Feb 2018 00:43:36 -0800 (PST) Received: from localhost ([::1]:35544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqarH-0000sB-Pe for importer@patchew.org; Tue, 27 Feb 2018 03:43:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqanH-00062r-TJ for qemu-devel@nongnu.org; Tue, 27 Feb 2018 03:39:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqanF-0001tV-1i for qemu-devel@nongnu.org; Tue, 27 Feb 2018 03:39:27 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49954 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqanE-0001tB-RL for qemu-devel@nongnu.org; Tue, 27 Feb 2018 03:39:24 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BF03818535B for ; Tue, 27 Feb 2018 08:39:24 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68C5D10B0F2F; Tue, 27 Feb 2018 08:39:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C9CA317533; Tue, 27 Feb 2018 09:39:19 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 27 Feb 2018 09:39:15 +0100 Message-Id: <20180227083919.12339-2-kraxel@redhat.com> In-Reply-To: <20180227083919.12339-1-kraxel@redhat.com> References: <20180227083919.12339-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Feb 2018 08:39:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 27 Feb 2018 08:39:24 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/5] usb-mtp: Add one more argument when building results X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bandan Das , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bandan Das The response to a SendObjectInfo consists of the storageid, parent obejct handle and the handle reserved for the new incoming object Signed-off-by: Bandan Das Message-id: 20180223164829.29683-2-bsd@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/dev-mtp.c | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 94c2e94f10..b55aa8205e 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -765,7 +765,8 @@ static void usb_mtp_add_time(MTPData *data, time_t time) /* -----------------------------------------------------------------------= */ =20 static void usb_mtp_queue_result(MTPState *s, uint16_t code, uint32_t tran= s, - int argc, uint32_t arg0, uint32_t arg1) + int argc, uint32_t arg0, uint32_t arg1, + uint32_t arg2) { MTPControl *c =3D g_new0(MTPControl, 1); =20 @@ -778,6 +779,9 @@ static void usb_mtp_queue_result(MTPState *s, uint16_t = code, uint32_t trans, if (argc > 1) { c->argv[1] =3D arg1; } + if (argc > 2) { + c->argv[2] =3D arg2; + } =20 assert(s->result =3D=3D NULL); s->result =3D c; @@ -1119,7 +1123,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *= c) /* sanity checks */ if (c->code >=3D CMD_CLOSE_SESSION && s->session =3D=3D 0) { usb_mtp_queue_result(s, RES_SESSION_NOT_OPEN, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } =20 @@ -1131,12 +1135,12 @@ static void usb_mtp_command(MTPState *s, MTPControl= *c) case CMD_OPEN_SESSION: if (s->session) { usb_mtp_queue_result(s, RES_SESSION_ALREADY_OPEN, - c->trans, 1, s->session, 0); + c->trans, 1, s->session, 0, 0); return; } if (c->argv[0] =3D=3D 0) { usb_mtp_queue_result(s, RES_INVALID_PARAMETER, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } trace_usb_mtp_op_open_session(s->dev.addr); @@ -1165,7 +1169,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *= c) if (c->argv[0] !=3D QEMU_STORAGE_ID && c->argv[0] !=3D 0xffffffff) { usb_mtp_queue_result(s, RES_INVALID_STORAGE_ID, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } data_in =3D usb_mtp_get_storage_info(s, c); @@ -1175,12 +1179,12 @@ static void usb_mtp_command(MTPState *s, MTPControl= *c) if (c->argv[0] !=3D QEMU_STORAGE_ID && c->argv[0] !=3D 0xffffffff) { usb_mtp_queue_result(s, RES_INVALID_STORAGE_ID, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } if (c->argv[1] !=3D 0x00000000) { usb_mtp_queue_result(s, RES_SPEC_BY_FORMAT_UNSUPPORTED, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } if (c->argv[2] =3D=3D 0x00000000 || @@ -1191,12 +1195,12 @@ static void usb_mtp_command(MTPState *s, MTPControl= *c) } if (o =3D=3D NULL) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_HANDLE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } if (o->format !=3D FMT_ASSOCIATION) { usb_mtp_queue_result(s, RES_INVALID_PARENT_OBJECT, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } usb_mtp_object_readdir(s, o); @@ -1212,7 +1216,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *= c) o =3D usb_mtp_object_lookup(s, c->argv[0]); if (o =3D=3D NULL) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_HANDLE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } data_in =3D usb_mtp_get_object_info(s, c, o); @@ -1221,18 +1225,18 @@ static void usb_mtp_command(MTPState *s, MTPControl= *c) o =3D usb_mtp_object_lookup(s, c->argv[0]); if (o =3D=3D NULL) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_HANDLE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } if (o->format =3D=3D FMT_ASSOCIATION) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_HANDLE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } data_in =3D usb_mtp_get_object(s, c, o); if (data_in =3D=3D NULL) { usb_mtp_queue_result(s, RES_GENERAL_ERROR, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } break; @@ -1240,18 +1244,18 @@ static void usb_mtp_command(MTPState *s, MTPControl= *c) o =3D usb_mtp_object_lookup(s, c->argv[0]); if (o =3D=3D NULL) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_HANDLE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } if (o->format =3D=3D FMT_ASSOCIATION) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_HANDLE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } data_in =3D usb_mtp_get_partial_object(s, c, o); if (data_in =3D=3D NULL) { usb_mtp_queue_result(s, RES_GENERAL_ERROR, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } nres =3D 1; @@ -1261,7 +1265,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *= c) if (c->argv[0] !=3D FMT_UNDEFINED_OBJECT && c->argv[0] !=3D FMT_ASSOCIATION) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_FORMAT_CODE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } data_in =3D usb_mtp_get_object_props_supported(s, c); @@ -1270,13 +1274,13 @@ static void usb_mtp_command(MTPState *s, MTPControl= *c) if (c->argv[1] !=3D FMT_UNDEFINED_OBJECT && c->argv[1] !=3D FMT_ASSOCIATION) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_FORMAT_CODE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } data_in =3D usb_mtp_get_object_prop_desc(s, c); if (data_in =3D=3D NULL) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_PROP_CODE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } break; @@ -1284,20 +1288,20 @@ static void usb_mtp_command(MTPState *s, MTPControl= *c) o =3D usb_mtp_object_lookup(s, c->argv[0]); if (o =3D=3D NULL) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_HANDLE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } data_in =3D usb_mtp_get_object_prop_value(s, c, o); if (data_in =3D=3D NULL) { usb_mtp_queue_result(s, RES_INVALID_OBJECT_PROP_CODE, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } break; default: trace_usb_mtp_op_unknown(s->dev.addr, c->code); usb_mtp_queue_result(s, RES_OPERATION_NOT_SUPPORTED, - c->trans, 0, 0, 0); + c->trans, 0, 0, 0, 0); return; } =20 @@ -1306,7 +1310,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *= c) assert(s->data_in =3D=3D NULL); s->data_in =3D data_in; } - usb_mtp_queue_result(s, RES_OK, c->trans, nres, res0, 0); + usb_mtp_queue_result(s, RES_OK, c->trans, nres, res0, 0, 0); } =20 /* -----------------------------------------------------------------------= */ --=20 2.9.3