Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp366793ybk; Wed, 13 May 2020 02:15:30 -0700 (PDT) X-Google-Smtp-Source: APiQypJ1/WdsQkTBm9WeZMwMRUJNHLwaDT3Jc4JHac9Hlf9sCKzhMg7YzgqINiJvsJO4ts+EmNKS X-Received: by 2002:a17:907:11de:: with SMTP id va30mr21943818ejb.121.1589361330632; Wed, 13 May 2020 02:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589361330; cv=none; d=google.com; s=arc-20160816; b=S5XOIdwsEKMOtYF9mz8qxmJGNiFkles25Zvx2M2zwOORF/2iXpscheX6+GkARMfwF7 GEWOT+UK7a4UbOkJKVjKKsx838YiifGxlxy7bc1MLVtzAwL/SC6F5p4yPi2tgTx46RR7 wGhEZWPTpm75QbXWj9O6+4VWWsdHwLAgvGYAqG1/p4RvI8lclI5dRHRzxqquGPCeY/1n E2Gy/BFRqUBoCvUqIVF1L3hJi6issj8pH22SQ3MQThwBVElbZDXOTK0hMQasfPA1oO+U 0E6ESwrBctC3TJY2KqXe4Rf4AvQ7qWkRwzsyeUg39EHNgoIPJys4V3nuvYy9qYUAy05a yA+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature; bh=IFyPd5jaNLoWjNXVKhmuzoT4Iff8vuIMwsOFgF6oOY8=; b=XTgqE2iDfsOqQ5Nt66+GUlutJ0xb8akbSV0AAXUwjeoL4tznI132Ek+V9MC+f8yC5b JyHzTjj/M/+zYCg7ZeypDTwneyqHd2GlswD65k5F5RWRRQ9mWI7HlV3MfcR2jG/ptM2D j59fkPxAZnP++IWgJvNjFKgz35afiOgYPzLeoio3wHfEGjVNsS7KwMMnw7KTJ8t73Tq7 oXF86GeQxbuyO0ULjtJ7gs2wyPpcSz4Gf4Akh3y8JWrO9fydHYXaKyGP/QCzySnbDrlB ZkKs6Im3BoT1eNWpQndJIKIUT1y7J+5/woJzd5RBGtexevGyArIhmPnhaSYQVvUR8sCs 4sog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VzDXqXnM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si10175669edf.478.2020.05.13.02.15.06; Wed, 13 May 2020 02:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VzDXqXnM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732266AbgEMJNn (ORCPT + 99 others); Wed, 13 May 2020 05:13:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730677AbgEMJNn (ORCPT ); Wed, 13 May 2020 05:13:43 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFAF3C061A0C for ; Wed, 13 May 2020 02:13:41 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id z22so13036781lfd.0 for ; Wed, 13 May 2020 02:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IFyPd5jaNLoWjNXVKhmuzoT4Iff8vuIMwsOFgF6oOY8=; b=VzDXqXnMJRY3pyvJu/3XbYwAqBzyftpy8OJkHqzbWgYb8p7+5vAE+S8tQwDVcffOVh vYhe1Gps3SR/KgfRjPa6EOReK16zzpV1Oq8iwCbNXmZbqGuUL/6StErGr9eya4qk8Vql eoHka4yVI9NAQPOaJTgv9zjzsvmC0rGU4HGlewMOQXkI+z1GCtDOoTjacgx9IU+d8JSb a0tke74vkvEZ9G7P056Js0DgY8650Gy/Dj+Zqb1VeJs+BzgMIch349ExS4q8Tp2Jb4Sm Cr7aqrN0sHyvcqJcj+Df4O+QsKzlBC7Y1PyOuPiKVIbFJuERD5lA6trip0T+I6yC0V/2 E/aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=IFyPd5jaNLoWjNXVKhmuzoT4Iff8vuIMwsOFgF6oOY8=; b=HyQzgzJkMI9b06z+/vKfm3xH2gygv3Eo2pXafgDbe4GUFg1WrQgvTkyeG/80d0yubq hdgOiP76bGWt+9UaJ+dnAQ/04B142XxLrrBS62na1WgvwN22AvlgwsDQQV9Dfj9zNLoL uDu4RSlJgqwLz3aLEeaCYEMyW5hAw4/FPOc6RSuXD5zknFkz2OjTuQ0GFkNDVDAvXGbh bixssn1uT3axkUUgazzMEwFhQTxHZrXO8V950KjUnfusPvciYzhllCcU6mEAfbnmARz8 RM+PF9mhWFBKOWkUYj+pJW04nQJVq/v9wokbu4Q74MTEezsewnHoTxKR9cfEk6jTJdSK aDwg== X-Gm-Message-State: AOAM533i2pX7KtaUVfBxZ57D7TSQAHv8UMWlXTnU0b05/Ae491FE22xJ GZN7HjAcXDwQNDBeEyuG2MkNP34S X-Received: by 2002:a19:4285:: with SMTP id p127mr17145726lfa.46.1589361219858; Wed, 13 May 2020 02:13:39 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id d8sm15447446lfl.51.2020.05.13.02.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 02:13:39 -0700 (PDT) From: Sergey Organov To: John Stultz Cc: Eugene Syromiatnikov , Thomas Gleixner , Stephen Boyd , Frederic Weisbecker , Sebastian Andrzej Siewior , "Eric W. Biederman" , lkml Subject: Re: [PATCH v2] uapi, posix-timers: provide clockid-related macros and functions to UAPI References: <20190923130531.GA27774@asgard.redhat.com> <87y2pxvsbr.fsf@osv.gnss.ru> <20200512223103.GC1016@asgard.redhat.com> Date: Wed, 13 May 2020 12:13:37 +0300 In-Reply-To: (John Stultz's message of "Tue, 12 May 2020 15:40:07 -0700") Message-ID: <8736845ha6.fsf@osv.gnss.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org John Stultz writes: > On Tue, May 12, 2020 at 3:31 PM Eugene Syromiatnikov wrote: >> On Tue, May 12, 2020 at 10:58:16PM +0300, Sergey Organov wrote: >> > Eugene Syromiatnikov writes: >> > >> > > As of now, there is no interface exposed for converting pid/fd into >> > > clockid and vice versa; linuxptp, for example, has been carrying these >> > > definitions in missing.h header for quite some time[1]. >> > > >> > > [1] https://sourceforge.net/p/linuxptp/code/ci/af380e86/tree/missing.h >> > > >> > > Signed-off-by: Eugene Syromiatnikov >> > > --- >> > > Changes since v1[1]: >> > > * Actually tried to build with the patch and fixed the build error >> > > reported by kbuild test robot[2]. >> > > >> > > [1] https://lkml.org/lkml/2019/9/20/698 >> > > [2] https://lkml.org/lkml/2019/9/22/13 >> > > --- >> > > include/linux/posix-timers.h | 47 +------------------------------------------ >> > > include/uapi/linux/time.h | 48 ++++++++++++++++++++++++++++++++++++++++++++ >> > > 2 files changed, 49 insertions(+), 46 deletions(-) >> > >> > Was this patch applied, rejected, lost? >> > >> > I can't find it in the current master. >> >> IIRC, it was ignored. > > Overlooked. :) Not intentionally ignored. > > I don't have any major objection with adding helpers, though I feel > like you're exporting a lot more to the uapi then applications likely > need. > > Would it be better to add just the bits from the missing.h header you > pointed to: > #define CLOCKFD 3 > #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) > #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) > > to the uapi header? Please, no: 1. These macros were copied almost verbatim from the kernel code long ago, and since then kernel has changed them to inline functions, so getting back to these obsolete macros is pointless. 2. If we do need to export macroses, then kernel inline functions are better to be re-implemented in terms of these macros, not to have 2 different points of implementation. Overall, I'd vote for the current approach of the patch, provided exporting inline functions to user-space is allowed. -- Sergey Organov