Workarounds for building with gcc 4

This commit is contained in:
Kent Overstreet 2017-08-17 15:11:06 -06:00
parent c7950838b2
commit e0c54d52f5
6 changed files with 11 additions and 10 deletions

View File

@ -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"

View 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);

View 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");

View File

@ -13,12 +13,8 @@
#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."

View 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) {

View 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 *);