All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@poochiereds.net>
To: Matthew Wilcox <willy@infradead.org>
Cc: David Howells <dhowells@redhat.com>,
	Andreas Dilger <adilger@dilger.ca>,
	Christoph Hellwig <hch@infradead.org>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	xfs <linux-xfs@vger.kernel.org>
Subject: Re: statx manpage
Date: Wed, 22 Mar 2017 06:55:09 -0400	[thread overview]
Message-ID: <1490180109.2593.13.camel@poochiereds.net> (raw)
In-Reply-To: <20170320160127.GB31556@bombadil.infradead.org>

On Mon, 2017-03-20 at 09:01 -0700, Matthew Wilcox wrote:
> On Wed, Mar 08, 2017 at 10:26:14AM -0500, Jeff Layton wrote:
> > On Wed, 2017-03-08 at 09:24 +0000, David Howells wrote:
> > > Andreas Dilger <adilger@dilger.ca> wrote:
> > > >    To test whether a path is a regular file (for example), one could write:
> > > >    .nf
> > > >    .in +4n
> > > >    rc = statx(AT_FDCWD, pathname, 0, STATX_TYPE, &stx);
> > > >    if (stx.stx_mask & STATX_TYPE && S_ISREG(sb.stx_mode)) {
> > > >       /* Handle regular file */
> > > >    }
> > > 
> > > Good idea.
> > 
> > Note that & and && have similar precedence, IIRC, so you probably want
> > to wrap that flag check in parenthesis.
> 
> They're actually pretty far apart.  & is priority 8 and && is priority 11.
> But the fact that you thought they were similar shows that most of
> us don't really know what C's operator precedence is (beyond + and *)
> and we should err on the side of clarity by using the unnecessary parens.
> 

Ahh, good to know. My rules are generally: multiplication and division
come before addition and subtraction, and put parenthesis around
everything else. :)

> > If the plan is to eventually (in some far away future) to deprecate
> > stat(), then we probably don't want this manpage to refer to it as a
> > canonical source of information. I say duplicate it here.
> 
> We haven't even deprecated select() in favour of poll() ... indeed,
> pselect() was added.  I can't imagine stat() ever being deprecated.

Ok, deprecated is probably the wrong choice of words. You're correct
that we'll never be able to fully rip it out just due to the volume of
old programs that use it.

My thinking is that statx will come to supplant stat in newer code, and
stat will eventually become a "legacy" syscall. Typically we don't want
to have to refer to "legacy" manpages for canonical info in new
interfaces. If anything we may want to remove that info from stat(2)
manpage and have it refer to statx(2) for it.
-- 
Jeff Layton <jlayton@poochiereds.net>

  reply	other threads:[~2017-03-22 10:55 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07  0:06 [PATCH] xfs: report crtime and attribute flags to statx Darrick J. Wong
2017-03-07  5:01 ` Christoph Hellwig
2017-03-07 17:23   ` Darrick J. Wong
2017-03-07 17:22 ` statx manpage David Howells
2017-03-07 18:02   ` Darrick J. Wong
2017-03-07 18:39   ` David Howells
2017-03-07 18:44     ` Darrick J. Wong
2017-03-07 18:55     ` David Howells
2017-03-07 21:44   ` Andreas Dilger
2017-03-07 22:55   ` Eric Biggers
2017-03-08  3:45   ` Eryu Guan
2017-03-08  9:24   ` David Howells
2017-03-08 15:26     ` Jeff Layton
2017-03-20 16:01       ` Matthew Wilcox
2017-03-22 10:55         ` Jeff Layton [this message]
2017-03-08  9:41   ` David Howells
2017-03-10  5:01     ` Eric Biggers
2017-03-09  6:46   ` David Howells
2017-03-09  6:59     ` Eryu Guan
2017-03-09  6:59     ` Darrick J. Wong
2017-03-09 14:01       ` Christoph Hellwig
2017-03-09  7:45     ` David Howells
2017-03-24 20:53   ` Eric Biggers
2017-03-27  0:46     ` Andreas Dilger
2017-03-27 15:40       ` Darrick J. Wong
2017-03-27 16:25       ` David Howells
2017-03-27 16:46         ` Christoph Hellwig
2017-03-27 19:04           ` Jeff Layton
2017-03-28 19:39             ` Andreas Dilger
2017-03-28 20:22               ` Jeff Layton
2017-03-31 15:49             ` Christoph Hellwig
2017-03-27 18:57         ` David Howells
2017-03-28  0:13         ` [PATCH] Add initial batch of statx() LTP tests David Howells
2017-03-28  6:28           ` Christoph Hellwig
2017-03-28  8:23           ` David Howells
2017-03-27  9:55   ` statx manpage David Howells
2017-03-31 15:56   ` Christoph Hellwig
2017-03-31 16:43   ` David Howells
2017-03-31 16:43     ` David Howells

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=1490180109.2593.13.camel@poochiereds.net \
    --to=jlayton@poochiereds.net \
    --cc=adilger@dilger.ca \
    --cc=darrick.wong@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=willy@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.