]> arthur.barton.de Git - bup.git/commitdiff
Use FS_IOC_GETFLAGS/FS_IOC_SETFLAGS directly as the preprocessor guards.
authorRob Browning <rlb@defaultvalue.org>
Wed, 1 Jun 2011 00:49:29 +0000 (19:49 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Thu, 9 Jun 2011 03:12:23 +0000 (23:12 -0400)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
config/configure
lib/bup/_helpers.c

index 19cac075026fd544d72ed0202d2471feb6bb35cc..feb2a28b27316d9b1a5c840623c67ae88559ff07 100755 (executable)
@@ -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
 
index 5956f5bb54c6e3903e4ec2a6e204633b5d1210d1..2dd2ef25389104413f6cd63cb51c8963f23b2dcf 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 
-#ifdef linux
+#ifdef HAVE_LINUX_FS_H
 #include <linux/fs.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #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