Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3441189ybl; Fri, 20 Dec 2019 09:19:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxmtdPL2gZy+E9aYQmYk3zpWba4jOReSFqoJp3PW1DlEUXfYEB7i3O8J6u5np99dH0cKSQk X-Received: by 2002:aca:dd43:: with SMTP id u64mr4204508oig.101.1576862350275; Fri, 20 Dec 2019 09:19:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576862350; cv=none; d=google.com; s=arc-20160816; b=LJDYUwhusT4+uX9KnGbIUosfZSaWCJmPyhWPq2CvQ4/1A9juDA1+M8KxGc7HUukqVy 3iWDLKiJCpUaiHfeQDWNT/2g7Z9ZVIbfFzPK61KDrrimqIphMo59Cl4uQrMtI3CXV9gx YqelqHXhU0zRqf4LQsD7l4uxlaFFdGEPSlYJ8BYJZ79R05wScVg18Rw1MOEQ46ofq904 /2/KrGBglcxjaEb4TopASgjaA0zXbozCe8lIxDovBEJRpXDs0DeBBoj+qYBIsBVcRFo6 5WC3m8mrPNWhxw35E0QvWg+us7EI2SwZ6LhjLe/kN2lIGQQBdO0dmehfomJxXc6ik1EA la2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=N7H4oeLIGDe41P8mpwmOGHKwZjRswAkUohn5mdNI4sA=; b=qrusDEHnLKP8gC55s3ht0OHhic9Vyr66w4EUzk3h7koVd9D90IAQPNQz0k1LA06AQa Cm0XZpu38qUelykMUObvn0LddGOLUfDjfCZPMGqLBgOb0kfF9mv74kGtEcd4WwA7hW4A Y56FXSQ8pGmrbiEJKfG1wpcM8WZBj5/jFZoEkAVEeJYIBAOzGKl5rwIjQyYX9jXHYOjY cwm5vltTtP3GMjwtWbKOM4tGhTxvU/fXseRqxxA2/5RDxiS6MOx1c7KG4QqbCt5n7y43 77I4jMWAbrnDUUJVNMcT7vzKzVzffyoRIdJ5KHgUZT4El5CpW7BAjLhrnWapTty2yRtm Uzsg== ARC-Authentication-Results: i=1; mx.google.com; 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 p69si5468089oic.32.2019.12.20.09.18.57; Fri, 20 Dec 2019 09:19:10 -0800 (PST) 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; 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 S1727436AbfLTRR7 (ORCPT + 99 others); Fri, 20 Dec 2019 12:17:59 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:55192 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727362AbfLTRR6 (ORCPT ); Fri, 20 Dec 2019 12:17:58 -0500 Received: from callcc.thunk.org (guestnat-104-133-0-111.corp.google.com [104.133.0.111] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id xBKHHrBM028886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Dec 2019 12:17:54 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id 88603420822; Fri, 20 Dec 2019 12:17:53 -0500 (EST) Date: Fri, 20 Dec 2019 12:17:53 -0500 From: "Theodore Y. Ts'o" To: Markus Elfring Cc: linux-doc@vger.kernel.org, kernel-janitors@vger.kernel.org, LKML Subject: Re: Improving documentation for programming interfaces Message-ID: <20191220171753.GA234417@mit.edu> References: <350cd156-9080-24fe-c49e-96e758d3ca45@web.de> <20191220151945.GD59959@mit.edu> <0557f349-322c-92b3-9fc3-94e59538ca91@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0557f349-322c-92b3-9fc3-94e59538ca91@web.de> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 20, 2019 at 05:23:27PM +0100, Markus Elfring wrote: > >> Some functions allocate resources to which a pointer (or handle) is returned. > >> I would find it nice then if such a pointer would contain also the background > >> information by which functions the resource should usually be released. > >> > >> Can it become easier to determine such data? > … > > It's unclear to me what you are requesting/proposing? > > I suggest to clarify combinations for object construction and proper resource release. > > > Can you be a bit more concrete? > > Further examples: > * kmalloc ⇒ kfree > * kobject_create ⇒ kobject_put > * device_register ⇒ put_device > > Can preprocessor macros help to express any more relationships for similar function pairs? Sorry, this is still not making sense. You said "a pointer would contain also the background information by which the resource should usually be released". Huh? There's no room for a pointer to also store context of whether it was allocated using kmalloc, or malloc, etc. Did you have some concrete idea of how a preprocessor macros could be used to perform what appears to be completely impractical? And how would that information be used by the kernel? And for what benefit? And can you show that the benefits will be worth the costs? - Ted