From patchwork Mon May 16 10:39:22 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: 572978 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1590:0:0:0:0 with SMTP id w16csp1015800map; Mon, 16 May 2022 05:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB72bA147oMli138Psf26PYB68CsQxRfJHu/ep13ojstFuScZeweVjI0e1Wul3IC8XYTFs X-Received: by 2002:a37:8a85:0:b0:6a2:fa5b:e7db with SMTP id m127-20020a378a85000000b006a2fa5be7dbmr1080759qkd.347.1652703891147; Mon, 16 May 2022 05:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652703891; cv=none; d=google.com; s=arc-20160816; b=fSIK33Vg5ES6uNSuAOcBfCQGnEcwI4vbo77krkwXfcMXkWWKNQ14rP494uVTycU4pz XFf07FiBZO8y6j9speta9ymmbw5JDLqcQ517LiG3XuGRMAWbA4aVdCmcxk9RJmG8gcBV JBRaNAF3Zkxq196Z3GJ6K7gVK2/5StHguPT8sicqz1F9raeGCoONnn0H+/zdr9H897Yr zdtoerOvFy4aGVj2mo+bj/C/0WMaDLDJSwMpnaSY+z0C2lrC8e+hklI0OUZrkXuI3IBv wi55DPxOMq1Mquu41/OqlEQBdVjfvebF8a9VagGpTGJxjS4D+eSqo75TEdpLyA8Q8umH NBPw== 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=TmMGWkj/NuLVatJpG7rVRA7wq3S/tXVU4ADrLzJApt76JFyGVgR6zuN0bRZz0Q7Ja8 aPdpRHb8wSEXlrH0KeLIIAloenqxVNhAmKksQ+4ANcXJ/A5MYCfe7nT3rNiEJti06WwI +yjdvWKFOQLBXKuMWRy3nx275XprjwKqsrOwDDZe+G77KYkIsj6po4XnDe7xXc6Ah4/b qLWjn7G1xFFGiQfuuhE23TfgxrtwwK+HxJvAjanfk71Kt50tFy1xuAG5eMDkvf8OauR9 Kp1/QtmDfI63GAIyjZHbmaVNXc+DpQrPA64F58RLUBRWofbI9wtmSjBNWJqn5+S52+op aBYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="aHe/LZ9t"; 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 p8-20020a05621421e800b0045ac6663710si5922780qvj.323.2022.05.16.05.24.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 May 2022 05:24:51 -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="aHe/LZ9t"; 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]:47528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqZmM-000172-NS for patch@linaro.org; Mon, 16 May 2022 08:24:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqY8R-00018E-Bx for qemu-devel@nongnu.org; Mon, 16 May 2022 06:39:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46042) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqY8P-0005dW-O7 for qemu-devel@nongnu.org; Mon, 16 May 2022 06:39:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652697569; 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=aHe/LZ9tjVWlt9+CCFAiN5BWaacmkTbYP8uXtlu5MRANVhWe6QEQG7/D8FbuI9raQW8atz uR4tGuzCZU8buNIyYIbLoIqM2dvOc1Z8+gJaYW6AVa4uliCksPQYiyjmVFfLnhEQjGOqwc Z7m808knGaaZlNC6vznQ4kr5mR7aJK4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-489-MkK_0d-ePAGEYd8ayifXoA-1; Mon, 16 May 2022 06:39:27 -0400 X-MC-Unique: MkK_0d-ePAGEYd8ayifXoA-1 Received: by mail-wm1-f69.google.com with SMTP id k35-20020a05600c1ca300b003946a9764baso10156913wms.1 for ; Mon, 16 May 2022 03:39:27 -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=VPc8bLERBxmuNNNTxkuDn8IzcmxNBg0OYEBRKDLlm7uqNAWDZ38+aS6CFVLHv6J6iY eUZWMV1urTI/gGNTjzqy39tUzTxBSmVzRCj2MOfJSwlzcWSbk67S2Qi6CsKLo+ZAXZZT Wbil6GLiEiyVSm1GwdpXl/lgWpztu24tr3FTy1wvosoZAuUgBOUn2Xj5uksH2RbF4HxL 0iOHjgDYgwcK3ptI3FQVVOgHfvNtTyA/aePxofc+S9AkSe11TwLYdPyB7zO95XeZessl PtV/nPQD7E0tQbehCmPubyo7HUtleARbqnzka9JAPmjeLjx8jY5j4STxAJSxOp/SasqG 5cxQ== X-Gm-Message-State: AOAM532GB4fdAxcYbqiLBektUbHXtPD89wHI+h/MACp+ycVXB1OOu8Fz 7fuFHaRKuYMx0L/yVOMhPM/3+Kpgx8vGiUqpX/EU6R09ST1hvGv6zOb8E35ngWtbi1LpLVyqY+A LGmsd4GaLHGWv6VnEMcDZTriXHbWJRFOPTgWAkSV2XFJfaEyFBOCeqmRzysPs X-Received: by 2002:a05:6000:1563:b0:20c:5bcf:c531 with SMTP id 3-20020a056000156300b0020c5bcfc531mr13918588wrz.592.1652697566568; Mon, 16 May 2022 03:39:26 -0700 (PDT) X-Received: by 2002:a05:6000:1563:b0:20c:5bcf:c531 with SMTP id 3-20020a056000156300b0020c5bcfc531mr13918570wrz.592.1652697566336; Mon, 16 May 2022 03:39:26 -0700 (PDT) Received: from redhat.com ([2.55.141.66]) by smtp.gmail.com with ESMTPSA id v15-20020adf8b4f000000b0020d0c48d135sm1575535wra.15.2022.05.16.03.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 03:39:25 -0700 (PDT) Date: Mon, 16 May 2022 06:39:22 -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 , Stefan Hajnoczi , Kevin Wolf Subject: [PULL 65/91] libvhost-user: expose vu_request_to_string Message-ID: <20220516095448.507876-66-mst@redhat.com> References: <20220516095448.507876-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220516095448.507876-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.129.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