2013-06-12 14:08:56 +04:00
/*
* Copyright ( C ) 2013 Red Hat , Inc . All rights reserved .
*
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v .2 .1 .
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program ; if not , write to the Free Software Foundation ,
2016-01-21 13:49:46 +03:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
2013-06-12 14:08:56 +04:00
*/
# ifndef _LVM_DEV_TYPE_H
# define _LVM_DEV_TYPE_H
2018-05-14 12:30:20 +03:00
# include "lib/device/device.h"
# include "lib/display/display.h"
# include "lib/label/label.h"
2013-06-12 14:08:56 +04:00
# define NUMBER_OF_MAJORS 4096
2013-11-13 17:56:29 +04:00
# ifdef __linux__
2018-05-14 12:30:20 +03:00
# include "libdm / misc / kdev_t.h"
2013-06-12 14:08:56 +04:00
# else
# define MAJOR(x) major((x))
# define MINOR(x) minor((x))
# define MKDEV(x,y) makedev((x),(y))
# endif
# define PARTITION_SCSI_DEVICE (1 << 0)
struct dev_type_def {
int max_partitions ; /* 0 means LVM won't use this major number. */
int flags ;
} ;
struct dev_types {
int md_major ;
int blkext_major ;
int drbd_major ;
int device_mapper_major ;
int emcpower_major ;
2017-01-11 01:23:23 +03:00
int vxdmp_major ;
2013-06-12 14:08:56 +04:00
int power2_major ;
2015-01-23 23:01:34 +03:00
int dasd_major ;
2016-06-01 17:39:47 +03:00
int loop_major ;
2013-06-12 14:08:56 +04:00
struct dev_type_def dev_type_array [ NUMBER_OF_MAJORS ] ;
} ;
struct dev_types * create_dev_types ( const char * proc_dir , const struct dm_config_node * cn ) ;
/* Subsystems */
int dev_subsystem_part_major ( struct dev_types * dt , struct device * dev ) ;
const char * dev_subsystem_name ( struct dev_types * dt , struct device * dev ) ;
int major_is_scsi_device ( struct dev_types * dt , int major ) ;
/* Signature/superblock recognition with position returned where found. */
2019-05-21 19:44:39 +03:00
int dev_is_md_component ( struct device * dev , uint64_t * sb , int full ) ;
2018-05-04 01:12:07 +03:00
int dev_is_swap ( struct device * dev , uint64_t * signature , int full ) ;
int dev_is_luks ( struct device * dev , uint64_t * signature , int full ) ;
2015-10-12 10:09:11 +03:00
int dasd_is_cdl_formatted ( struct device * dev ) ;
2016-09-05 13:13:10 +03:00
int udev_dev_is_mpath_component ( struct device * dev ) ;
2018-12-03 20:22:45 +03:00
int udev_dev_is_md_component ( struct device * dev ) ;
2013-06-12 14:08:56 +04:00
2018-05-01 22:32:15 +03:00
int dev_is_lvm1 ( struct device * dev , char * buf , int buflen ) ;
int dev_is_pool ( struct device * dev , char * buf , int buflen ) ;
2013-11-06 18:09:29 +04:00
/* Signature wiping. */
2014-02-10 16:28:13 +04:00
# define TYPE_LVM1_MEMBER 0x001
# define TYPE_LVM2_MEMBER 0x002
# define TYPE_DM_SNAPSHOT_COW 0x004
2013-11-28 16:14:46 +04:00
int wipe_known_signatures ( struct cmd_context * cmd , struct device * dev , const char * name ,
2014-02-10 16:28:13 +04:00
uint32_t types_to_exclude , uint32_t types_no_prompt ,
2015-02-17 11:46:34 +03:00
int yes , force_t force , int * wiped ) ;
2013-11-06 18:09:29 +04:00
2013-06-12 14:08:56 +04:00
/* Type-specific device properties */
unsigned long dev_md_stripe_width ( struct dev_types * dt , struct device * dev ) ;
2018-06-15 19:42:10 +03:00
int dev_is_md_with_end_superblock ( struct dev_types * dt , struct device * dev ) ;
2013-06-12 14:08:56 +04:00
/* Partitioning */
int major_max_partitions ( struct dev_types * dt , int major ) ;
int dev_is_partitioned ( struct dev_types * dt , struct device * dev ) ;
int dev_get_primary_dev ( struct dev_types * dt , struct device * dev , dev_t * result ) ;
/* Various device properties */
unsigned long dev_alignment_offset ( struct dev_types * dt , struct device * dev ) ;
unsigned long dev_minimum_io_size ( struct dev_types * dt , struct device * dev ) ;
unsigned long dev_optimal_io_size ( struct dev_types * dt , struct device * dev ) ;
unsigned long dev_discard_max_bytes ( struct dev_types * dt , struct device * dev ) ;
unsigned long dev_discard_granularity ( struct dev_types * dt , struct device * dev ) ;
2014-09-16 03:44:25 +04:00
int dev_is_rotational ( struct dev_types * dt , struct device * dev ) ;
2018-08-27 22:53:09 +03:00
int dev_is_pmem ( struct device * dev ) ;
2020-12-03 19:48:21 +03:00
int dev_is_nvme ( struct dev_types * dt , struct device * dev ) ;
2018-12-07 23:35:22 +03:00
int dev_is_lv ( struct device * dev ) ;
2019-11-21 01:07:27 +03:00
int get_fs_block_size ( struct device * dev , uint32_t * fs_block_size ) ;
2013-06-12 14:08:56 +04:00
# endif