Giter Club home page Giter Club logo

ucore_networking's Introduction

学习ucore之后,又学了xinu的tcp/ip协议,

断断续续的,将两个程序整合到一起了,是学习操作系统和网络协议的总结。

环境: linux + qemu

make qemu-nox

tcp测试 ./tcpechod.sh

udp测试 ./udpcheod.sh

ucore_networking's People

Contributors

0x88888888 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ucore_networking's Issues

mksfs.c add_entry问题

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.