提交 e2dcea4f 编写于 作者: 鸿蒙内核源码分析's avatar 鸿蒙内核源码分析

对文件系统 磁盘,分区描述符的注释

搜索 @note_pic 可以查看全部字符图
搜索 @note_why 是注者尚未看明白的地方,如果您看明白了,请告诉注者完善
搜索 @note_thinking 是注者的思考和吐槽的地方
上级 d5ffaf97
...@@ -35,8 +35,12 @@ ...@@ -35,8 +35,12 @@
#ifdef LOSCFG_NET_LWIP_SACK #ifdef LOSCFG_NET_LWIP_SACK
#include <lwip/sockets.h> #include <lwip/sockets.h>
/*****************************************************
* posix socket标准接口,对 lwip协议族适配封装层
*****************************************************/
#if !LWIP_COMPAT_SOCKETS #if !LWIP_COMPAT_SOCKETS
//检查空指针,注意 do while(0)的妙用,想想这样写的好处是什么?
#define CHECK_NULL_PTR(ptr) do { if (ptr == NULL) { set_errno(EFAULT); return -1; } } while (0) #define CHECK_NULL_PTR(ptr) do { if (ptr == NULL) { set_errno(EFAULT); return -1; } } while (0)
//接受连接 //接受连接
int accept(int s, struct sockaddr *addr, socklen_t *addrlen) int accept(int s, struct sockaddr *addr, socklen_t *addrlen)
...@@ -97,7 +101,7 @@ int connect(int s, const struct sockaddr *name, socklen_t namelen) ...@@ -97,7 +101,7 @@ int connect(int s, const struct sockaddr *name, socklen_t namelen)
} }
return lwip_connect(s, name, namelen); return lwip_connect(s, name, namelen);
} }
//监听socket的请求 //监听socket的请求
int listen(int s, int backlog) int listen(int s, int backlog)
{ {
return lwip_listen(s, backlog); return lwip_listen(s, backlog);
...@@ -146,7 +150,13 @@ ssize_t sendto(int s, const void *dataptr, size_t size, int flags, ...@@ -146,7 +150,13 @@ ssize_t sendto(int s, const void *dataptr, size_t size, int flags,
} }
return lwip_sendto(s, dataptr, size, flags, to, tolen); return lwip_sendto(s, dataptr, size, flags, to, tolen);
} }
// 创建socket /*********************************************************
posix 之创建socket
domain: 协议族名字 如 AF_INET 为 IPv4
type: 指示类型
protocol:
返回FD
*********************************************************/
int socket(int domain, int type, int protocol) int socket(int domain, int type, int protocol)
{ {
return lwip_socket(domain, type, protocol); return lwip_socket(domain, type, protocol);
......
...@@ -165,49 +165,49 @@ extern "C" { ...@@ -165,49 +165,49 @@ extern "C" {
#define DISK_ATA_GET_MODEL 21 /* Get model name */ #define DISK_ATA_GET_MODEL 21 /* Get model name */
#define DISK_ATA_GET_SN 22 /* Get serial number */ #define DISK_ATA_GET_SN 22 /* Get serial number */
typedef enum _disk_status_ { typedef enum _disk_status_ {//磁盘的状态
STAT_UNUSED, STAT_UNUSED, //未使用
STAT_INUSED, STAT_INUSED, //使用中
STAT_UNREADY STAT_UNREADY //未准备,可理解为未格式化
} disk_status_e; } disk_status_e;
typedef struct _los_disk_ { typedef struct _los_disk_ { //磁盘描述符
UINT32 disk_id : 8; /* physics disk number */ UINT32 disk_id : 8; /* physics disk number */ //标识磁盘ID
UINT32 disk_status : 2; /* status of disk */ UINT32 disk_status : 2; /* status of disk */ //磁盘的状态 disk_status_e
UINT32 part_count : 8; /* current partition count */ UINT32 part_count : 8; /* current partition count */ //分了多少个区(los_part)
UINT32 reserved : 14; UINT32 reserved : 14; //保留,注意 disk_id|disk_status|part_count|reserved 共用一个UINT32
struct inode *dev; /* device */ struct inode *dev; /* device */
#ifdef LOSCFG_FS_FAT_CACHE #ifdef LOSCFG_FS_FAT_CACHE //磁盘缓存,在所有分区中共享
OsBcache *bcache; /* cache of the disk, shared in all partitions */ OsBcache *bcache; /* cache of the disk, shared in all partitions */
#endif #endif
UINT32 sector_size; /* disk sector size */ UINT32 sector_size; /* disk sector size */ //扇区大小
UINT64 sector_start; /* disk start sector */ UINT64 sector_start; /* disk start sector */ //开始扇区
UINT64 sector_count; /* disk sector number */ UINT64 sector_count; /* disk sector number *///扇区数量
UINT8 type; UINT8 type; //flash的类型 例如:EMMC
CHAR *disk_name; CHAR *disk_name; //设备名称
LOS_DL_LIST head; /* link head of all the partitions */ LOS_DL_LIST head; /* link head of all the partitions */ //双向链表上挂所有分区(los_part->list)
struct pthread_mutex disk_mutex; struct pthread_mutex disk_mutex;
} los_disk; } los_disk;
typedef struct _los_part_ { typedef struct _los_part_ {//分区描述符
UINT32 disk_id : 8; /* physics disk number */ UINT32 disk_id : 8; /* physics disk number */ //标识磁盘ID
UINT32 part_id : 8; /* partition number in the system */ UINT32 part_id : 8; /* partition number in the system */ //标识整个系统的分区ID
UINT32 part_no_disk : 8; /* partition number in the disk */ UINT32 part_no_disk : 8; /* partition number in the disk */ //标识所属磁盘的分区ID
UINT32 part_no_mbr : 5; /* partition number in the mbr */ UINT32 part_no_mbr : 5; /* partition number in the mbr */ //硬盘主引导记录(即Master Boot Record,一般简称为MBR),主分区ID
UINT32 reserved : 3; UINT32 reserved : 3; ////保留,注意 disk_id|part_id|part_no_disk|part_no_mbr|reserved 共用一个UINT32
UINT8 filesystem_type; /* filesystem used in the partition */ UINT8 filesystem_type; /* filesystem used in the partition */ //文件系统类型
UINT8 type; UINT8 type; //flash的类型 例如:EMMC
struct inode *dev; /* dev devices used in the partition */ struct inode *dev; /* dev devices used in the partition */ //分区所使用的dev设备
CHAR *part_name; CHAR *part_name; //区名称
UINT64 sector_start; /* UINT64 sector_start; /* //开始扇区编号
* offset of a partition to the primary devices * offset of a partition to the primary devices
* (multi-mbr partitions are seen as same parition) * (multi-mbr partitions are seen as same parition)
*/ */
UINT64 sector_count; /* UINT64 sector_count; /* //扇区数量
* sector numbers of a partition. If there is no addpartition operation, * sector numbers of a partition. If there is no addpartition operation,
* then all the mbr devices equal to the primary device count. * then all the mbr devices equal to the primary device count.
*/ */
LOS_DL_LIST list; /* linklist of partition */ LOS_DL_LIST list; /* linklist of partition */ //通过它挂到los_disk->head上
} los_part; } los_part;
struct partition_info { struct partition_info {
......
...@@ -85,6 +85,6 @@ struct files_struct *create_files_snapshot(const struct files_struct *oldf);// ...@@ -85,6 +85,6 @@ struct files_struct *create_files_snapshot(const struct files_struct *oldf);//
void delete_files_snapshot(struct files_struct *files);//删除文件管理器快照 void delete_files_snapshot(struct files_struct *files);//删除文件管理器快照
int alloc_fd(int minfd);//分配一个fd,当然是从files_struct->fdt 数组中拿一个未被使用(分配)的fd,默认都是 -1 int alloc_fd(int minfd);//分配一个fd,从files_struct->fdt 数组中拿一个未被使用(分配)的fd,默认都是 -1
#endif #endif
...@@ -48,13 +48,13 @@ extern "C" { ...@@ -48,13 +48,13 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* __cplusplus */ #endif /* __cplusplus */
los_disk g_sysDisk[SYS_MAX_DISK]; los_disk g_sysDisk[SYS_MAX_DISK];//支持挂载的磁盘总数量 5个
los_part g_sysPart[SYS_MAX_PART]; los_part g_sysPart[SYS_MAX_PART];//支持磁盘的分区总数量 5*16,每个磁盘最大分16个区
UINT32 g_uwFatSectorsPerBlock = CONFIG_FS_FAT_SECTOR_PER_BLOCK; UINT32 g_uwFatSectorsPerBlock = CONFIG_FS_FAT_SECTOR_PER_BLOCK; //每块支持扇区数 默认64个扇区
UINT32 g_uwFatBlockNums = CONFIG_FS_FAT_BLOCK_NUMS; UINT32 g_uwFatBlockNums = CONFIG_FS_FAT_BLOCK_NUMS; //块数量 默认28
spinlock_t g_diskSpinlock; spinlock_t g_diskSpinlock; //磁盘自锁锁
spinlock_t g_diskFatBlockSpinlock; spinlock_t g_diskFatBlockSpinlock;
UINT32 g_usbMode = 0; UINT32 g_usbMode = 0;
...@@ -216,7 +216,7 @@ static BOOL GetDiskUsbStatus(UINT32 diskID) ...@@ -216,7 +216,7 @@ static BOOL GetDiskUsbStatus(UINT32 diskID)
return (g_usbMode & (1u << diskID)) ? TRUE : FALSE; return (g_usbMode & (1u << diskID)) ? TRUE : FALSE;
} }
#endif #endif
//获取某个磁盘的描述符
los_disk *get_disk(INT32 id) los_disk *get_disk(INT32 id)
{ {
if ((id >= 0) && (id < SYS_MAX_DISK)) { if ((id >= 0) && (id < SYS_MAX_DISK)) {
...@@ -225,7 +225,7 @@ los_disk *get_disk(INT32 id) ...@@ -225,7 +225,7 @@ los_disk *get_disk(INT32 id)
return NULL; return NULL;
} }
//获取某个分区的描述符
los_part *get_part(INT32 id) los_part *get_part(INT32 id)
{ {
if ((id >= 0) && (id < SYS_MAX_PART)) { if ((id >= 0) && (id < SYS_MAX_PART)) {
...@@ -1279,40 +1279,46 @@ static VOID OsDiskInitSub(const CHAR *diskName, INT32 diskID, los_disk *disk, ...@@ -1279,40 +1279,46 @@ static VOID OsDiskInitSub(const CHAR *diskName, INT32 diskID, los_disk *disk,
disk->bcache = bc; disk->bcache = bc;
#endif #endif
(VOID)pthread_mutexattr_init(&attr); (VOID)pthread_mutexattr_init(&attr);//posix 互斥量属性初始化
attr.type = PTHREAD_MUTEX_RECURSIVE; attr.type = PTHREAD_MUTEX_RECURSIVE;//使用递归型互斥,鸿蒙内核为降低死锁概率 默认就是递归方式
(VOID)pthread_mutex_init(&disk->disk_mutex, &attr); (VOID)pthread_mutex_init(&disk->disk_mutex, &attr);//初始化磁盘的互斥量
DiskStructInit(diskName, diskID, diskInfo, blkDriver, disk); DiskStructInit(diskName, diskID, diskInfo, blkDriver, disk);//初始化磁盘描述符los_disk
} }
/***************************************************************
磁盘初始化 , diskName 必须是 /dev/***
当块设备注册到系统。它被文件系统用来执行文件系统处理。它可以处理struct inode
inode:索引节点对象,存放关于具体文件的一般信息,每个索引节点对象都有一个索引节点号
这个节点号唯一地标识文件系统中的文件
geometry block_operations: 见于../../../../../third_party/NuttX/include/nuttx/fs/fs.h
***************************************************************/
INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops, INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
VOID *priv, INT32 diskID, VOID *info) VOID *priv, INT32 diskID, VOID *info)
{ {
struct geometry diskInfo; struct geometry diskInfo; //此结构提供有关块驱动程序状态的信息
struct inode *blkDriver = NULL; struct inode *blkDriver = NULL;
los_disk *disk = get_disk(diskID); los_disk *disk = get_disk(diskID);
struct inode_search_s desc; struct inode_search_s desc;//见于 ../../../../../third_party/NuttX/fs/inode/inode.h
INT32 ret; INT32 ret;
if ((diskName == NULL) || (disk == NULL) || if ((diskName == NULL) || (disk == NULL) || //磁盘不能是未准备好状态
(disk->disk_status != STAT_UNREADY) || (strlen(diskName) > DISK_NAME)) { (disk->disk_status != STAT_UNREADY) || (strlen(diskName) > DISK_NAME)) {
return VFS_ERROR; return VFS_ERROR;
} }
//详见 \third_party\NuttX\fs\driver\fs_registerblockdriver.c
if (register_blockdriver(diskName, bops, RWE_RW_RW, priv) != 0) { if (register_blockdriver(diskName, bops, RWE_RW_RW, priv) != 0) {//1.在伪文件系统中注册块驱动程序,注册之后可以对其进行操作
PRINT_ERR("disk_init : register %s fail!\n", diskName); PRINT_ERR("disk_init : register %s fail!\n", diskName);
return VFS_ERROR; return VFS_ERROR;
} }
SETUP_SEARCH(&desc, diskName, false); SETUP_SEARCH(&desc, diskName, false);//是个赋值宏操作 desc.path = diskName;
ret = inode_find(&desc); ret = inode_find(&desc);//2.更新desc.node
if (ret < 0) { if (ret < 0) {
PRINT_ERR("disk_init : find %s fail!\n", diskName); PRINT_ERR("disk_init : find %s fail!\n", diskName);
ret = ENOENT; ret = ENOENT;
goto DISK_FIND_ERROR; goto DISK_FIND_ERROR;
} }
blkDriver = desc.node; blkDriver = desc.node;//
if ((blkDriver->u.i_bops == NULL) || (blkDriver->u.i_bops->geometry == NULL) || if ((blkDriver->u.i_bops == NULL) || (blkDriver->u.i_bops->geometry == NULL) ||
(blkDriver->u.i_bops->geometry(blkDriver, &diskInfo) != 0)) { (blkDriver->u.i_bops->geometry(blkDriver, &diskInfo) != 0)) {
...@@ -1324,7 +1330,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops, ...@@ -1324,7 +1330,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
PRINTK("disk_init : register %s ok!\n", diskName); PRINTK("disk_init : register %s ok!\n", diskName);
OsDiskInitSub(diskName, diskID, disk, &diskInfo, blkDriver); OsDiskInitSub(diskName, diskID, disk, &diskInfo, blkDriver);//3.初始化los_disk
inode_release(blkDriver); inode_release(blkDriver);
if (DiskDivideAndPartitionRegister(info, disk) != ENOERR) { if (DiskDivideAndPartitionRegister(info, disk) != ENOERR) {
...@@ -1347,7 +1353,7 @@ DISK_FIND_ERROR: ...@@ -1347,7 +1353,7 @@ DISK_FIND_ERROR:
(VOID)unregister_blockdriver(diskName); (VOID)unregister_blockdriver(diskName);
return VFS_ERROR; return VFS_ERROR;
} }
//磁盘去初始化,和los_disk_init成对出现,类似于 C++ 的构造<->析构函数
INT32 los_disk_deinit(INT32 diskID) INT32 los_disk_deinit(INT32 diskID)
{ {
los_disk *disk = get_disk(diskID); los_disk *disk = get_disk(diskID);
......
...@@ -126,7 +126,7 @@ int CheckProcessFd(int procFd) ...@@ -126,7 +126,7 @@ int CheckProcessFd(int procFd)
return OK; return OK;
} }
//分配一个系统文件描述符
int GetAssociatedSystemFd(int procFd) int GetAssociatedSystemFd(int procFd)
{ {
struct fd_table_s *fdt = GetFdTable(); struct fd_table_s *fdt = GetFdTable();
......
...@@ -60,7 +60,7 @@ extern "C" { ...@@ -60,7 +60,7 @@ extern "C" {
#ifdef LOSCFG_PLATFORM_HI3516DV300 #ifdef LOSCFG_PLATFORM_HI3516DV300
#define STORAGE_SIZE 0x3200000 #define STORAGE_SIZE 0x3200000
STATIC los_disk *g_emmcDisk = NULL; STATIC los_disk *g_emmcDisk = NULL;
#endif #endif
#ifndef LOSCFG_SECURITY_BOOT #ifndef LOSCFG_SECURITY_BOOT
...@@ -369,7 +369,7 @@ ERROUT: ...@@ -369,7 +369,7 @@ ERROUT:
#endif #endif
#ifdef LOSCFG_PLATFORM_HI3516DV300 #ifdef LOSCFG_PLATFORM_HI3516DV300
STATIC VOID OsMountUserdata(const CHAR *fsType) STATIC VOID OsMountUserdata(const CHAR *fsType)//mount emmc /userdata
{ {
INT32 ret; INT32 ret;
INT32 err; INT32 err;
...@@ -413,26 +413,26 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType) ...@@ -413,26 +413,26 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType)
{ {
INT32 ret; INT32 ret;
INT32 err; INT32 err;
if (strcmp(fsType, "vfat") == 0) { if (strcmp(fsType, "vfat") == 0) { //vfat 格式处理 VFAT (Virtual File Allocation Table) 虚拟文件分配表
ret = mount(rootDev, "/", fsType, MS_RDONLY, NULL); ret = mount(rootDev, "/", fsType, MS_RDONLY, NULL);// mount /
if (ret != LOS_OK) { if (ret != LOS_OK) {
err = get_errno(); err = get_errno();
PRINT_ERR("Failed to mount vfat rootfs, errno %d: %s\n", err, strerror(err)); PRINT_ERR("Failed to mount vfat rootfs, errno %d: %s\n", err, strerror(err));
return ret; return ret;
} }
g_root_inode->i_mode |= S_IRWXU | S_IRWXG | S_IRWXO; g_root_inode->i_mode |= S_IRWXU | S_IRWXG | S_IRWXO; // 777
#ifdef LOSCFG_PLATFORM_HI3516DV300 #ifdef LOSCFG_PLATFORM_HI3516DV300
ret = mkdir("/storage", VFAT_STORAGE_MOUNT_DIR_MODE); ret = mkdir("/storage", VFAT_STORAGE_MOUNT_DIR_MODE); //根目录下创建storage目录
if (ret != LOS_OK) { if (ret != LOS_OK) {
err = get_errno(); err = get_errno();
PRINT_ERR("Failed to reserve inode /storage, errno %d: %s\n", err, strerror(err)); PRINT_ERR("Failed to reserve inode /storage, errno %d: %s\n", err, strerror(err));
} else { } else {
CHAR emmcStorageDev[DISK_NAME] = {0}; CHAR emmcStorageDev[DISK_NAME] = {0};
if (snprintf_s(emmcStorageDev, sizeof(emmcStorageDev), sizeof(emmcStorageDev) - 1, if (snprintf_s(emmcStorageDev, sizeof(emmcStorageDev), sizeof(emmcStorageDev) - 1,
"%s%s", g_emmcDisk->disk_name, "p1") < 0) { "%s%s", g_emmcDisk->disk_name, "p1") < 0) {
PRINT_ERR("Failed to get emmc storage dev name!\n"); PRINT_ERR("Failed to get emmc storage dev name!\n");
} else { } else {
ret = mount(emmcStorageDev, "/storage", fsType, 0, "umask=000"); ret = mount(emmcStorageDev, "/storage", fsType, 0, "umask=000");//挂载storage目录
if (ret != LOS_OK) { if (ret != LOS_OK) {
err = get_errno(); err = get_errno();
PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err)); PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err));
...@@ -441,7 +441,7 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType) ...@@ -441,7 +441,7 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType)
} }
OsMountUserdata(fsType); OsMountUserdata(fsType);
#endif #endif
} else { } else { //非 vfat格式
ret = mount(rootDev, "/", fsType, MS_RDONLY, NULL); ret = mount(rootDev, "/", fsType, MS_RDONLY, NULL);
if (ret != LOS_OK) { if (ret != LOS_OK) {
err = get_errno(); err = get_errno();
...@@ -454,7 +454,7 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType) ...@@ -454,7 +454,7 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType)
err = get_errno(); err = get_errno();
PRINT_ERR("Failed to reserve inode /storage, errno %d: %s\n", err, strerror(err)); PRINT_ERR("Failed to reserve inode /storage, errno %d: %s\n", err, strerror(err));
} else { } else {
ret = mount(DEV_STORAGE_PATH, "/storage", fsType, 0, NULL); ret = mount(DEV_STORAGE_PATH, "/storage", fsType, 0, NULL);//挂载storage目录
if (ret != LOS_OK) { if (ret != LOS_OK) {
err = get_errno(); err = get_errno();
PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err)); PRINT_ERR("Failed to mount /storage, errno %d: %s\n", err, strerror(err));
...@@ -464,7 +464,11 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType) ...@@ -464,7 +464,11 @@ STATIC INT32 OsMountRootfsAndUserfs(const CHAR *rootDev, const CHAR *fsType)
} }
return LOS_OK; return LOS_OK;
} }
/******************************************************
挂载根文件系统 分两个阶段
1.文件系统提供一个作为初始安装点的空目录
2.内核在空目录上安装根文件系统
******************************************************/
INT32 OsMountRootfs(VOID) INT32 OsMountRootfs(VOID)
{ {
INT32 ret = LOS_OK; INT32 ret = LOS_OK;
...@@ -489,9 +493,9 @@ INT32 OsMountRootfs(VOID) ...@@ -489,9 +493,9 @@ INT32 OsMountRootfs(VOID)
rootSize = (rootSize >= 0) ? rootSize : ROOTFS_FLASH_SIZE; rootSize = (rootSize >= 0) ? rootSize : ROOTFS_FLASH_SIZE;
#endif #endif
rootDev = GetDevName(rootType, rootAddr, rootSize); rootDev = GetDevName(rootType, rootAddr, rootSize);//获取根设备 /dev/***
if (rootDev != NULL) { if (rootDev != NULL) {
ret = OsMountRootfsAndUserfs(rootDev, fsType); ret = OsMountRootfsAndUserfs(rootDev, fsType);//将根设备挂到 /下,
if (ret != LOS_OK) { if (ret != LOS_OK) {
err = get_errno(); err = get_errno();
PRINT_ERR("Failed to mount rootfs, errno %d: %s\n", err, strerror(err)); PRINT_ERR("Failed to mount rootfs, errno %d: %s\n", err, strerror(err));
......
...@@ -32,20 +32,20 @@ ...@@ -32,20 +32,20 @@
#ifndef _LOS_ROOTFS_H #ifndef _LOS_ROOTFS_H
#define _LOS_ROOTFS_H #define _LOS_ROOTFS_H
#define BYTES_PER_MBYTE 0x100000 #define BYTES_PER_MBYTE 0x100000 //1M = 1024 * 1024
#define BYTES_PER_KBYTE 0x400 #define BYTES_PER_KBYTE 0x400 //1K = 1024
#define COMMAND_LINE_ADDR 512 * BYTES_PER_KBYTE #define COMMAND_LINE_ADDR 512 * BYTES_PER_KBYTE
#define COMMAND_LINE_SIZE 1024 #define COMMAND_LINE_SIZE 1024
#ifdef LOSCFG_PLATFORM_HI3518EV300 #ifdef LOSCFG_PLATFORM_HI3518EV300
#define ROOTFS_ROOT_TYPE "flash" #define ROOTFS_ROOT_TYPE "flash" //根文件系统存放在哪种设备上,这里是flash
#define ROOTFS_FS_TYPE "jffs2" #define ROOTFS_FS_TYPE "jffs2" //3518 平台使用根文件系统的类型
#endif #endif
#ifdef LOSCFG_PLATFORM_HI3516DV300 #ifdef LOSCFG_PLATFORM_HI3516DV300
#define ROOTFS_ROOT_TYPE "emmc" #define ROOTFS_ROOT_TYPE "emmc" //eMMC=NAND闪存+闪存控制芯片+标准接口封装 https://blog.csdn.net/xjw1874/article/details/81505967
#define ROOTFS_FS_TYPE "vfat" #define ROOTFS_FS_TYPE "vfat" //3516 平台使用根文件系统的类型
#endif #endif
#ifdef LOSCFG_TEE_ENABLE #ifdef LOSCFG_TEE_ENABLE
...@@ -56,8 +56,8 @@ ...@@ -56,8 +56,8 @@
#define ROOTFS_FLASH_SIZE 0xa00000 #define ROOTFS_FLASH_SIZE 0xa00000
#endif #endif
#define FLASH_TYPE "spinor" #define FLASH_TYPE "spinor" //flash类型
#define FLASH_DEV_NAME "/dev/spinorblk0" #define FLASH_DEV_NAME "/dev/spinorblk0" //根文件系统路径
#define EMMC_SEC_SIZE 512 #define EMMC_SEC_SIZE 512
......
...@@ -259,7 +259,7 @@ static void *DupUserMem(const void *ptr, size_t len, int needCopy) ...@@ -259,7 +259,7 @@ static void *DupUserMem(const void *ptr, size_t len, int needCopy)
ptr##arr->arr = ptr##cpybak.arr; \ ptr##arr->arr = ptr##cpybak.arr; \
ptr##cpybak.arr = tmp; \ ptr##cpybak.arr = tmp; \
} }
//系统调用之socket
int SysSocket(int domain, int type, int protocol) int SysSocket(int domain, int type, int protocol)
{ {
int ret; int ret;
...@@ -272,7 +272,7 @@ int SysSocket(int domain, int type, int protocol) ...@@ -272,7 +272,7 @@ int SysSocket(int domain, int type, int protocol)
SOCKET_K2U(ret); SOCKET_K2U(ret);
return ret; return ret;
} }
//系统调用之绑定
int SysBind(int s, const struct sockaddr *name, socklen_t namelen) int SysBind(int s, const struct sockaddr *name, socklen_t namelen)
{ {
int ret; int ret;
......
git add -A git add -A
git commit -m '从ifconfig netstat 等常用网络命令的实现来理解lwip协议栈 git commit -m '对文件系统 磁盘,分区描述符的注释
搜索 @note_pic 可以查看全部字符图 搜索 @note_pic 可以查看全部字符图
搜索 @note_why 是注者尚未看明白的地方,如果您看明白了,请告诉注者完善 搜索 @note_why 是注者尚未看明白的地方,如果您看明白了,请告诉注者完善
搜索 @note_thinking 是注者的思考和吐槽的地方 搜索 @note_thinking 是注者的思考和吐槽的地方
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册