学习ucore之后,又学了xinu的tcp/ip协议,
断断续续的,将两个程序整合到一起了,是学习操作系统和网络协议的总结。
环境: linux + qemu
make qemu-nox
tcp测试 ./tcpechod.sh
udp测试 ./udpcheod.sh
学习ucore之后,又学了xinu的tcp/ip协议,
断断续续的,将两个程序整合到一起了,是学习操作系统和网络协议的总结。
环境: linux + qemu
make qemu-nox
tcp测试 ./tcpechod.sh
udp测试 ./udpcheod.sh
static void
add_entry(struct sfs_fs *sfs, struct cache_inode *current, struct cache_inode *file, const char *name) {
//sfs_disk_entry
static struct sfs_entry __entry, *entry = &__entry;
//current必须是目录类型的inode
assert(current->inode.type == SFS_TYPE_DIR && strlen(name) <= SFS_MAX_FNAME_LEN);
//设置block number id和文件名称
entry->ino = file->ino, strcpy(entry->name, name);
// 下一个 block ino
uint32_t entry_ino = sfs_alloc_ino(sfs);
// 都是从 entry_no * blocksize开始写,这个意思是 一个entry占有一个disk block 了
// data , len=256 , block number id
write_block(sfs, entry, sizeof(entry->name), entry_ino);
// printf("entry->name: %s entry_ino: %d len:%d \n", entry->name, entry_ino ,sizeof(entry->name));
// 在sfs->blocks中添加一个cache_block和相应的ino
// 就是将entry_ino 记录到current->inode->direct 或则 current->inode->indirect 或者 current->inode->db_indirect
//current->inode->direct[current->nblks] = entry_ino
// 给目录 current 添加一个表示 文件或者目录的sfs_entry数据
append_block_slot(sfs, current, entry_ino, name);
//append_block(sfs, current, sizeof(entry->name), entry_ino, name);
file->inode.nlinks ++;
}
write_block(sfs, entry, sizeof(entry->name), entry_ino);
这里为什么是sizeof(entry->name),而不是sizeof(sfs_entry)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.