File: device-scan.h

package info (click to toggle)
btrfs-progs 6.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,612 kB
  • sloc: ansic: 127,282; sh: 7,915; python: 1,384; makefile: 900; asm: 296
file content (63 lines) | stat: -rw-r--r-- 1,866 bytes parent folder | download | duplicates (5)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License v2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 021110-1307, USA.
 */

#ifndef __DEVICE_SCAN_H__
#define __DEVICE_SCAN_H__

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

enum {
	BTRFS_SCAN_MOUNTED	= (1ULL << 0),
	BTRFS_SCAN_LBLKID	= (1ULL << 1)
};

enum {
	BTRFS_ARG_UNKNOWN,
	BTRFS_ARG_MNTPOINT,
	BTRFS_ARG_UUID,
	BTRFS_ARG_BLKDEV,
	BTRFS_ARG_REG,
};

#define SEEN_FSID_HASH_SIZE 256

struct btrfs_root;
struct btrfs_trans_handle;

struct seen_fsid {
	u8 fsid[BTRFS_FSID_SIZE];
	struct seen_fsid *next;
	int fd;
};

int btrfs_scan_devices(int verbose);
int btrfs_scan_argv_devices(int dev_optind, int argc, char **argv);
int btrfs_register_one_device(const char *fname);
int btrfs_register_all_devices(void);
int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
		      struct btrfs_root *root, int fd, const char *path,
		      u64 device_total_bytes, u32 io_width, u32 io_align,
		      u32 sectorsize);
int btrfs_device_already_in_root(struct btrfs_root *root, int fd,
				 int super_offset);
int is_seen_fsid(u8 *fsid, struct seen_fsid *seen_fsid_hash[]);
int add_seen_fsid(u8 *fsid, struct seen_fsid *seen_fsid_hash[], int fd);
void free_seen_fsid(struct seen_fsid *seen_fsid_hash[]);
int test_uuid_unique(const char *uuid_str);

#endif