示例#1
0
struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
				 int writes)
{
	struct btrfs_fs_info *info;
	info = __open_ctree_fd(fp, path, sb_bytenr, 0, writes, 0);
	if (!info)
		return NULL;
	return info->fs_root;
}
示例#2
0
struct btrfs_root *open_ctree_recovery(const char *filename, u64 sb_bytenr,
				       u64 root_tree_bytenr)
{
	int fp;
	struct btrfs_fs_info *info;


	fp = open(filename, O_RDONLY);
	if (fp < 0) {
		fprintf (stderr, "Could not open %s\n", filename);
		return NULL;
	}
	info = __open_ctree_fd(fp, filename, sb_bytenr,
			       root_tree_bytenr, 0, 0);
	close(fp);

	if (!info)
		return NULL;
	return info->fs_root;
}
示例#3
0
struct btrfs_fs_info *open_ctree_fs_info(const char *filename,
					 u64 sb_bytenr, int writes,
					 int partial)
{
	int fp;
	struct btrfs_fs_info *info;
	int flags = O_CREAT | O_RDWR;

	if (!writes)
		flags = O_RDONLY;

	fp = open(filename, flags, 0600);
	if (fp < 0) {
		fprintf (stderr, "Could not open %s\n", filename);
		return NULL;
	}
	info = __open_ctree_fd(fp, filename, sb_bytenr, 0, writes, partial);
	close(fp);
	return info;
}