Rewrite the linus formatting Program-general Linux technology-Linux programming and kernel information. The following is a detailed description. Yesterday I made a long time to format the minix file system. Finally, I suddenly remembered that linux had a Formatting Function! Then the brain is not normal, looking for a software to make it into a virtual floppy disk and then formatting, looking for a new and suddenly remembered that linux does not need a virtual floppy disk, because what the original device is a device, and a huge sweat!
The formatting is done. I used my reader program to test whether the system magic number is different. It seems that the version of the file system is a problem. I changed the program and asked him to continue reading it, there are some minor differences. The super block s_nzones (total number of logical blocks) is set to more than 20 thousand, and some do not understand it.
I accidentally discovered the linus formatting program and copied it to see if it could be used. There were a lot of problems. I changed the Eclipse CDT to something wrong, and no errors were reported or binary files were generated, there is no way to check it online. I found that many people did not solve this problem. Finally, I found the problem by myself, because the header files include overlapping files and some structure definition confusion. (I cannot tell the details, so I will define a structure from stat. h moved to fs. h, everything will be back to normal, amazing !)
Well, you can run the linus formatting program. It takes a lot of twists and turns out to be a bit rewarding.
PS: fwrite is not the number of bytes, but the number of records written. You can refer to the following description:
Size_t fwrite (const void * buffer, size_t size, size_t count, FILE * stream );
Fwrite returns the number of full items actually written, which may be less than count if an error occurs. Also, if an error occurs, the file-position indicator cannot be determined.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service