linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
	Rafael Wysocki <rjw@rjwysocki.net>,
	"sboyd@codeaurora.org" <sboyd@codeaurora.org>,
	"arnd@arndb.de" <arnd@arndb.de>, Mark Brown <broonie@kernel.org>,
	Akinobu Mita <akinobu.mita@gmail.com>,
	Alexander Duyck <alexander.h.duyck@redhat.com>,
	"moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
	MANAGEM..." <alsa-devel@alsa-project.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Arik Nemtsov <arik@wizery.com>,
	"open list:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER"
	<ath10k@lists.infradead.org>,
	"open list:QUALCOMM ATHEROS ATH9K WIRELESS DRIVER"
	<ath9k-devel@lists.ath9k.org>,
	"Altman, Avri" <avri.altman@intel.com>,
	"open list:B43 WIRELESS DRIVER" <b43-dev@lists.infradead.org>,
	Borislav Petkov <bp@alien8.de>,
	Brian Silverman <bsilver16384@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	"Ivgi, Chaya Rachel" <chaya.rachel.ivgi@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Dmitry Monakhov <dmonakhov@openvz.org>,
	Doug Thompson <dougthompson@xmission.com>,
	Eliad Peller <eliad@wizery.com>,
	"Grumbach, Emmanuel" <emmanuel.grumbach@intel.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Gustavo Padovan <gustavo@padovan.org>,
	Haggai Eran <haggaie@mellanox.com>,
	Hariprasad S <hariprasad@chelsio.com>,
	Ingo Molnar <mingo@kernel.org>,
	Intel Linux Wireless <ilw@linux.intel.com>,
	"open list:AMD IOMMU (AMD-VI)" <iommu@lists.linux-foundation.org>,
	"James E.J. Bottomley" <JBottomley@odin.com>,
	Jaroslav Kysela <perex@perex.cz>,
	Jiri Slaby <jirislaby@gmail.com>, Joe Perches <joe@perches.com>,
	Joerg Roedel <joro@8bytes.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Jonathan Corbet <corbet@lwn.net>, Joonsoo Kim <js1304@gmail.com>,
	Kalle Valo <kvalo@qca.qualcomm.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Len Brown <lenb@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>,
	"open list:ACPI" <linux-acpi@vger.kernel.org>,
	"moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)"
	<linux-arm-kernel@lists.infradead.org>,
	"open list:BLUETOOTH DRIVERS" <linux-bluetooth@vger.kernel.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	"open list:EDAC-CORE" <linux-edac@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
	"open list:CISCO SCSI HBA DRIVER" <linux-scsi@vger.kernel.org>,
	"open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:"
	<linux-usb@vger.kernel.org>,
	"open list:NETWORKING DRIVERS (WIRELESS)"
	<linux-wireless@vger.kernel.org>,
	"Coelho, Luciano" <luciano.coelho@intel.com>,
	"Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Mel Gorman <mgorman@suse.de>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Michal Hocko <mhocko@suse.com>,
	Narsimhulu Musini <nmusini@cisco.com>,
	"open list:CXGB4 ETHERNET DRIVER (CXGB4)"
	<netdev@vger.kernel.org>, Nick Kossifidis <mickflemm@gmail.com>,
	"open list:WOLFSON MICROELECTRONICS DRIVERS"
	<patches@opensource.wolfsonmicro.com>,
	Peter Zijlstra <peterz@infradead.org>,
	QCA ath9k Development <ath9k-devel@qca.qualcomm.com>,
	Richard Fitzgerald <rf@opensource.wolfsonmicro.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Sebastian Ott <sebott@linux.vnet.ibm.com>,
	Sesidhar Baddela <sebaddel@cisco.com>,
	Stanislaw Gruszka <sgruszka@redhat.com>,
	Takashi Iwai <tiwai@suse.com>, Tejun Heo <tj@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Winkler, Tomas" <tomas.winkler@intel.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Wang Long <long.wanglong@huawei.com>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH V3 2/2] debugfs: don't assume sizeof(bool) to be 4 bytes
Date: Tue, 15 Sep 2015 10:38:32 -0700	[thread overview]
Message-ID: <CA+55aFxVQ9jD=jUqPZt76EMe_Tb-_SA8v=rOHeR9Ljdsc6=xGQ@mail.gmail.com> (raw)
In-Reply-To: <20150915094509.46cca84d@gandalf.local.home>

On Tue, Sep 15, 2015 at 6:45 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Linus, This patch changes a lot of u32s into bools in structures.
> What's your take on that?

So in general, I'd tend to prefer "bool" to be used primarily as a
return value for functions, but I have to say, in the case of
something that is explicitly called "debugfs_create_bool()" it kind of
makes sense to actually take a bool pointer.

In structures, it depends a bit on usage. If the intent is to pack
things better, I tend to prefer using "char" etc that is explicitly a
byte. Or just use explicit bits in an "unsigned int flags" or
something. Because while "bool" is _typically_ one byte, but it's very
very explicitly documented to not be guaranteed that way, and there
are legacy models where "bool" ends up being "int".

But in this case, the use of "bool" is not about packing or anything
like that, it is more about the logical data type for
"debugfs_create_bool()", and so I don't mind "bool" in this context
even in structures.

But exactly because of the whole ambiguoity about "bool", what I do
*not* want to see in any way is "bool" in structures that are exported
to user space. That's when we want primarily those explicitly sized
types like "u32" etc. We should generally try to avoid even things
like "int" in those kinds of structures, and bool is even _less_ well
defined than "int" is.

But that user interface issue doesn't seem to be the case here, an I
can't say that I mind the patch. It looks fairly sane.

                    Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-09-15 17:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9b705747a138c96c26faee5218f7b47403195b28.1442305897.git.viresh.kumar@linaro.org>
2015-09-15  8:34 ` Viresh Kumar
2015-09-15  9:13   ` Charles Keepax
2015-09-15 10:37   ` Johannes Berg
2015-09-15 11:04     ` Viresh Kumar
2015-09-15 13:45       ` Steven Rostedt
2015-09-15 14:04         ` Viresh Kumar
2015-09-15 17:38         ` Linus Torvalds [this message]
2015-09-15 17:47           ` Steven Rostedt
2015-09-16  7:24             ` Borislav Petkov
2015-09-16  8:02             ` Ingo Molnar
2015-09-15 14:04   ` Steven Rostedt
2015-09-15 14:12     ` Viresh Kumar
2015-09-15 14:29       ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+55aFxVQ9jD=jUqPZt76EMe_Tb-_SA8v=rOHeR9Ljdsc6=xGQ@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=JBottomley@odin.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arik@wizery.com \
    --cc=arnd@arndb.de \
    --cc=ath10k@lists.infradead.org \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=ath9k-devel@qca.qualcomm.com \
    --cc=avri.altman@intel.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=bigeasy@linutronix.de \
    --cc=bp@alien8.de \
    --cc=broonie@kernel.org \
    --cc=bsilver16384@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=chaya.rachel.ivgi@intel.com \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=corbet@lwn.net \
    --cc=dave@stgolabs.net \
    --cc=dmonakhov@openvz.org \
    --cc=dougthompson@xmission.com \
    --cc=eliad@wizery.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@padovan.org \
    --cc=haggaie@mellanox.com \
    --cc=hannes@cmpxchg.org \
    --cc=hariprasad@chelsio.com \
    --cc=ilw@linux.intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jirislaby@gmail.com \
    --cc=joe@perches.com \
    --cc=johan.hedberg@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=joro@8bytes.org \
    --cc=js1304@gmail.com \
    --cc=kvalo@qca.qualcomm.com \
    --cc=lenb@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=long.wanglong@huawei.com \
    --cc=luciano.coelho@intel.com \
    --cc=luto@amacapital.net \
    --cc=marcel@holtmann.org \
    --cc=mcgrof@do-not-panic.com \
    --cc=mchehab@osg.samsung.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=mickflemm@gmail.com \
    --cc=mingo@kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nmusini@cisco.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=peterz@infradead.org \
    --cc=rf@opensource.wolfsonmicro.com \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=sasha.levin@oracle.com \
    --cc=sboyd@codeaurora.org \
    --cc=sebaddel@cisco.com \
    --cc=sebott@linux.vnet.ibm.com \
    --cc=sgruszka@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tiwai@suse.com \
    --cc=tj@kernel.org \
    --cc=tomas.winkler@intel.com \
    --cc=vbabka@suse.cz \
    --cc=viresh.kumar@linaro.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox