Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031445AbbDXRw0 (ORCPT ); Fri, 24 Apr 2015 13:52:26 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:37254 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbbDXRwY (ORCPT ); Fri, 24 Apr 2015 13:52:24 -0400 MIME-Version: 1.0 In-Reply-To: <20150424143212.GA27730@aepfle.de> References: <20150414175534.GB3974@kroah.com> <87oamhmbso.fsf_-_@x220.int.ebiederm.org> <553788A9.6090006@gmail.com> <20150422143515.GA23155@dellaz> <20150424143212.GA27730@aepfle.de> Date: Fri, 24 Apr 2015 10:52:23 -0700 X-Google-Sender-Auth: z88sh-tyS6hRnetvuFPM9gXGxQ0 Message-ID: Subject: Re: Issues with capability bits and meta-data in kdbus From: Linus Torvalds To: Olaf Hering Cc: Havoc Pennington , Michele Curti , Austin S Hemmelgarn , Andy Lutomirski , "Eric W. Biederman" , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , One Thousand Gnomes , Tom Gundersen , Jiri Kosina , Linux Kernel Mailing List , Daniel Mack , David Herrmann , Djalal Harouni Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1671 Lines: 36 On Fri, Apr 24, 2015 at 7:32 AM, Olaf Hering wrote: > On Wed, Apr 22, Linus Torvalds wrote: > >> Conditional byte order is worse than silly - it's terminally stupid. > >> In other words, think networking, which statically just decided to use >> big-endian. Sure, that was the wrong choice in the end, but even > > Why was that wrong? Any pointers to further details? Just because BE is effectively dead these days. Every BE architecture is either gone, or is slowly (or not so slowly) converting to LE. But more importantly, even when you pick the byte order that history then relegates to the the losing position, and you end up doing byte swappign on most machines, that is *still* better than conditionally *not* doing byte swapping. So even today, by all means make your protocols or disk images use big-endian byte formats. But do it unconditionally. Don't make the mistake of encoding the byte order as part of the data, and then dynamically switching things (or not) around. In fact, even today a BE byte order can make sense, if only exactly because of network byte order - thanks to network byte order, there are all those nice mostly-portable and often well-optimized "ntohl()" functions available to you. So rather than introduce your own helper functions for LE byte order access, you may be better off just using BE because of existing network infrastructure. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/