diff options
author | Gluster Ant <bugzilla-bot@gluster.org> | 2018-09-12 17:52:45 +0530 |
---|---|---|
committer | Nigel Babu <nigelb@redhat.com> | 2018-09-12 17:52:45 +0530 |
commit | e16868dede6455cab644805af6fe1ac312775e13 (patch) | |
tree | 15aebdb4fff2d87cf8a72f836816b3aa634da58d /tests/bugs/shard/shard-fallocate.c | |
parent | 45a71c0548b6fd2c757aa2e7b7671a1411948894 (diff) |
Land part 2 of clang-format changes
Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4
Signed-off-by: Nigel Babu <nigelb@redhat.com>
Diffstat (limited to 'tests/bugs/shard/shard-fallocate.c')
-rw-r--r-- | tests/bugs/shard/shard-fallocate.c | 151 |
1 files changed, 77 insertions, 74 deletions
diff --git a/tests/bugs/shard/shard-fallocate.c b/tests/bugs/shard/shard-fallocate.c index 8745c0ece1d..3a784d3c02c 100644 --- a/tests/bugs/shard/shard-fallocate.c +++ b/tests/bugs/shard/shard-fallocate.c @@ -6,104 +6,107 @@ #include <glusterfs/api/glfs-handles.h> enum fallocate_flag { - TEST_FALLOCATE_NONE, - TEST_FALLOCATE_KEEP_SIZE, - TEST_FALLOCATE_ZERO_RANGE, - TEST_FALLOCATE_PUNCH_HOLE, - TEST_FALLOCATE_MAX, + TEST_FALLOCATE_NONE, + TEST_FALLOCATE_KEEP_SIZE, + TEST_FALLOCATE_ZERO_RANGE, + TEST_FALLOCATE_PUNCH_HOLE, + TEST_FALLOCATE_MAX, }; int -get_fallocate_flag (int opcode) +get_fallocate_flag(int opcode) { - int ret = 0; + int ret = 0; - switch (opcode) { + switch (opcode) { case TEST_FALLOCATE_NONE: - ret = 0; - break; + ret = 0; + break; case TEST_FALLOCATE_KEEP_SIZE: - ret = FALLOC_FL_KEEP_SIZE; - break; + ret = FALLOC_FL_KEEP_SIZE; + break; case TEST_FALLOCATE_ZERO_RANGE: - ret = FALLOC_FL_ZERO_RANGE; - break; + ret = FALLOC_FL_ZERO_RANGE; + break; case TEST_FALLOCATE_PUNCH_HOLE: - ret = FALLOC_FL_PUNCH_HOLE; - break; + ret = FALLOC_FL_PUNCH_HOLE; + break; default: - ret = -1; - break; - } - return ret; + ret = -1; + break; + } + return ret; } int -main (int argc, char *argv[]) +main(int argc, char *argv[]) { - int ret = 1; - int opcode = -1; - off_t offset = 0; - size_t len = 0; - glfs_t *fs = NULL; - glfs_fd_t *fd = NULL; + int ret = 1; + int opcode = -1; + off_t offset = 0; + size_t len = 0; + glfs_t *fs = NULL; + glfs_fd_t *fd = NULL; - if (argc != 8) { - fprintf (stderr, "Syntax: %s <host> <volname> <opcode> <offset> <len> <file-path> <log-file>\n", argv[0]); - return 1; - } + if (argc != 8) { + fprintf(stderr, + "Syntax: %s <host> <volname> <opcode> <offset> <len> " + "<file-path> <log-file>\n", + argv[0]); + return 1; + } - fs = glfs_new (argv[2]); - if (!fs) { - fprintf (stderr, "glfs_new: returned NULL\n"); - return 1; - } + fs = glfs_new(argv[2]); + if (!fs) { + fprintf(stderr, "glfs_new: returned NULL\n"); + return 1; + } - ret = glfs_set_volfile_server (fs, "tcp", argv[1], 24007); - if (ret != 0) { - fprintf (stderr, "glfs_set_volfile_server: returned %d\n", ret); - goto out; - } + ret = glfs_set_volfile_server(fs, "tcp", argv[1], 24007); + if (ret != 0) { + fprintf(stderr, "glfs_set_volfile_server: returned %d\n", ret); + goto out; + } - ret = glfs_set_logging (fs, argv[7], 7); - if (ret != 0) { - fprintf (stderr, "glfs_set_logging: returned %d\n", ret); - goto out; - } + ret = glfs_set_logging(fs, argv[7], 7); + if (ret != 0) { + fprintf(stderr, "glfs_set_logging: returned %d\n", ret); + goto out; + } - ret = glfs_init (fs); - if (ret != 0) { - fprintf (stderr, "glfs_init: returned %d\n", ret); - goto out; - } + ret = glfs_init(fs); + if (ret != 0) { + fprintf(stderr, "glfs_init: returned %d\n", ret); + goto out; + } - opcode = atoi (argv[3]); - opcode = get_fallocate_flag (opcode); - if (opcode < 0) { - fprintf (stderr, "get_fallocate_flag: invalid flag \n"); - goto out; - } + opcode = atoi(argv[3]); + opcode = get_fallocate_flag(opcode); + if (opcode < 0) { + fprintf(stderr, "get_fallocate_flag: invalid flag \n"); + goto out; + } - offset = atoi (argv[4]); - len = atoi (argv[5]); + offset = atoi(argv[4]); + len = atoi(argv[5]); - fd = glfs_open (fs, argv[6], O_RDWR); - if (fd == NULL) { - fprintf (stderr, "glfs_open: returned NULL\n"); - goto out; - } + fd = glfs_open(fs, argv[6], O_RDWR); + if (fd == NULL) { + fprintf(stderr, "glfs_open: returned NULL\n"); + goto out; + } - ret = glfs_fallocate (fd, opcode, offset, len); - if (ret <= 0) { - fprintf (stderr, "glfs_fallocate: returned %d\n", ret); - goto out; - } + ret = glfs_fallocate(fd, opcode, offset, len); + if (ret <= 0) { + fprintf(stderr, "glfs_fallocate: returned %d\n", ret); + goto out; + } - ret = 0; + ret = 0; out: - if (fd) - glfs_close(fd); - glfs_fini (fs); - return ret; + if (fd) + glfs_close(fd); + glfs_fini(fs); + return ret; } |