⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 storage_util.h

📁 270的linux说明
💻 H
字号:
/*

Copyright (c) 2008, Intel Corporation. 

All rights reserved.

 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:


    * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution.

    * Neither the name of Intel Corporation nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

*/#ifndef _STORE_UTIL_H#define _STORE_UTIL_H#include <list>using namespace std;//XXX: tricky!#define INTERNAL_PREFIX_I519 "/dev/fl"#define INTERNAL_PREFIX_Z "/dev/mtd"#define SD_PREFIX "/dev/mmc"#define CF_PREFIX "/dev/hd"#define HD_PREFIX "/dev/sd"#define MNT_TABLE_FILE "/proc/mounts" //"/etc/mtab"#define PROC_PARTITIONS "/proc/partitions"typedef enum{UNKNOWN_INTERFACE, INTERNAL, SD, CF, HD, NET} interface_t;typedef enum{UNKNOWN_ACCESS, RW, RO} access_t;typedef enum{UNKNOWN_FS, JJFS, EXT2FS, EXT3FS, VFATFS} fs_t;typedef struct _store_info{	char name[256];	char mount_dir[256];	/*unsigned int*/interface_t interface;	/*unsigned int*/access_t access;	/*unsigned int*/fs_t fs_type;	unsigned long long capacity;	unsigned long long free;	int valid;}store_info_t;	int FindStoreInit();int FindStoreFini();int FindFirstStore(store_info_t* pinfo);int FindNextStore(store_info_t* pinfo);int GetStore(store_info_t* pinfo, char *name);int IsDisk(store_info_t* pinfo);//nhu: to support the complete storage info modeltypedef struct _disk_info{	char name[512];	interface_t interface;	unsigned long long capacity;}disk_info_t;typedef struct _part_info{	char name[512];	char mount_dir[512];	access_t access;	fs_t fs_type;	unsigned long long capacity;	unsigned long long free;}part_info_t;typedef struct _flash_info{	char name[256];	char mount_dir[256];	interface_t interface;	access_t access;	fs_t fs_type;	unsigned long long capacity;	unsigned long long free;}flash_info_t;//disk(sd, cf, hd) has 1:n info modelbool GetDiskList(list<disk_info_t> &dlist);bool GetDiskPartitionList(disk_info_t *dinfo, list<part_info_t> &plist);//internal flash has 1:1 info modelbool GetInternalFlashList(list<flash_info_t> &flist);//network fs has 0:1 info modelbool GetNetworkPartitionList(list<part_info_t> &plist);//get all disk and net partitionbool GetPartitionList(list<part_info_t> &pinfo_list);//get disk info include flash diskbool GetDiskInfo(disk_info_t *dinfo);//get flash infobool GetFlashInfo(flash_info_t *finfo);//get all partition info including disk, net, flashbool GetPartitionInfo(part_info_t *pinfo);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -