bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fdutimensat: add an atflag parameter


From: Eric Blake
Subject: Re: [PATCH] fdutimensat: add an atflag parameter
Date: Fri, 17 Sep 2010 13:42:39 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.3

On 09/17/2010 01:40 PM, Eric Blake wrote:
The GNU tar convention is clearer, since it reflects the
semantics better: try FD first, and use that if it works;
otherwise fall back on DIR+FILE. Could we please switch to
this order, while we're changing the API anyway?

Hmm; I'm reluctant to make the change. Look at the history of
utimensat.h: originally, we declared futimens (fd, name, times), but
that conflicted with the POSIX naming, so it was renamed gl_futimens
(fd, name, times). But when it came time to extend it to the *at calling
conventions, all of our macros for quickly implementing openat on top of
open, mkdirat on top of mkdir, and so forth, all expected that the
wrapped function have name be first. So I added fdutimens (name, fd,
times), at which point I rewrote gl_futimens to be a thin wrapper around
fdutimens that swapped arguments, and added utimensat using the *at
implementation that had fdutimens with name first.

Now you're proposing making fdutimensat have the opposite signature from
fdutimens (fd before name, instead of after), not to mention
inconsistent with all the other *at functions (fd before dir, instead of
dir first). I'm leaning towards keeping the signature we have, and
change fchmodat and friends to have the same style as the current
fdutimensat (dir first, because it is a *at function, then name/fd in
that order, because that is the order in which it is easiest to wrap a
non-at function to turn it in an at function).

That said, maybe the easiest thing to do would be adding:

gl_futimensat (fd, dir, file, times, flag)

in utimens.h, as a simple static inline wrapper that swaps the fd and {dir,file} argument positions, similar to how we also provide lutimensat as a simple wrapper that always sets flag to AT_SYMLINK_NOFOLLOW. Then, instead of using fdutimensat, you would use the nicer signature of gl_futimensat.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]