Hi All
Below coding for generate a file. Do you know how to write a code for
random a a file for multi-user access ?
We want testing FileSystem IO performance.
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#define FAIL -1
#define BSIZE 8192
#define FSIZE 5000
int writeit(int);
int main(void)
{
if ( -1 == writeit(FSIZE)) printf("FILE OPERATION FAILED\n");
}
int writeit(int blocks)
{
char buf[BSIZE];
int fdes;
int i;
int written;
if ( (fdes = open("./testfile.bm",O_ WRONLY|O_CREAT, 0777)) < 0)
return FAIL;
for (i=0;i< blocks ; i++)
{
if (written = write(fdes,buf, BSIZE) != BSIZE) return FAIL;
}
return 0;
}
Below coding for generate a file. Do you know how to write a code for
random a a file for multi-user access ?
We want testing FileSystem IO performance.
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#define FAIL -1
#define BSIZE 8192
#define FSIZE 5000
int writeit(int);
int main(void)
{
if ( -1 == writeit(FSIZE)) printf("FILE OPERATION FAILED\n");
}
int writeit(int blocks)
{
char buf[BSIZE];
int fdes;
int i;
int written;
if ( (fdes = open("./testfile.bm",O_ WRONLY|O_CREAT, 0777)) < 0)
return FAIL;
for (i=0;i< blocks ; i++)
{
if (written = write(fdes,buf, BSIZE) != BSIZE) return FAIL;
}
return 0;
}
Comment