From nobody Fri Oct 24 10:00:54 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 1519329733306470.85763659345594; Thu, 22 Feb 2018 12:02:13 -0800 (PST) Received: from localhost ([::1]:40764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eox4G-0000ig-Hl for importer@patchew.org; Thu, 22 Feb 2018 15:02:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eox0K-0006Qx-HI for qemu-devel@nongnu.org; Thu, 22 Feb 2018 14:58:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eox0H-0000Dj-GM for qemu-devel@nongnu.org; Thu, 22 Feb 2018 14:58:08 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34984 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 1eox0H-0000Cs-BP for qemu-devel@nongnu.org; Thu, 22 Feb 2018 14:58:05 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D68F18185328; Thu, 22 Feb 2018 19:57:58 +0000 (UTC) Received: from gigantic.usersys.redhat.com (dhcp-17-169.bos.redhat.com [10.18.17.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id A552C213AEE2; Thu, 22 Feb 2018 19:57:56 +0000 (UTC) From: Bandan Das To: qemu-devel@nongnu.org Date: Thu, 22 Feb 2018 14:57:36 -0500 Message-Id: <20180222195740.12726-2-bsd@redhat.com> In-Reply-To: <20180222195740.12726-1-bsd@redhat.com> References: <20180222195740.12726-1-bsd@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 22 Feb 2018 19:57:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 22 Feb 2018 19:57:58 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bsd@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] [PATCH v5 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: peter.maydell@linaro.org, kraxel@redhat.com 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" 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 --- 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.14.3