misc: fix all the compiler warnings

Fix the various compiler warnings that have crept in, and only define
__bitwise if the system headers haven't already done so.  Linux 4.10
changes the __bitwise definition so that our redefinition here is
just different enough that gcc complains.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Darrick J. Wong 2017-03-01 20:52:12 -08:00 committed by Theodore Ts'o
parent d5c57fe92f
commit 686994ebe2
7 changed files with 12 additions and 28 deletions

View File

@ -1605,9 +1605,7 @@ void do_unlink(int argc, char *argv[])
void do_copy_inode(int argc, char *argv[])
{
ext2_ino_t src_ino, dest_ino;
struct ext2_inode inode;
unsigned char buf[4096];
int retval;
if (common_args_process(argc, argv, 3, 3, "copy_inode",
"<source file> <dest_name>", CHECK_FS_RW))

View File

@ -146,7 +146,7 @@ void do_get_xattr(int argc, char **argv)
size_t buflen;
int i;
int print_flags = 0;
int handle_flags = 0;
unsigned int handle_flags = 0;
errcode_t err;
reset_getopt();
@ -241,8 +241,7 @@ void do_set_xattr(int argc, char **argv)
FILE *fp = NULL;
char *buf = NULL;
size_t buflen;
int print_flags = 0;
int handle_flags = 0;
unsigned int handle_flags = 0;
int i;
errcode_t err;

View File

@ -90,7 +90,7 @@ void e2fsck_pass2(e2fsck_t ctx)
struct ext2_super_block *sb = ctx->fs->super;
struct problem_context pctx;
ext2_filsys fs = ctx->fs;
char *buf;
char *buf = NULL;
#ifdef RESOURCE_TRACK
struct resource_track rtrack;
#endif

View File

@ -173,10 +173,14 @@ typedef long __s64;
#define EXT2_ENDIAN_H_
#ifdef __CHECKER__
#define __bitwise __attribute__((bitwise))
# ifndef __bitwise
# define __bitwise __attribute__((bitwise))
# endif
#define __force __attribute__((force))
#else
#define __bitwise
# ifndef __bitwise
# define __bitwise
# endif
#define __force
#endif

View File

@ -478,7 +478,6 @@ static errcode_t convert_posix_acl_to_disk_buffer(const void *value, size_t size
ext4_acl_header *ext_acl;
size_t s;
void *e;
int err;
int count;
@ -532,7 +531,6 @@ static errcode_t convert_disk_buffer_to_posix_acl(const void *value, size_t size
errcode_t err;
const char *cp;
char *out;
int count;
if ((!value) ||
(size < sizeof(ext4_acl_header)) ||

View File

@ -15,12 +15,12 @@
int parse_c_string(char *str)
{
unsigned char *to, *from, ch;
char *to, *from, ch;
int v;
to = from = str;
for (to = from = (unsigned char *) str;
for (to = from = (char *) str;
*from && *from != '"'; to++, from++) {
if (*from == '\\') {
ch = *(++from);
@ -93,7 +93,7 @@ int parse_c_string(char *str)
*to = *from;
}
*to = '\0';
return to - (unsigned char *) str;
return to - (char *) str;
}
void print_c_string(FILE *f, const char *cp, int len)

View File

@ -356,16 +356,6 @@ static void list_bad_blocks(ext2_filsys fs, int dump)
ext2fs_badblocks_list_free(bb_list);
}
static const char *journal_checksum_type_str(__u8 type)
{
switch (type) {
case JBD2_CRC32C_CHKSUM:
return "crc32c";
default:
return "unknown";
}
}
static void print_inline_journal_information(ext2_filsys fs)
{
journal_superblock_t *jsb;
@ -374,8 +364,6 @@ static void print_inline_journal_information(ext2_filsys fs)
errcode_t retval;
ino_t ino = fs->super->s_journal_inum;
char buf[1024];
__u32 *mask_ptr, mask, m;
int i, j, size, printed = 0;
if (fs->flags & EXT2_FLAG_IMAGE_FILE)
return;
@ -411,10 +399,7 @@ static void print_journal_information(ext2_filsys fs)
{
errcode_t retval;
char buf[1024];
char str[80];
unsigned int i, j, printed = 0;
journal_superblock_t *jsb;
__u32 *mask_ptr, mask, m;
/* Get the journal superblock */
if ((retval = io_channel_read_blk64(fs->io,