From patchwork Mon May 16 20:54:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 572984 Delivered-To: patch@linaro.org Received: by 2002:a5d:5051:0:0:0:0:0 with SMTP id h17csp771358wrt; Mon, 16 May 2022 14:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHGXEU6h6koN2RW/mAeqqYDy3G1VVOi6sM3xnMAJBJSn+Zu0TIdmGEvzD2SSp3G6VcZK2Q X-Received: by 2002:a37:a497:0:b0:6a0:a704:b49b with SMTP id n145-20020a37a497000000b006a0a704b49bmr14167695qke.453.1652737931906; Mon, 16 May 2022 14:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652737931; cv=none; d=google.com; s=arc-20160816; b=QRmbcrPRcIJ0dIYyLXggR8CqlnqtgpV0BZdjAK0JqXyLpNRE4+EVsUamrPaPl15E1w e5p+CyJK2Fk8b/gXUtuCFF7r/PWP0OeOPjy9jUbS38LSuS/pqix5vURIwZDarL41RtCw XRajXEuuxT4DNio/YLGHioagFLf1+353gdfZkZJJ6oErrBHAOJoeyzjPZxC5SUI1+d2f 2dtPVxwfPXZp+0J898o0PFH7UZL/76rjMv7Cqg5Fe0Mfo8N72xBd6F/j6SjxGPi0ZB6h XMj4OvLQpUisVA5BhzNW7TWgcpvPoI95kzxtsuA1PBhwjooIx3B0Ur7hUpQzx4rP+Uik HKhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4TnV0DctF1mNLxRYwoqBR3FQ0Y0vcC373ju/Bs6KrI4=; b=TptDwv+uQi97o+EzZ6nsPqZWXRUI3FWLMJrsc+PFm5x8zfJQLxmwNHRIr6zh09KV69 tyxCvG41XjlZpEYepzwh68aFr9EusVtbwk+zBIyf4UXNA8pjD2vJa1ahw86hmoOmHtpl VKr4KaDBkPYWhEQxJlSI0zoWjIklfydiuf9hsxIh+tp8jJlC38s6bJPYzcbVLJVDr21n 6pb1FCPBwwq7HFVQh15pT1Q4e3VkBZcHY/kQMniKMaU0PgaffjWmjSYmP67UfNfw1tML ly0eWat/snMRuELKo7icBBStglrDFWQUWFyGx7l+2n/Y9xBq74vJ00KRQJZ5PmmyXRbn OHdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WbOW8g2P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jo30-20020a056214501e00b004467b52294fsi6413502qvb.492.2022.05.16.14.52.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 May 2022 14:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WbOW8g2P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:40216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqidP-0001ty-C4 for patch@linaro.org; Mon, 16 May 2022 17:52:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqhjn-00028F-EG for qemu-devel@nongnu.org; Mon, 16 May 2022 16:54:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqhjl-0006nH-Px for qemu-devel@nongnu.org; Mon, 16 May 2022 16:54:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652734481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TnV0DctF1mNLxRYwoqBR3FQ0Y0vcC373ju/Bs6KrI4=; b=WbOW8g2P4l1DhF+eoFSKmk4fdXkXSLn8/C5ViIJvWY0jwRErhL34F9mREZAIPOUftXJkQn aIk2RRic5lJd6zy1N0asagZiE3JunsSCnkwkn6u9mhzd9uhEdj2nSuvMfb0YiK4I3X5x+F 8JPGV22oh+nfrJVFROnsF2+UGvJogQc= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-88-nrtLtnAoPeeCmLG_HKVUfA-1; Mon, 16 May 2022 16:54:40 -0400 X-MC-Unique: nrtLtnAoPeeCmLG_HKVUfA-1 Received: by mail-ed1-f70.google.com with SMTP id n12-20020aa7c44c000000b0042ab2159b3eso2544702edr.8 for ; Mon, 16 May 2022 13:54:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=4TnV0DctF1mNLxRYwoqBR3FQ0Y0vcC373ju/Bs6KrI4=; b=nVshTAWZJbPx145FkRnBV1tpPWy/D0vf5FATd6Vvwz+rKQKb2KYuyylS/m9Wm7AWf0 4TcvSogB1rCClros+3LWoCrZq+np2Mq3RcIXBz8wdS6NFfms3rLeG2NaSeyp3WZM410h fR3+84hGQsyzzN19S/knB4Ft+Qiyhm9vGizNS5TuOTy/bz1pB/5v3JdeJagd+caMTaHU Ep0zTxi1clqsLqX4u2799GPOqubcUYQlz76xu4OF7PsJBKFtQ8pMCLWqkjvPLkKTZR0Z ak6+kqXF6t7at7VHrwr/B+uurAyUOiK6zvfxjwrQj3n6NNAsl+4Ng+ACkScnunwkAosG 4aTg== X-Gm-Message-State: AOAM532F33XQT/w5miGxnJkw2Xy2+bUyKOSWzeQgrnvFo55NP3G9O+so uh7zIqX5qNvplUGM2obNjglQS9Qnt4Oz98knzUVQFCbTQSINThIFdiTOYNG7EbWr4clnrbB8zeS ApaORnVVdFpkUiAUTkmmG/F7ViBIqeJYfM1pcAp18Q6YPDbxXRMgLO2QOnwl5 X-Received: by 2002:a17:906:c114:b0:6f5:db6f:71a1 with SMTP id do20-20020a170906c11400b006f5db6f71a1mr16617445ejc.338.1652734478576; Mon, 16 May 2022 13:54:38 -0700 (PDT) X-Received: by 2002:a17:906:c114:b0:6f5:db6f:71a1 with SMTP id do20-20020a170906c11400b006f5db6f71a1mr16617429ejc.338.1652734478346; Mon, 16 May 2022 13:54:38 -0700 (PDT) Received: from redhat.com ([2.55.131.38]) by smtp.gmail.com with ESMTPSA id gh24-20020a170906e09800b006f3ef214dc4sm178228ejb.42.2022.05.16.13.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 13:54:37 -0700 (PDT) Date: Mon, 16 May 2022 16:54:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Philippe =?utf-8?q?M?= =?utf-8?q?athieu-Daud=C3=A9?= , Raphael Norwitz , David Hildenbrand , Kevin Wolf , Stefan Hajnoczi Subject: [PULL v2 65/86] libvhost-user: expose vu_request_to_string Message-ID: <20220516204913.542894-66-mst@redhat.com> References: <20220516204913.542894-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220516204913.542894-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée This is useful for more human readable debug messages in vhost-user programs. Signed-off-by: Alex Bennée Message-Id: <20220321153037.3622127-9-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- subprojects/libvhost-user/libvhost-user.h | 9 +++++++++ subprojects/libvhost-user/libvhost-user.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.h b/subprojects/libvhost-user/libvhost-user.h index cde9f07bb3..aea7ec5061 100644 --- a/subprojects/libvhost-user/libvhost-user.h +++ b/subprojects/libvhost-user/libvhost-user.h @@ -473,6 +473,15 @@ bool vu_init(VuDev *dev, */ void vu_deinit(VuDev *dev); + +/** + * vu_request_to_string: return string for vhost message request + * @req: VhostUserMsg request + * + * Returns a const string, do not free. + */ +const char *vu_request_to_string(unsigned int req); + /** * vu_dispatch: * @dev: a VuDev context diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index d0041c864b..b4cc3c2d68 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -99,7 +99,7 @@ static inline bool vu_has_protocol_feature(VuDev *dev, unsigned int fbit) return has_feature(dev->protocol_features, fbit); } -static const char * +const char * vu_request_to_string(unsigned int req) { #define REQ(req) [req] = #req