Linux文件系统omfs文件的读写


为了研究omfs文件系统是如何进行文件的write操作,我在应用层写了个小程序:

相关阅读:

Linux文件系统omfs的目录创建和删除  

Linux文件系统omfs的目录创建和删除

Linux文件系统omfs的普通文件创建和删除

#include <stdio.h>

#include <stdlib.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <unistd.h>

#include <fcntl.h>

#include <errno.h>

 

Void main()

{

         Int I;

         Char w[16384];

         Int fd;

         Int count;

         Fd = open(“/mnt/point1/cccc”,O_RDWR);

         Perror(“open”);

         For( I = 0; I < 16384; i++)

         {

                   W[i] = 0x99;

}

Lseek(fd,0,SEEK_END);

Count = write(fd,w,16384);

Perror(“program”);

Printf(“count: %d\n”, count);

 

}

 

这个程序的目的主要在于写入/mnt/point1/目录下的某个文件,而我们的omfs文件系统就挂载在该目录下。

 

目前该目录下的情况如下:

ls –ali

接下来我们对cccc这个文件写入16384个字节,每个字节都是0x99.

  • 1
  • 2
  • 3
  • 下一页

相关内容