Linux文件系统omfs文件的读写

字体大小: 中小 标准 ->行高大小: 标准

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

相关阅读:

Linux文件系统omfs的目录创建和删除 http://www.linuxidc.com/Linux/2012-02/54025.htm 

Linux文件系统omfs的目录创建和删除 http://www.linuxidc.com/Linux/2012-02/54025.htm

Linux文件系统omfs的普通文件创建和删除 http://www.linuxidc.com/Linux/2012-02/54026.htm

#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.

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/57814.html