From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfsrestore: use utimensat() to provide atime/mtime with ns resolution
Date: Thu, 4 Sep 2014 17:35:12 -0400 [thread overview]
Message-ID: <20140904213511.GA902@bfoster.bfoster> (raw)
In-Reply-To: <5408C1B4.1010001@sandeen.net>
On Thu, Sep 04, 2014 at 02:47:00PM -0500, Eric Sandeen wrote:
> On 9/4/14, 11:38 AM, Brian Foster wrote:
> >xfsdump encodes and stores the full atime and mtime for each file with
> >nanosecond resolution. xfsrestore uses utime() to set the times of each
> >file that is restored. The latter supports resolution of 1 second, thus
> >sub-second timestamp data is lost on restore.
> >
> >Add the associated configure checks for and use utimensat() when
> >available to restore timestamps with nanosecond resolution. Create a new
> >helper to facilitate conditional support for utimensat().
> >
> >Signed-off-by: Brian Foster <bfoster@redhat.com>
> >---
> >
> >I'm not totally sure on the configure bits here... it's mostly copied
> >from xfsprogs and tweaked appropriately. It seems to work, at least. ;)
> >
> >Brian
> >
> > configure.ac | 2 ++
> > include/builddefs.in | 1 +
> > m4/Makefile | 1 +
> > m4/package_libcdev.m4 | 16 ++++++++++++++++
> > restore/Makefile | 4 ++++
> > restore/content.c | 38 ++++++++++++++++++++++++++++++--------
> > 6 files changed, 54 insertions(+), 8 deletions(-)
> > create mode 100644 m4/package_libcdev.m4
> >
> >diff --git a/configure.ac b/configure.ac
> >index 59f9564..28e604e 100644
> >--- a/configure.ac
> >+++ b/configure.ac
> >@@ -82,6 +82,8 @@ AC_PACKAGE_NEED_ATTRIBUTES_H
> > AC_PACKAGE_NEED_ATTRIBUTES_MACROS
> > AC_PACKAGE_NEED_ATTRGET_LIBATTR
> >
> >+AC_HAVE_UTIMENSAT
> >+
> > AC_MANUAL_FORMAT
> >
> > AC_CONFIG_FILES([include/builddefs])
> >diff --git a/include/builddefs.in b/include/builddefs.in
> >index 269c928..bdf0ede 100644
> >--- a/include/builddefs.in
> >+++ b/include/builddefs.in
> >@@ -69,6 +69,7 @@ ENABLE_SHARED = @enable_shared@
> > ENABLE_GETTEXT = @enable_gettext@
> >
> > HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
> >+HAVE_UTIMENSAT = @have_utimensat@
> >
> > GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
> > # -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
> >diff --git a/m4/Makefile b/m4/Makefile
> >index 9a35056..ae452f7 100644
> >--- a/m4/Makefile
> >+++ b/m4/Makefile
> >@@ -16,6 +16,7 @@ LSRCFILES = \
> > manual_format.m4 \
> > package_attrdev.m4 \
> > package_globals.m4 \
> >+ package_libcdev.m4 \
> > package_ncurses.m4 \
> > package_pthread.m4 \
> > package_utilies.m4 \
> >diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
> >new file mode 100644
> >index 0000000..6fcbdba
> >--- /dev/null
> >+++ b/m4/package_libcdev.m4
> >@@ -0,0 +1,16 @@
> >+#
> >+# Check if we have a utimensat libc call
> >+#
> >+AC_DEFUN([AC_HAVE_UTIMENSAT],
> >+ [ AC_MSG_CHECKING([for utimensat])
> >+ AC_TRY_COMPILE([
>
> (as discussed on IRC...)
>
> I think you need AC_TRY_LINK here; changing utimensat() to utimensatFOO() still
> passes. ;)
>
Yeah... I tested that by breaking the function signature. I'm guessing
this does a 'gcc -c,' which lets me compile pretty much any kind of call
if no function declaration is found in a header. AC_TRY_LINK() does what
we want. Thanks for catching that.
Brian
> -Eric
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-09-04 21:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 16:38 [PATCH] xfsrestore: use utimensat() to provide atime/mtime with ns resolution Brian Foster
2014-09-04 19:47 ` Eric Sandeen
2014-09-04 21:35 ` Brian Foster [this message]
2014-09-05 0:45 ` Dave Chinner
2014-09-05 1:04 ` Eric Sandeen
2014-09-05 1:24 ` Dave Chinner
2014-09-05 11:02 ` Brian Foster
2014-09-05 11:19 ` Greg Freemyer
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=20140904213511.GA902@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=sandeen@sandeen.net \
--cc=xfs@oss.sgi.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