Skip to content

Commit

Permalink
btrfs-progs: clean up includes
Browse files Browse the repository at this point in the history
Remove unused includes, add ones that are missing.

Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Jan 16, 2025
1 parent 5af36f0 commit abad680
Show file tree
Hide file tree
Showing 71 changed files with 44 additions and 84 deletions.
5 changes: 5 additions & 0 deletions check/mode-original.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
#ifndef __BTRFS_CHECK_MODE_ORIGINAL_H__
#define __BTRFS_CHECK_MODE_ORIGINAL_H__

#include "kerncompat.h"
#include "kernel-lib/rbtree.h"
#include "kernel-lib/list.h"
#include "kernel-shared/uapi/btrfs_tree.h"
#include "common/extent-cache.h"
#include "common/rbtree-utils.h"

struct extent_backref {
Expand Down
1 change: 0 additions & 1 deletion cmds/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <dirent.h>
#include <stdbool.h>
#include "kernel-shared/zoned.h"
#include "kernel-shared/volumes.h"
#include "common/string-table.h"
#include "common/utils.h"
#include "common/help.h"
Expand Down
2 changes: 1 addition & 1 deletion cmds/filesystem-usage.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define __CMDS_FI_USAGE_H__

#include "kerncompat.h"
#include "kernel-shared/volumes.h"
#include "kernel-shared/uapi/btrfs.h"
#include "common/array.h"

struct device_info {
Expand Down
2 changes: 2 additions & 0 deletions cmds/props.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef __BTRFS_PROPS_H__
#define __BTRFS_PROPS_H__

#include <stdbool.h>

enum prop_object_type {
prop_object_dev = (1U << 0),
prop_object_root = (1U << 1),
Expand Down
2 changes: 0 additions & 2 deletions cmds/reflink.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <unistd.h>
#include "kernel-lib/list.h"
#include "common/messages.h"
#include "common/open-utils.h"
#include "common/parse-utils.h"
#include "common/string-utils.h"
#include "common/help.h"
#include "cmds/commands.h"
Expand Down
2 changes: 0 additions & 2 deletions cmds/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@
#include "common/open-utils.h"
#include "common/units.h"
#include "common/device-utils.h"
#include "common/parse-utils.h"
#include "common/sysfs-utils.h"
#include "common/string-table.h"
#include "common/string-utils.h"
#include "common/parse-utils.h"
#include "common/help.h"
#include "cmds/commands.h"

Expand Down
2 changes: 1 addition & 1 deletion common/clear-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include "kernel-shared/file-item.h"
#include "common/internal.h"
#include "common/messages.h"
#include "common/clear-cache.h"
#include "check/repair.h"
#include "check/mode-common.h"
#include "common/clear-cache.h"

/*
* Number of free space cache inodes to delete in one transaction.
Expand Down
1 change: 0 additions & 1 deletion common/device-scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "kerncompat.h"
#include <dirent.h>
#include "kernel-lib/bitops.h"
#include "kernel-shared/uapi/btrfs.h"

enum {
Expand Down
1 change: 0 additions & 1 deletion common/device-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "kerncompat.h"
#include <stdbool.h>
#include <unistd.h>
#include "kernel-lib/bitops.h"

struct btrfs_ioctl_dev_info_args;
struct stat;
Expand Down
4 changes: 0 additions & 4 deletions common/extent-tree-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@

#include "kerncompat.h"
#include <stddef.h>
#include "kernel-shared/accessors.h"
#include "kernel-shared/uapi/btrfs_tree.h"
#include "kernel-shared/ctree.h"
#include "kernel-shared/disk-io.h"
#include "kernel-shared/free-space-tree.h"
#include "kernel-shared/transaction.h"
#include "common/extent-tree-utils.h"

/*
Expand Down
2 changes: 0 additions & 2 deletions common/extent-tree-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#define _EXTENT_TREE_UTILS_H_

#include "kerncompat.h"
#include "kernel-lib/bitops.h"
#include "kernel-shared/compression.h"

struct btrfs_inode_item;
struct btrfs_path;
Expand Down
1 change: 1 addition & 0 deletions common/fsfeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "kerncompat.h"
#include <stdio.h>
#include "kernel-lib/sizes.h"
#include "kernel-shared/uapi/btrfs.h"

#define BTRFS_MKFS_DEFAULT_NODE_SIZE SZ_16K

Expand Down
6 changes: 4 additions & 2 deletions common/root-tree-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
* Boston, MA 021110-1307, USA.
*/

#include "kerncompat.h"
#include <time.h>
#include <uuid/uuid.h>
#include "common/root-tree-utils.h"
#include "common/messages.h"
#include "kernel-shared/disk-io.h"
#include "kernel-shared/uuid-tree.h"
#include "kernel-shared/transaction.h"
#include "common/root-tree-utils.h"
#include "common/messages.h"

int btrfs_make_root_dir(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 objectid)
Expand Down
6 changes: 5 additions & 1 deletion common/root-tree-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#ifndef __ROOT_TREE_UTILS_H__
#define __ROOT_TREE_UTILS_H__

#include "kernel-shared/transaction.h"
#include "kerncompat.h"

struct btrfs_root;
struct btrfs_fs_info;
struct btrfs_trans_handle;

int btrfs_make_root_dir(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 objectid);
Expand Down
1 change: 0 additions & 1 deletion common/send-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "kernel-shared/accessors.h"
#include "kernel-shared/uapi/btrfs_tree.h"
#include "kernel-shared/uapi/btrfs.h"
#include "kernel-shared/send.h"
Expand Down
1 change: 1 addition & 0 deletions common/send-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "kerncompat.h"
#include <stddef.h>
#include "kernel-shared/uapi/btrfs.h"

enum subvol_search_type {
subvol_search_by_root_id,
Expand Down
1 change: 1 addition & 0 deletions common/sysfs-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef __COMMON_SYSFS_UTILS__
#define __COMMON_SYSFS_UTILS__

#include "kerncompat.h"
#include <stddef.h>

int sysfs_open_file(const char *name);
Expand Down
3 changes: 2 additions & 1 deletion common/tree-search.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#ifndef __COMMON_TREE_SEARCH_H__
#define __COMMON_TREE_SEARCH_H__

#include "kernel-shared/uapi/btrfs_tree.h"
#include "kerncompat.h"
#include <stdbool.h>
#include "kernel-shared/uapi/btrfs.h"

#define BTRFS_TREE_SEARCH_V2_BUF_SIZE 65536
Expand Down
1 change: 0 additions & 1 deletion common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <sys/stat.h>
#include "kernel-lib/list.h"
#include "kernel-shared/volumes.h"
#include "common/fsfeatures.h"

struct list_head;

Expand Down
1 change: 0 additions & 1 deletion convert/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "kernel-shared/file-item.h"
#include "kernel-shared/transaction.h"
#include "kernel-shared/free-space-tree.h"
#include "common/path-utils.h"
#include "common/messages.h"
#include "common/string-utils.h"
#include "common/extent-tree-utils.h"
Expand Down
1 change: 0 additions & 1 deletion convert/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
#include "common/cpu-utils.h"
#include "common/messages.h"
#include "common/task-utils.h"
#include "common/path-utils.h"
#include "common/help.h"
#include "common/parse-utils.h"
#include "common/string-utils.h"
Expand Down
1 change: 0 additions & 1 deletion crypto/blake2b-avx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include "blake2.h"
Expand Down
2 changes: 0 additions & 2 deletions crypto/blake2b-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
#include <stdint.h>
#include <string.h>
#include <stdio.h>

#include "blake2.h"
#include "blake2-impl.h"

#include "common/cpu-utils.h"

static const uint64_t blake2b_IV[8] =
Expand Down
2 changes: 0 additions & 2 deletions crypto/blake2b-sse2.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/

#include <stdint.h>
#include <string.h>

#include "blake2.h"
#include "blake2-impl.h"
#include "blake2-config.h"
Expand Down
3 changes: 0 additions & 3 deletions crypto/blake2b-sse41.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*/

#include <stdint.h>
#include <string.h>
#include <stdio.h>

#include "blake2.h"
#include "blake2-impl.h"
#include "blake2-config.h"
Expand Down
3 changes: 0 additions & 3 deletions crypto/hash-speedtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
#define HAVE_PERF
#endif
#include "crypto/hash.h"
#include "crypto/crc32c.h"
#include "crypto/sha.h"
#include "crypto/blake2.h"
#include "common/messages.h"
#include "common/cpu-utils.h"

Expand Down
3 changes: 0 additions & 3 deletions crypto/hash-vectest.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

#include "kerncompat.h"
#include "crypto/hash.h"
#include "crypto/crc32c.h"
#include "crypto/sha.h"
#include "crypto/blake2.h"
#include "common/messages.h"
#include "common/cpu-utils.h"

Expand Down
1 change: 1 addition & 0 deletions crypto/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Boston, MA 021110-1307, USA.
*/

#include "kerncompat.h"
#include "crypto/hash.h"
#include "crypto/crc32c.h"
#include "crypto/xxhash.h"
Expand Down
1 change: 0 additions & 1 deletion crypto/sha224-256.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

#include "crypto/sha.h"
#include "crypto/sha-private.h"

#include "common/cpu-utils.h"

/* Define the SHA shift, rotate left, and rotate right macros */
Expand Down
1 change: 0 additions & 1 deletion image/metadump.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "kerncompat.h"
#include <pthread.h>
#include "kernel-lib/rbtree.h"
#include "kernel-lib/list.h"
#include "kernel-lib/sizes.h"
#include "kernel-shared/ctree.h"
Expand Down
2 changes: 1 addition & 1 deletion kernel-lib/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef _BTRFS_PROGS_LINUX_BITMAP_H_
#define _BTRFS_PROGS_LINUX_BITMAP_H_

#include <stdlib.h>
#include "kerncompat.h"
#include <stdlib.h>
#include "kernel-lib/bitops.h"

static inline unsigned long *bitmap_zalloc(unsigned int nbits)
Expand Down
3 changes: 0 additions & 3 deletions kernel-lib/mktables.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
*/

#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <stdlib.h>
#include <time.h>

static uint8_t gfmul(uint8_t a, uint8_t b)
{
Expand Down
2 changes: 2 additions & 0 deletions kernel-lib/overflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#define __LINUX_OVERFLOW_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

/*
* We need to compute the minimum and maximum values representable in a given
Expand Down
2 changes: 1 addition & 1 deletion kernel-lib/raid56.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
*
* This file was postprocessed using unroll.pl and then ported to userspace
*/
#include "kerncompat.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "kerncompat.h"
#include "kernel-shared/volumes.h"
#include "kernel-shared/uapi/btrfs_tree.h"
#include "kernel-lib/raid56.h"
Expand Down
1 change: 0 additions & 1 deletion kernel-lib/raid56.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "kerncompat.h"
#include <stddef.h>
#include "kernel-lib/bitops.h"

void raid6_gen_syndrome(int disks, size_t bytes, void **ptrs);
int raid5_gen_result(int nr_devs, size_t stripe_len, int dest, void **data);
Expand Down
2 changes: 2 additions & 0 deletions kernel-lib/trace.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef __PROGS_TRACE_H__
#define __PROGS_TRACE_H__

#include "kerncompat.h"

struct btrfs_work;
struct btrfs_fs_info;
struct extent_state;
Expand Down
1 change: 0 additions & 1 deletion kernel-shared/accessors.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "kerncompat.h"
#include <stddef.h>
#include <string.h>
#include "kernel-lib/bitops.h"
#include "kernel-shared/extent_io.h"
#include "kernel-shared/uapi/btrfs.h"
#include "kernel-shared/uapi/btrfs_tree.h"
Expand Down
1 change: 0 additions & 1 deletion kernel-shared/async-thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "kerncompat.h"
#include <stdbool.h>
#include "kernel-lib/list.h"
#include "kernel-lib/bitops.h"

struct btrfs_fs_info;
struct btrfs_workqueue;
Expand Down
1 change: 0 additions & 1 deletion kernel-shared/backref.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include "kernel-lib/list.h"
#include "kernel-shared/accessors.h"
#include "kernel-shared/extent_io.h"
Expand Down
1 change: 0 additions & 1 deletion kernel-shared/backref.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#define __BTRFS_BACKREF_H__

#include "kerncompat.h"
#include "kernel-lib/bitops.h"

struct btrfs_extent_item;
struct btrfs_fs_info;
Expand Down
1 change: 0 additions & 1 deletion kernel-shared/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <stdbool.h>
#include <stddef.h>
#include "kernel-lib/list.h"
#include "kernel-lib/bitops.h"
#include "kernel-lib/rbtree_types.h"
#include "kernel-shared/uapi/btrfs.h"
#include "kernel-shared/uapi/btrfs_tree.h"
Expand Down
1 change: 0 additions & 1 deletion kernel-shared/delayed-ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <stdbool.h>
#include "kernel-lib/list.h"
#include "kernel-lib/rbtree_types.h"
#include "kernel-lib/bitops.h"
#include "kernel-shared/ctree.h"
#include "kernel-shared/uapi/btrfs_tree.h"

Expand Down
Loading

0 comments on commit abad680

Please sign in to comment.