[style] Update code format with clang-format

This commit is contained in:
Mingkai Dong 2023-06-15 19:53:53 +08:00
parent ccc5eec169
commit d79ab7dfe9
2 changed files with 682 additions and 661 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,86 +15,88 @@
#define Magic_identity_number 0xABCDEF98
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */
typedef unsigned int u_int;
typedef uint16_t WORD; /* 16-bit unsigned integer */
typedef uint32_t DWORD; /* 32-bit unsigned integer */
typedef uint64_t QWORD; /* 64-bit unsigned integer */
typedef WORD WCHAR; /* UTF-16 character type */
typedef uint16_t WORD; /* 16-bit unsigned integer */
typedef uint32_t DWORD; /* 32-bit unsigned integer */
typedef uint64_t QWORD; /* 64-bit unsigned integer */
typedef WORD WCHAR; /* UTF-16 character type */
// typedef unsigned char BYTE;
enum dev_type{sd,udisk};
enum dev_type { sd, udisk };
struct v_device_components{
struct rt_device * dev;
enum dev_type type;
DWORD index;
struct rt_device_blk_geometry geometry;
DWORD next_allocated_sec_idx;
struct v_device_components {
struct rt_device *dev;
enum dev_type type;
DWORD index;
struct rt_device_blk_geometry geometry;
DWORD next_allocated_sec_idx;
};
struct operation_pair{
DWORD idx;
DWORD real_sec_number;
struct operation_pair {
DWORD idx;
DWORD real_sec_number;
};
struct buffer_wrapper{
BYTE * buf;
u_int offset;
struct buffer_wrapper {
BYTE *buf;
u_int offset;
};
struct seg{
u_int start;
u_int v_start;
u_int size;
u_int devid;
u_int if_blank;
struct seg {
u_int start;
u_int v_start;
u_int size;
u_int devid;
u_int if_blank;
};
struct operation_seg{
struct seg segs[64];
u_int seg_num;
struct operation_seg {
struct seg segs[64];
u_int seg_num;
};
struct virtual_disk
{
struct rt_device dev;
u_int v_sec_offset;
struct rt_device_blk_geometry geometry;
rt_device_t vs_pointer;
struct virtual_disk {
struct rt_device dev;
u_int v_sec_offset;
struct rt_device_blk_geometry geometry;
rt_device_t vs_pointer;
};
struct virtual_storage_device
{
rt_list_t list;
u_int virtual_storage_size;
struct rt_device dev;
struct v_device_components sub_dev[10]; //all suboardinate device,maybe udisk,sd card
int components_size;
struct rt_device_blk_geometry geometry;
rt_err_t (*register_components)(rt_device_t dev,const char *name,rt_uint16_t flags,enum dev_type tp);
// partition info
// u_int primary_index;
// u_int sub_index[10];
struct virtual_storage_device {
rt_list_t list;
u_int virtual_storage_size;
struct rt_device dev;
struct v_device_components
sub_dev[10]; // all suboardinate device,maybe udisk,sd card
int components_size;
struct rt_device_blk_geometry geometry;
rt_err_t (*register_components)(rt_device_t dev, const char *name,
rt_uint16_t flags, enum dev_type tp);
// partition info
// u_int primary_index;
// u_int sub_index[10];
};
static rt_err_t rt_vs_register_components(rt_device_t dev,const char *name,rt_uint16_t flags,enum dev_type tp);
static rt_err_t rt_vs_register_components(rt_device_t dev, const char *name,
rt_uint16_t flags, enum dev_type tp);
static rt_err_t rt_vs_init(rt_device_t dev);
static rt_err_t rt_vs_open(rt_device_t dev, rt_uint16_t oflag);
static rt_err_t rt_vs_close(rt_device_t dev);
static rt_err_t rt_vs_control(rt_device_t dev, int cmd, void *args);
static rt_size_t rt_vs_read(rt_device_t dev,rt_off_t pos,void *buffer,rt_size_t size);
static rt_size_t rt_vs_write(rt_device_t dev,rt_off_t pos,void *buffer,rt_size_t size);
static void st_dword (BYTE* ptr, DWORD val);
static void st_word (BYTE* ptr, WORD val);
static DWORD ld_dword (const BYTE* ptr);
static WORD ld_word (const BYTE* ptr);
static rt_size_t rt_vs_read(rt_device_t dev, rt_off_t pos, void *buffer,
rt_size_t size);
static rt_size_t rt_vs_write(rt_device_t dev, rt_off_t pos, void *buffer,
rt_size_t size);
static void st_dword(BYTE *ptr, DWORD val);
static void st_word(BYTE *ptr, WORD val);
static DWORD ld_dword(const BYTE *ptr);
static WORD ld_word(const BYTE *ptr);
static rt_err_t rt_vd_init(rt_device_t dev);
static rt_err_t rt_vd_open(rt_device_t dev, rt_uint16_t oflag);
static rt_err_t rt_vd_close(rt_device_t dev);
static rt_err_t rt_vd_control(rt_device_t dev, int cmd, void *args);
static rt_size_t rt_vd_read(rt_device_t dev,rt_off_t pos,void *buffer,rt_size_t size);
static rt_size_t rt_vd_write(rt_device_t dev,rt_off_t pos,void *buffer,rt_size_t size);
static rt_size_t rt_vd_read(rt_device_t dev, rt_off_t pos, void *buffer,
rt_size_t size);
static rt_size_t rt_vd_write(rt_device_t dev, rt_off_t pos, void *buffer,
rt_size_t size);
#endif