File: tree-search.h

package info (click to toggle)
btrfs-progs 6.16-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 20,504 kB
  • sloc: ansic: 126,181; sh: 7,642; python: 1,386; makefile: 900; asm: 296
file content (34 lines) | stat: -rw-r--r-- 887 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __COMMON_TREE_SEARCH_H__
#define __COMMON_TREE_SEARCH_H__

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

#define BTRFS_TREE_SEARCH_V2_BUF_SIZE		65536

struct btrfs_tree_search_args {
	bool use_v2;
	union {
		struct btrfs_ioctl_search_args args1;
		struct btrfs_ioctl_search_args_v2 args2;
		u8 filler[sizeof(struct btrfs_ioctl_search_args_v2) +
			  BTRFS_TREE_SEARCH_V2_BUF_SIZE];
	};
};

int btrfs_tree_search_ioctl(int fd, struct btrfs_tree_search_args *sa);

static inline struct btrfs_ioctl_search_key *btrfs_tree_search_sk(struct btrfs_tree_search_args *sa)
{
	/* Same offset for v1 and v2. */
	return &sa->args1.key;
}

static inline void *btrfs_tree_search_data(struct btrfs_tree_search_args *sa, unsigned long offset) {
	if (sa->use_v2)
		return (void *)(sa->args2.buf + offset);
	return (void *)(sa->args1.buf + offset);
}

#endif