Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp140752imm; Tue, 3 Jul 2018 15:39:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJKvb6KIOkpd83AXVSsWWEqYSOaZfZxV9Lev2H8Kj2+5jfQb9BrHEdDrOZIl/F/AC7htrds X-Received: by 2002:a65:444d:: with SMTP id e13-v6mr26688462pgq.122.1530657590768; Tue, 03 Jul 2018 15:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530657590; cv=none; d=google.com; s=arc-20160816; b=NCkQ+L07cp372BHZyRZPr/+7vaPO8gCIndtirVtfK+Pn5MR5iuxxtTgn2J/2f+am0S hk74CvhQRy+qhYeTQFf2K9BovLKKLrxC03KbwcDRELSHvvwJY8k5JaJMuOhUamt1mtMD tBdtLuW8T7YtkXH5HyraeSPyP+ScyFfkPfTphE75Z4TRQ+fp7QpinwjMv/+BB72HYCSw WnOMvLiRJonQn0HiCTHEKPLvzSzXKyto452O7uChKsThNUZ5ed1bcB/9AP1gLonTHH/6 mJ5vXyMJAacHqYkNL6tlCQQzFbmhJnjXtLRVShgzcbCeRvbzW5JKGeoIO7cyUnZwdYKQ 0SpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=+AAQ7N8BQGhW7wqaEfiqBI1gAX4dwFSK/GZoCVlqqEE=; b=oDtejdY3v2rwj1M47ra2cAXQ7jMp+7HlYU1zRzMuLIBcn6eYO2Dv9rPD1R7ME0YrS4 JRMxODYSrIArgUGk26FnMRNEJeXTYbGAEg9sDdl4uh3yQfiDo1X9f9Ey2NjONeFZAlvh rRXLS1LqUan9Hwcy2x8In6aKHctsLFb5ZynuFnwfWdPo0At46QTX3ojC3beObQ4eslzM s6sbI38sJ1gbR/dkWus6MOkUeNJQoKKQvUKlrqkNvu71C9sy2s3zfWovfa3rqmgc7hxg zWju5mfjFCaXjx4u4lWR/nUS/9yx8vzhGU9958UCzCjzQXAWjjmANYzZzLhq0pIx5U+m Jdgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=f4kwmdcK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 80-v6si1809231pgf.604.2018.07.03.15.39.35; Tue, 03 Jul 2018 15:39:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=f4kwmdcK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbeGCWiu (ORCPT + 99 others); Tue, 3 Jul 2018 18:38:50 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:39436 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753457AbeGCWis (ORCPT ); Tue, 3 Jul 2018 18:38:48 -0400 Received: by mail-qk0-f193.google.com with SMTP id f3-v6so1922767qkd.6 for ; Tue, 03 Jul 2018 15:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=+AAQ7N8BQGhW7wqaEfiqBI1gAX4dwFSK/GZoCVlqqEE=; b=f4kwmdcKnU0H4qBjhpKQVmm5Cv7f1qeg0Pu30PzH/7LzMQYu3KjrvpLJkCbdaN2Ha/ iZCjxDR1G/ObV3OfmyZmwB1Kr4WrUlGKuYdUB4gtZXGzahG8IHdxY825b5ziFojPLPr7 zbYpYKQozTwwZmwzxbNtotcYOWYZhGwxZZeqr0TZPmMVIb3DcesHGDXnm1Rg0EQUQogX 665wbQke5jGRhe4ZXKhz+BadSb0PWiTBMR992Uzp7m95AvO8xbtlLGXBwOgyi4CXjSB8 o4AeykecrxEQObTCt20udAikE5Vay/BgZPcXyhdlv5eR36yOoRhjoQjqb2EzZ7VMS1ZD SOMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=+AAQ7N8BQGhW7wqaEfiqBI1gAX4dwFSK/GZoCVlqqEE=; b=ZaDBOl7tFOeIO8n4QHu8M2vOsN3xHGx5jR5iq8b5hOn0TmRv03p7q9LpcQhD8K57zh fz4GTikOB2PcP5Q12qcupStrCCF/mlBUSMy96gmOUrEmgFpldKF4YJri9sTp6jo3vvoj /+felW0Ac7/Z2lmTEhXAyXKxQfipwvgSUrzuLxochHRCmpyq8FRscReQSmyjtEhpU+ik bgWPCCegjPDxBIFsoMsdlgdKx/zDXqjeJ9+5iNJIy6fOhW9hRY9pKHj0cBUeAwOb+8UP HzBM/sQKi3uO9aoWr9o79bpe9OIAGSuZD8z2PV1KxHOuNjSgn6E1JVDTQJ29n8kmczZ0 NSpg== X-Gm-Message-State: APt69E0UhRZsHCqL90SnrinIZyUybJxsO8BpBy4FMqd+bvLc2BxWQZuj dWbJNCseYWDBhftlQVwe8r76Dw== X-Received: by 2002:a37:5b83:: with SMTP id p125-v6mr3293355qkb.196.1530657528177; Tue, 03 Jul 2018 15:38:48 -0700 (PDT) Received: from cakuba.netronome.com ([75.53.12.129]) by smtp.gmail.com with ESMTPSA id p56-v6sm1827670qtc.7.2018.07.03.15.38.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Jul 2018 15:38:48 -0700 (PDT) Date: Tue, 3 Jul 2018 15:38:43 -0700 From: Jakub Kicinski To: Okash Khawaja , Martin KaFai Lau Cc: Daniel Borkmann , Alexei Starovoitov , Yonghong Song , "Quentin Monnet" , "David S. Miller" , , , Subject: Re: [PATCH bpf-next v2 2/3] bpf: btf: add btf print functionality Message-ID: <20180703153843.7a3425af@cakuba.netronome.com> In-Reply-To: <20180703152331.151d1c4b@cakuba.netronome.com> References: <20180702183913.669030439@fb.com> <20180702191324.570616684@fb.com> <20180702220659.6baa77ba@cakuba.netronome.com> <20180703214559.GA4448@w1t1fb> <20180703152331.151d1c4b@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Jul 2018 15:23:31 -0700, Jakub Kicinski wrote: > > > > + else > > > > + jsonw_printf(jw, "%hhd", *((char *)data)); > > > > > > ... I think you need to always print a string, and express it as > > > \u00%02hhx for non-printable. > > Okay that makes sense > > Yeah, IDK, char can be used as a byte as well as a string. In eBPF > it may actually be more likely to just be used as a raw byte buffer... Actually, what is the definition/purpose of BTF_INT_CHAR? There seems to be no BTF_INT_SHORT and BTF_INT_SIGNED can simply be of size 8... Is normal int only used for bitfields of size 8 and BTF_INT_CHAR for char variables? The kernel seems to be rejecting combinations of those flags, is unsigned char going to not be marked as char then? > Either way I think it may be nice to keep it consistent, at least for > the JSON output could we do either always ints or always characters?