2014-02-13 19:19:01 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Oracle. All rights reserved.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2015-04-17 16:29:38 +00:00
|
|
|
#ifndef __CMDS_FI_USAGE_H__
|
|
|
|
#define __CMDS_FI_USAGE_H__
|
2014-02-13 19:19:01 +00:00
|
|
|
|
2015-06-10 00:21:42 +00:00
|
|
|
#include "kerncompat.h"
|
2023-04-19 21:17:12 +00:00
|
|
|
#include "kernel-shared/uapi/btrfs.h"
|
2015-06-10 00:21:42 +00:00
|
|
|
|
2014-04-23 17:00:22 +00:00
|
|
|
struct device_info {
|
|
|
|
u64 devid;
|
|
|
|
char path[BTRFS_DEVICE_PATH_NAME_MAX];
|
2014-04-24 16:32:27 +00:00
|
|
|
/* Size of the block device */
|
|
|
|
u64 device_size;
|
|
|
|
/* Size that's occupied by the filesystem, can be changed via resize */
|
|
|
|
u64 size;
|
2014-04-23 17:00:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To store the size information about the chunks:
|
|
|
|
* the chunks info are grouped by the tuple (type, devid, num_stripes),
|
|
|
|
* i.e. if two chunks are of the same type (RAID1, DUP...), are on the
|
|
|
|
* same disk, have the same stripes then their sizes are grouped
|
|
|
|
*/
|
|
|
|
struct chunk_info {
|
|
|
|
u64 type;
|
|
|
|
u64 size;
|
|
|
|
u64 devid;
|
|
|
|
u64 num_stripes;
|
|
|
|
};
|
|
|
|
|
2022-09-23 08:07:29 +00:00
|
|
|
int load_chunk_and_device_info(int fd, struct chunk_info **chunkinfo_ret,
|
|
|
|
int *chunkcount_ret, struct device_info **devinfo_ret,
|
|
|
|
int *devcount_ret);
|
2017-02-09 16:42:02 +00:00
|
|
|
void print_device_chunks(struct device_info *devinfo,
|
2022-09-23 08:07:29 +00:00
|
|
|
struct chunk_info *chunk_info, int chunkcount, unsigned unit_mode);
|
2017-02-09 16:42:02 +00:00
|
|
|
void print_device_sizes(struct device_info *devinfo, unsigned unit_mode);
|
2017-10-26 18:44:55 +00:00
|
|
|
int dev_to_fsid(const char *dev, u8 *fsid);
|
2014-02-13 19:20:12 +00:00
|
|
|
|
2014-02-13 19:19:01 +00:00
|
|
|
#endif
|