CMCore/inc/hgl/filesystem/EnumVolume.h

93 lines
2.8 KiB
C
Raw Normal View History

2019-08-19 19:19:58 +08:00
#pragma once
#include<hgl/type/List.h>
namespace hgl
{
namespace filesystem
{
/**
*
*/
struct VolumeInfo
{
enum class DriverType
2019-08-19 19:19:58 +08:00
{
None=0,
2019-08-19 19:19:58 +08:00
Removable, ///<可移动设备
Fixed, ///<固定设备
Remote, ///<远程设备
CDROM, ///<光盘驱动器
RamDisk, ///<内存虚拟设备
2019-08-19 19:19:58 +08:00
ENUM_CLASS_RANGE(None,RamDisk)
2019-08-19 19:19:58 +08:00
};
u16char name[HGL_MAX_PATH]; ///<卷名称
u16char path[HGL_MAX_PATH]; ///<卷所对应的路径名(注意:不是所有卷都有对应路径)
DriverType driver_type; ///<驱动器类型(注意:不是所有的卷都对应驱动器)
uint32 serial; ///<卷序列号
u16char volume_label[HGL_MAX_PATH]; ///<卷标名称
u16char file_system[HGL_MAX_PATH]; ///<文件系统名称
uint32 filename_max_length; ///<文件名最大长度
bool unicode; ///<文件名支持UNICODE
uint64 available_space; ///<有效容量
uint64 total_space; ///<总空量
uint64 free_space; ///<自由容量
};//struct VolumeInfo
#if HGL_OS == HGL_OS_Windows
/**
*
*/
struct VolumeCheckConfig
{
bool removable =true;
bool fixed =true;
bool remote =true;
bool cdrom =true;
bool ram_disk =true;
bool unknow =true;
2019-08-19 19:19:58 +08:00
public:
/**
*
*/
bool isErrorConfig()const
{
if(removable)return(false);
if(fixed)return(false);
if(remote)return(false);
if(cdrom)return(false);
if(ram_disk)return(false);
if(unknow)return(false);
return(true);
}
};
using VolumeInfoList=List<VolumeInfo>;
2019-08-19 19:19:58 +08:00
/**
*
* @param vi_list
* @param check_removable
* @param check_remote
* @param check_cd
* @return -1
*/
int EnumVolume(VolumeInfoList &vi_list,const VolumeCheckConfig &);
2019-08-19 19:19:58 +08:00
#endif//HGL_OS == HGL_OS_Windows
}//namespace filesystem
}//namespace hgl