From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3CA1C43387 for ; Tue, 1 Jan 2019 00:45:04 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CC1A21019 for ; Tue, 1 Jan 2019 00:45:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CC1A21019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1ge8An-0001bt-Uj; Mon, 31 Dec 2018 19:44:45 -0500 Received: from omr1.cc.ipv6.vt.edu ([2607:b400:92:8300:0:c6:2117:b0e] helo=omr1.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1ge8Al-0001bn-IL for kernelnewbies@kernelnewbies.org; Mon, 31 Dec 2018 19:44:43 -0500 Received: from mr6.cc.vt.edu (mr6.cc.ipv6.vt.edu [IPv6:2607:b400:92:8500:0:af:2d00:4488]) by omr1.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x010if2k022234 for ; Mon, 31 Dec 2018 19:44:42 -0500 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mr6.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x010ia5C013090 for ; Mon, 31 Dec 2018 19:44:41 -0500 Received: by mail-qk1-f199.google.com with SMTP id b185so34385482qkc.3 for ; Mon, 31 Dec 2018 16:44:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:date:message-id; bh=BGavjzUDtaPsvdH26dmO77xEk84BzWT+24W0nJcLsIk=; b=a42bpB2yl9uYKxifAK34LzD66DQ/+FFWHEm/sLTN7LFOZ9/ZV9Jx4J55nChRBygj5g DKw6bXeEcVtsQ/nFekkcYBiqkcFpDH60PRk9gkqO9OxnYpbR4PZm95n71aj5rju4YkN+ Yh0kYa3rIYC87ajD/l7mTgwm+PhGIDlEX7FMtAQL4BradLVSQIZn7MMGPEpcn6HYqUsk yAqTlwdjLnF1+y882uge7UoT9RnLdopqFotI7giGSxE6vucbc+92yo9A+FomH3nFcKUN dozs5FaWPrSVRDa5ifch05gffemdUdtcUI6dG/l1Kh6h3y6wubaJdtI8aua7W5BrXJFR ZUXQ== X-Gm-Message-State: AJcUukdMhra7qr7lEtfKCjL9O8dpvo8s8r/teL5WcVE7CoAyr9/LKvrt SuzxJFTML8aan000GjVWYyLkK3UYxxMQTt9yolniMaExlIUSVH/Zl1fynvvbuJGMQpQZMhFppOV 7rbqhFygR2j/VqmvaJMhprHu7sRTkugBZNT5unDY= X-Received: by 2002:a0c:f184:: with SMTP id m4mr37327250qvl.178.1546303475777; Mon, 31 Dec 2018 16:44:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6c2VwmWaPm5KDHk1ivp2e3bLguSPsUi/pqpYTjy5r/x+duDICBk6Ba465Y7BcTQqOpbp/l/g== X-Received: by 2002:a0c:f184:: with SMTP id m4mr37327239qvl.178.1546303475524; Mon, 31 Dec 2018 16:44:35 -0800 (PST) Received: from turing-police.cc.vt.edu ([2601:5c0:c001:4341::359]) by smtp.gmail.com with ESMTPSA id v22sm20886103qkl.27.2018.12.31.16.44.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Dec 2018 16:44:34 -0800 (PST) From: valdis.kletnieks@vt.edu X-Google-Original-From: Valdis.Kletnieks@vt.edu X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: "Robert P. J. Day" Subject: Re: why are some stat.h "S_*" perm macros not exported via uapi? In-reply-to: References: Mime-Version: 1.0 Date: Mon, 31 Dec 2018 19:44:47 -0500 Message-ID: <9205.1546303487@turing-police.cc.vt.edu> Cc: Kernel Newbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Mon, 31 Dec 2018 14:53:30 -0500, "Robert P. J. Day" said: > #define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO) > #define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO) > #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) > #define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH) > #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH) Can you give an actual non-contrived example of code where one of these would be preferable to inline coding the mask? And do you plan to include all the various combos? And why should that be done in the uapi headers, rather than glibc/musl/other_c_lib providing it? I'll go out on a limb and say that most programmers would have an easier time mentally parsing the octal constant 0660 than ((S_IRUGO | S_IWUGO) & ~(S_IXUSR | S_IXGRP | S_IRWXO )) (Damn, that's ugly. The sort of thing where I've been hacking C code since 1984, and I'm *still* looking at it and going "Did I get that right, or did I just screw the pooch?".... _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies