Skip to content

Commit

Permalink
Refactor #includes and headers
Browse files Browse the repository at this point in the history
- Try and remove unneeded #include lines
- Try and add #include lines that would allow the files to be built in a
  more standalone manner

Signed-off-by: Sitsofe Wheeler <[email protected]>
  • Loading branch information
sitsofe committed Mar 21, 2018
1 parent 0f0346e commit 3d2d14b
Show file tree
Hide file tree
Showing 106 changed files with 83 additions and 212 deletions.
12 changes: 0 additions & 12 deletions backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,17 @@
*
*/
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <locale.h>
#include <assert.h>
#include <time.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ipc.h>
#include <sys/mman.h>
#include <math.h>

#include "fio.h"
#ifndef FIO_NO_HAVE_SHM_H
#include <sys/shm.h>
#endif
#include "hash.h"
#include "smalloc.h"
#include "verify.h"
#include "trim.h"
#include "diskutil.h"
#include "cgroup.h"
#include "profile.h"
Expand Down
2 changes: 0 additions & 2 deletions blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
#include <dirent.h>

#include "flist.h"
#include "fio.h"
Expand Down
1 change: 1 addition & 0 deletions cconv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <string.h>

#include "log.h"
#include "thread_options.h"

static void string_to_cpu(char **dst, const uint8_t *src)
Expand Down
1 change: 0 additions & 1 deletion cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <stdlib.h>
#include <mntent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "fio.h"
#include "flist.h"
#include "cgroup.h"
Expand Down
4 changes: 1 addition & 3 deletions client.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/poll.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
Expand All @@ -23,7 +21,7 @@
#include "server.h"
#include "flist.h"
#include "hash.h"
#include "verify.h"
#include "verify-state.h"

static void handle_du(struct fio_client *client, struct fio_net_cmd *cmd);
static void handle_ts(struct fio_client *client, struct fio_net_cmd *cmd);
Expand Down
6 changes: 2 additions & 4 deletions client.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef CLIENT_H
#define CLIENT_H

#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
Expand All @@ -10,7 +9,6 @@
#include "stat.h"

struct fio_net_cmd;
struct client_ops;

enum {
Client_created = 0,
Expand Down Expand Up @@ -83,6 +81,8 @@ typedef void (client_eta_op)(struct jobs_eta *je);
typedef void (client_timed_out_op)(struct fio_client *);
typedef void (client_jobs_eta_op)(struct fio_client *client, struct jobs_eta *je);

extern struct client_ops fio_client_ops;

struct client_ops {
client_cmd_op *text;
client_cmd_op *disk_util;
Expand All @@ -105,8 +105,6 @@ struct client_ops {
uint32_t client_type;
};

extern struct client_ops fio_client_ops;

struct client_eta {
unsigned int pending;
struct jobs_eta eta;
Expand Down
1 change: 0 additions & 1 deletion compiler/compiler.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef FIO_COMPILER_H
#define FIO_COMPILER_H
#include <assert.h>

#if __GNUC__ >= 4
#include "compiler-gcc4.h"
Expand Down
1 change: 0 additions & 1 deletion crc/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */

#include <inttypes.h>
#include "crc32.h"

static const uint32_t crctab[256] = {
Expand Down
2 changes: 2 additions & 0 deletions crc/crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef CRC32_H
#define CRC32_H

#include <inttypes.h>

extern uint32_t fio_crc32(const void * const, unsigned long);

#endif
7 changes: 0 additions & 7 deletions crc/crc32c-intel.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#include <inttypes.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "crc32c.h"

/*
Expand Down
2 changes: 0 additions & 2 deletions crc/crc32c.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
* any later version.
*
*/
#include <inttypes.h>

#include "crc32c.h"

/*
Expand Down
2 changes: 2 additions & 0 deletions crc/crc32c.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef CRC32C_H
#define CRC32C_H

#include <inttypes.h>

#include "../arch/arch.h"
#include "../lib/types.h"

Expand Down
1 change: 0 additions & 1 deletion crc/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Shamelessly lifted from the 2.6 kernel (crypto/md5.c)
*/
#include <string.h>
#include <stdint.h>
#include "md5.h"

static void md5_transform(uint32_t *hash, uint32_t const *in)
Expand Down
2 changes: 2 additions & 0 deletions crc/sha1.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef FIO_SHA1
#define FIO_SHA1

#include <inttypes.h>

/*
* Based on the Mozilla SHA1 (see mozilla-sha1/sha1.h),
* optimized to do word accesses rather than byte accesses,
Expand Down
1 change: 0 additions & 1 deletion crc/sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*
*/
#include <string.h>
#include <inttypes.h>

#include "../lib/bswap.h"
#include "sha256.h"
Expand Down
2 changes: 2 additions & 0 deletions crc/sha256.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef FIO_SHA256_H
#define FIO_SHA256_H

#include <inttypes.h>

#define SHA256_DIGEST_SIZE 32
#define SHA256_BLOCK_SIZE 64

Expand Down
1 change: 0 additions & 1 deletion crc/sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*
*/
#include <string.h>
#include <inttypes.h>

#include "../os/os.h"

Expand Down
1 change: 0 additions & 1 deletion crc/sha512.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

#include <string.h>
#include <inttypes.h>

#include "../lib/bswap.h"
#include "sha512.h"
Expand Down
2 changes: 2 additions & 0 deletions crc/sha512.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef FIO_SHA512_H
#define FIO_SHA512_H

#include <inttypes.h>

struct fio_sha512_ctx {
uint64_t state[8];
uint32_t count[4];
Expand Down
5 changes: 3 additions & 2 deletions crc/test.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../fio.h"
#include "../gettime.h"
#include "../fio_time.h"
#include "../verify.h"
#include "../lib/rand.h"
#include "../os/os.h"

#include "../crc/md5.h"
#include "../crc/crc64.h"
Expand Down
5 changes: 3 additions & 2 deletions debug.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <assert.h>
#include <stdarg.h>
#include <sys/types.h>
#include <unistd.h>

#include "debug.h"
#include "log.h"

#ifdef FIO_INC_DEBUG
void __dprint(int type, const char *str, ...)
Expand Down
2 changes: 0 additions & 2 deletions debug.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#ifndef FIO_DEBUG_H
#define FIO_DEBUG_H

#include <assert.h>
#include "lib/types.h"
#include "log.h"

enum {
FD_PROCESS = 0,
Expand Down
3 changes: 0 additions & 3 deletions diskutil.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <dirent.h>
#include <libgen.h>
#include <math.h>
#include <assert.h>
#ifdef CONFIG_VALGRIND_DEV
#include <valgrind/drd.h>
#else
Expand Down
1 change: 0 additions & 1 deletion diskutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "json.h"
#define FIO_DU_NAME_SZ 64

#include "lib/output_buffer.h"
#include "helper_thread.h"
#include "fio_sem.h"

Expand Down
4 changes: 0 additions & 4 deletions engines/e4defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/uio.h>
#include <errno.h>
#include <assert.h>
#include <fcntl.h>

#include "../fio.h"
Expand Down
4 changes: 0 additions & 4 deletions engines/falloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/uio.h>
#include <errno.h>
#include <assert.h>
#include <fcntl.h>

#include "../fio.h"
Expand Down
2 changes: 0 additions & 2 deletions engines/filecreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
* of the file creation.
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

#include "../fio.h"
#include "../filehash.h"

struct fc_data {
enum fio_ddir stat_ddir;
Expand Down
8 changes: 1 addition & 7 deletions engines/ftruncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
* DDIR_WRITE does ftruncate
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/uio.h>
#include <errno.h>
#include <assert.h>
#include <fcntl.h>
#include <unistd.h>

#include "../fio.h"
#include "../filehash.h"

static int fio_ftruncate_queue(struct thread_data *td, struct io_u *io_u)
{
Expand Down
2 changes: 0 additions & 2 deletions engines/libaio.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
* IO engine using the Linux native aio interface.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <libaio.h>

#include "../fio.h"
Expand Down
1 change: 0 additions & 1 deletion engines/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>

Expand Down
3 changes: 0 additions & 3 deletions engines/mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
* IO engine that reads/writes from MTD character devices.
*
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <mtd/mtd-user.h>

#include "../fio.h"
#include "../optgroup.h"
#include "../verify.h"
#include "../oslib/libmtd.h"

static libmtd_t desc;
Expand Down
2 changes: 0 additions & 2 deletions engines/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <assert.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/poll.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
Expand Down
Loading

0 comments on commit 3d2d14b

Please sign in to comment.