From: Rob Browning Date: Wed, 1 Jun 2011 00:49:29 +0000 (-0500) Subject: Use FS_IOC_GETFLAGS/FS_IOC_SETFLAGS directly as the preprocessor guards. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ee4dc6dcf2b723849f79b3e0db29fc12e4830e5d;p=packages%2Fb%2Fbup.git Use FS_IOC_GETFLAGS/FS_IOC_SETFLAGS directly as the preprocessor guards. Signed-off-by: Rob Browning --- diff --git a/config/configure b/config/configure index 19cac07..feb2a28 100755 --- a/config/configure +++ b/config/configure @@ -51,6 +51,11 @@ MF_PATH_INCLUDE TAR tar gtar MF_PATH_INCLUDE PYTHON python AC_CHECK_HEADERS sys/stat.h + +# For FS_IOC_GETFLAGS and FS_IOC_SETFLAGS. +AC_CHECK_HEADERS linux/fs.h +AC_CHECK_HEADERS sys/ioctl.h + AC_CHECK_FUNCS utimensat AC_CHECK_FUNCS utime diff --git a/lib/bup/_helpers.c b/lib/bup/_helpers.c index 5956f5b..2dd2ef2 100644 --- a/lib/bup/_helpers.c +++ b/lib/bup/_helpers.c @@ -14,8 +14,10 @@ #include #include -#ifdef linux +#ifdef HAVE_LINUX_FS_H #include +#endif +#ifdef HAVE_SYS_IOCTL_H #include #endif @@ -630,7 +632,7 @@ static PyObject *fadvise_done(PyObject *self, PyObject *args) } -#if defined(linux) && defined(FS_IOC_GETFLAGS) +#ifdef FS_IOC_GETFLAGS static PyObject *bup_get_linux_file_attr(PyObject *self, PyObject *args) { int rc; @@ -656,8 +658,10 @@ static PyObject *bup_get_linux_file_attr(PyObject *self, PyObject *args) close(fd); return Py_BuildValue("k", attr); } +#endif /* def FS_IOC_GETFLAGS */ +#ifdef FS_IOC_SETFLAGS static PyObject *bup_set_linux_file_attr(PyObject *self, PyObject *args) { int rc; @@ -682,7 +686,8 @@ static PyObject *bup_set_linux_file_attr(PyObject *self, PyObject *args) close(fd); return Py_BuildValue("O", Py_None); } -#endif /* def linux */ +#endif /* def FS_IOC_SETFLAGS */ + #ifdef HAVE_UTIMENSAT #if defined(_ATFILE_SOURCE) \ @@ -875,9 +880,11 @@ static PyMethodDef helper_methods[] = { "open() the given filename for read with O_NOATIME if possible" }, { "fadvise_done", fadvise_done, METH_VARARGS, "Inform the kernel that we're finished with earlier parts of a file" }, -#if defined(linux) && defined(FS_IOC_GETFLAGS) +#ifdef FS_IOC_GETFLAGS { "get_linux_file_attr", bup_get_linux_file_attr, METH_VARARGS, "Return the Linux attributes for the given file." }, +#endif +#ifdef FS_IOC_SETFLAGS { "set_linux_file_attr", bup_set_linux_file_attr, METH_VARARGS, "Set the Linux attributes for the given file." }, #endif