]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Workarounds for building with gcc 4
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 17 Aug 2017 21:11:06 +0000 (15:11 -0600)
committerKent Overstreet <kent.overstreet@gmail.com>
Wed, 23 Aug 2017 22:30:25 +0000 (16:30 -0600)
Makefile
cmd_assemble.c
cmd_migrate.c
include/uapi/linux/xattr.h
libbcachefs.c
tools-util.h

index 227ce20053356f9b0d67bfa0e396d2d042dc1ba5..cd338fa06cb78e79aeb29b06216bac85cc074da4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 
 PREFIX=/usr
 INSTALL=install
-CFLAGS+=-std=gnu99 -O2 -g -MMD -Wall                           \
+CFLAGS+=-std=gnu89 -O2 -g -MMD -Wall                           \
        -Wno-pointer-sign                                       \
        -fno-strict-aliasing                                    \
        -I. -Iinclude -Ilibbcachefs                             \
@@ -31,6 +31,7 @@ endif
 
 ifdef D
        CFLAGS+=-Werror
+       CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
 endif
 
 PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib"
index 735b368aa9043f8b43ebefc0c76c9dbba84c4284..051c32f8688f76ec96d825fffb0da5d442674664 100644 (file)
@@ -23,7 +23,8 @@ int cmd_assemble(int argc, char *argv[])
        memset(assemble, 0, sizeof(*assemble));
        assemble->nr_devs = nr_devs;
 
-       for (unsigned i = 1; i < argc; i++)
+       unsigned i;
+       for (i = 1; i < argc; i++)
             assemble->devs[i] = (__u64) argv[i];
 
        xioctl(bcachectl_open(), BCH_IOCTL_ASSEMBLE, assemble);
index 2e31b9e266784f88938bfe3d0899dfbf651ec838..b291cb5195ce7ca05e7ccfafee4e8606590c06d9 100644 (file)
@@ -225,7 +225,8 @@ static void copy_xattrs(struct bch_fs *c, struct bch_inode_unpacked *dst,
        if (attrs_size < 0)
                die("listxattr error: %m");
 
-       for (const char *next, *attr = attrs;
+       const char *next, *attr;
+       for (attr = attrs;
             attr < attrs + attrs_size;
             attr = next) {
                next = attr + strlen(attr) + 1;
@@ -827,7 +828,8 @@ int cmd_migrate_superblock(int argc, char *argv[])
        if (sb->layout.nr_superblocks >= ARRAY_SIZE(sb->layout.sb_offset))
                die("Can't add superblock: no space left in superblock layout");
 
-       for (unsigned i = 0; i < sb->layout.nr_superblocks; i++)
+       unsigned i;
+       for (i = 0; i < sb->layout.nr_superblocks; i++)
                if (le64_to_cpu(sb->layout.sb_offset[i]) == BCH_SB_SECTOR)
                        die("Superblock layout already has default superblock");
 
index 1590c49cae572f66a7172c9985b2e4d5e493a8db..c95882b3cade0b21a2d8a907608f170b11977746 100644 (file)
 #ifndef _UAPI_LINUX_XATTR_H
 #define _UAPI_LINUX_XATTR_H
 
-#if __UAPI_DEF_XATTR
-#define __USE_KERNEL_XATTR_DEFS
-
 #define XATTR_CREATE   0x1     /* set value, fail if attr already exists */
 #define XATTR_REPLACE  0x2     /* set value, fail if attr does not exist */
-#endif
 
 /* Namespaces */
 #define XATTR_OS2_PREFIX "os2."
index f68a45f23d8314b71f4ad10792ed2b43167afa2a..9a07bbcd8dd165a91effdb9abdf87554bf907221 100644 (file)
@@ -247,7 +247,8 @@ void bch2_super_write(int fd, struct bch_sb *sb)
 {
        struct nonce nonce = { 0 };
 
-       for (unsigned i = 0; i < sb->layout.nr_superblocks; i++) {
+       unsigned i;
+       for (i = 0; i < sb->layout.nr_superblocks; i++) {
                sb->offset = sb->layout.sb_offset[i];
 
                if (sb->offset == BCH_SB_SECTOR) {
index 0b73b2832a26549fc8d2636b98351c2a6e54dae2..14ced032f1dd3dcff0c06c7bc7658abafb3dcb5f 100644 (file)
@@ -54,7 +54,7 @@ struct units_buf {
        char    b[20];
 };
 
-#define pr_units(_v, _u)       __pr_units(_v, _u).b
+#define pr_units(_v, _u)       &(__pr_units(_v, _u).b[0])
 
 char *read_file_str(int, const char *);
 u64 read_file_u64(int, const char *);