Giter Site home page Giter Site logo

fat_file_system's People

Contributors

wanyuzha avatar

Watchers

 avatar

fat_file_system's Issues

需求分析

操作系统代码本质上是函数,为了方便模块的验证,设置一个主入口函数调用这些函数来进行验证。后期如果添加GUI则需要循环调用这些函数。
以下开始讨论函数设计:

虚拟磁盘转储

虚拟一个文件缓冲区,一个文件缓冲区大小和一个扇区相同,都为512B。写入文件时,先写入文件缓冲区,写满一个就把这个扇区写入磁盘,如果没有写满就强制写入。读取时,按照一个扇区大小来取数据。

构建FAT文件系统

在构建FAT文件系统时,首先构造MBR扇区、DBR扇区,按照格式写在vdisk文件的开头

Linux编程规范

1.用Tab缩进
2.函数的左右括号单独一行,控制语句的左括号在同一行
3.在关键字“if,switch,case,for,do,while”之后需要加上空格;大多数的二元和三元运算符两边需要加空格,“= + - < > * / % | & ^ <= >= == != ? :”;
4.函数的代码程度不超过两屏,局部变量不超过10个。一个很大的函数尽量分成一些更短小的函数的组合,每个函数应该功能单一并且实现精准。如果担心函数调用带来开销,可以把小函数声明为inline。如果函数的名称是一种动作或者命令式的语句,应该以错误代码的形式返回(一般0表示成功,-Exxx形式的负数表示错误),如:do_something()。如果函数的名称是判断语句,则返回值应该类似于布尔值(1表示成功,0表示失败),如:something_is_exist()
5.注释使用C89风格/.../,描述代码要做什么和为什么这么做

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.