您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ yaffs_open函数代码示例

51自学网 2021-06-03 11:54:05
  C++
这篇教程C++ yaffs_open函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中yaffs_open函数的典型用法代码示例。如果您正苦于以下问题:C++ yaffs_open函数的具体用法?C++ yaffs_open怎么用?C++ yaffs_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了yaffs_open函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: rename_over_test

void rename_over_test(const char *mountpt){	int i;	char a[100];	char b[100];	char c[100];		sprintf(a,"%s/a",mountpt);	sprintf(b,"%s/b",mountpt);	sprintf(c,"%s/c",mountpt);		yaffs_StartUp();		yaffs_mount(mountpt);		printf("Existing files/n");	dumpDirFollow(mountpt);				i = yaffs_open(c,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);	printf("File c handle is %d/n",i);	yaffs_close(i);	i = yaffs_open(a,O_CREAT | O_TRUNC | O_RDWR,  S_IREAD | S_IWRITE); 	yaffs_close(i);	i = yaffs_open(b,O_CREAT | O_TRUNC | O_RDWR,  S_IREAD | S_IWRITE);	yaffs_close(i);	yaffs_rename(a,b); // rename over	yaffs_rename(b,a); // rename back again (not renaimng over)	yaffs_rename(a,b); // rename back again (not renaimng over)			yaffs_unmount(mountpt);	}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:35,


示例2: overwrite_test

int overwrite_test(const char *path){   char aname[100];   char bname[100];   int i;   int j;      int a;   int b;   yaffs_StartUp();      yaffs_mount(path);      sprintf(aname,"%s%s",path,"/a");   sprintf(bname,"%s%s",path,"/b");      b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);   for(j= 0; j < 500; j++){   	yaffs_write(b,bname,100);	a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);   	for(i = 0; i < rand() % 20000; i++)   		yaffs_write(a,&a,sizeof(a));	yaffs_close(a);   }      return 0;   }
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:27,


示例3: test_yaffs_fsync_EROFS

int test_yaffs_fsync_EROFS(void){	int output = 0;	int error_code = 0;	if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){		print_message("failed to create file/n",1);		return -1;	}	EROFS_setup();	handle = yaffs_open(FILE_PATH,O_CREAT  ,S_IREAD  );	if (handle<0){		print_message("failed to open file/n",2);		return -1;	}	output = yaffs_fsync(handle);	if (output==-1){		error_code=yaffs_get_error();		if (abs(error_code)==EROFS){			return 1;		} else {			print_message("different error than expected/n",2);			return -1;		}	} else {		print_message("file synced with EROFS set.(which is a bad thing)/n",2);		return -1;	}}
开发者ID:cargabsj175,项目名称:yaffs2,代码行数:29,


示例4: cache_read_test

int cache_read_test(void){	int a,b,c;	int i;	int sizeOfFiles = 500000;	char buffer[100];		yaffs_StartUp();		yaffs_mount("/boot");		make_a_file("/boot/a",'a',sizeOfFiles);	make_a_file("/boot/b",'b',sizeOfFiles);	a = yaffs_open("/boot/a",O_RDONLY,0);	b = yaffs_open("/boot/b",O_RDONLY,0);	c = yaffs_open("/boot/c", O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);	do{		i = sizeOfFiles;		if (i > 100) i = 100;		sizeOfFiles  -= i;		yaffs_read(a,buffer,i);		yaffs_read(b,buffer,i);		yaffs_write(c,buffer,i);	} while(sizeOfFiles > 0);				return 1;	}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:32,


示例5: File_Init

void File_Init(void){		int f1, f2;			yaffs_mount("/nand");											//挂载    		f1 = yaffs_open("nand/first_start", O_RDONLY, 0 );	  if ( f1 >= 0 )    //不是第一次启动文件系统 		{				printf("first_start open success!/n");				File_TpConfig_Exist();				//File_SubstationConfig_Exist();				//File_Data_Exist();		}		else              //第一次启动文件系统 	  {			  yaffs_unmount("/nand");				yaffs_format("/nand", 0, 0, 0);           //格式化				yaffs_mount("/nand");											//挂载				yaffs_mkdir("/nand/config", 0666);				//创建配置文件目录				yaffs_mkdir("/nand/data", 0666);					//创建上传数据目录								f1 = yaffs_open( "/nand/first_start",  O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE  );				if ( f1 >= 0 )				{						printf("first_start create success!/n");				}/*							f2 = yaffs_open( "/nand/config/TestpointConfig",  O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE  );							if ( f2 >= 0 )				{						printf("Testpoint Config Create Success!/n");						yaffs_close(f2);				}								f2 = yaffs_open( "/nand/config/SubstationConfig",  O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE  );							if ( f2 >= 0 )				{						printf("Substation Config Create Success!/n");						yaffs_close(f2);				}								f2 = yaffs_open( "/nand/data/SensorData",  O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE  );							if ( f2 >= 0 )				{						printf("SensorData Create Success!/n");						yaffs_close(f2);				}				*/		}				yaffs_close(f1);						return;}
开发者ID:Liu1992,项目名称:GasSub_LPC1788,代码行数:55,


示例6: small_overwrite_test

void small_overwrite_test(const char *mountpt,int nmounts){	char a[30];	int i;	int j;	int h0;	int h1;		sprintf(a,"%s/a",mountpt);	yaffs_StartUp();				for(i = 0; i < nmounts; i++){				static char xx[8000];				printf("############### Iteration %d   Start/n",i);		if(1)			yaffs_mount(mountpt);		dump_directory_tree(mountpt);				yaffs_mkdir(a,0);				sprintf(xx,"%s/0",a);		h0 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);		sprintf(xx,"%s/1",a);		h1 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);				for(j = 0; j < 1000000; j+=1000){			yaffs_ftruncate(h0,j);			yaffs_lseek(h0,j,SEEK_SET);			yaffs_write(h0,xx,7000);			yaffs_write(h1,xx,7000);						if(early_exit)				exit(0);		}				yaffs_close(h0);				printf("########### %d/n",i);		dump_directory_tree(mountpt);		if(1)			yaffs_unmount(mountpt);	}}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:53,


示例7: UpdateCounter

static void UpdateCounter(const char *name, unsigned *val,  int initialise){  int inh=-1;  int outh=-1;  unsigned x[2];  int nread = 0;  int nwritten = 0;    x[0] = x[1] = 0;    if(initialise){    x[0] = 0;     x[1] = 1;  } else {    inh = yaffs_open(name,O_RDONLY, S_IREAD | S_IWRITE);    if(inh >= 0){      nread = yaffs_read(inh,x,sizeof(x));      yaffs_close(inh);    }    if(nread != sizeof(x) ||       x[0] + 1 != x[1]){      printf("Error reading counter %s handle %d, x[0] %u x[1] %u last error %d/n",              name, inh, x[0], x[1],yaffsfs_GetLastError());      FatalError();                  }    x[0]++;    x[1]++;  }    outh = yaffs_open(fullTempCounterName, O_RDWR | O_TRUNC | O_CREAT, S_IREAD | S_IWRITE);  if(outh >= 0){    nwritten = yaffs_write(outh,x,sizeof(x));    yaffs_close(outh);    yaffs_rename(fullTempCounterName,name);  }    if(nwritten != sizeof(x)){      printf("Error writing counter %s handle %d, x[0] %u x[1] %u/n",              name, inh, x[0], x[1]);      FatalError();  }    *val = x[0];    printf("##/n"         "## Set counter %s to %u/n"         "##/n", name,x[0]);}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:50,


示例8: leave_unlinked_file

void leave_unlinked_file(const char *path,int maxIterations,int siz){	int i;	char str[50];	int h;		i = 0;		do{		sprintf(str,"%s/%d",path,i);		printf("create %s/n",str);		h = yaffs_open(str, O_CREAT | O_TRUNC | O_RDWR,S_IREAD | S_IWRITE);		if(h >= 0)		{			yaffs_unlink(str);		}		i++;	} while(h < 0 && i < maxIterations);		if(h >= 0)	{		for(i = 0; i < siz; i++)		{			yaffs_write(h,str,1);		}	}		printf("Leaving file %s open/n",str);}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:30,


示例9: fill_disk

void fill_disk(const char *path,int nfiles){	int h;	int n;	int result;	int f;        static char xx[600];		char str[50];		for(n = 0; n < nfiles; n++)	{		sprintf(str,"%s/%d",path,n);				h = yaffs_open(str, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);				printf("writing file %s handle %d ",str, h);				while ((result = yaffs_write(h,xx,600)) == 600)		{			f = yaffs_freespace(path);		}		result = yaffs_close(h);		printf(" close %d/n",result);	}}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:26,


示例10: yaffs_device_flush_test

void yaffs_device_flush_test(const char *path){	char fn[100];	int h;	int i;		yaffs_StartUp();			yaffs_mount(path);		do_some_file_stuff(path);		// Open and add some data to a few files	for(i = 0; i < 10; i++) {			sprintf(fn,"%s/ff%d",path,i);		h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IWRITE | S_IREAD);		yaffs_write(h,xxzz,2000);		yaffs_write(h,xxzz,2000);	}	yaffs_unmount(path);		yaffs_mount(path);}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:25,


示例11: create_resized_file_of_size

void create_resized_file_of_size(const char *fn,int syze1,int reSyze, int syze2){	int h;		int iterations;		h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);			iterations = (syze1 + strlen(fn) -1)/ strlen(fn);	while (iterations > 0)	{		yaffs_write(h,fn,strlen(fn));		iterations--;	}		yaffs_ftruncate(h,reSyze);		yaffs_lseek(h,0,SEEK_SET);	iterations = (syze2 + strlen(fn) -1)/ strlen(fn);	while (iterations > 0)	{		yaffs_write(h,fn,strlen(fn));		iterations--;	}		yaffs_close (h);}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:27,


示例12: test_yaffs_open_EACCES

int test_yaffs_open_EACCES(void){	int error_code=0;	int output =-1;	if (yaffs_access(FILE_PATH,0)!=0){		output=yaffs_close(test_yaffs_open());		if (output<0){			print_message("failed to open file/n",2);			return -1;		}	}	output=yaffs_chmod(FILE_PATH,S_IREAD);	if (output<0){		print_message("failed to chmod file/n",2);		return -1;	}	handle=yaffs_open(FILE_PATH, O_TRUNC| O_RDWR,FILE_MODE );	if (handle <0){		error_code=yaffs_get_error();		if (abs(error_code)==EACCES){			return 1;		}		else {			print_message("different error than expected/n",2);			return -1;		}	}	else {		print_message("file opened with read and write permissions, chmoded to read only.(which is a bad thing)/n",2);		return -1;	}}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:33,


示例13: verify_200k_file

void verify_200k_file(const char *fn){   int h1;   int i;   char x[11];   const char *s="0123456789";   int errCount = 0;      h1 = yaffs_open(fn, O_RDONLY, 0);      for(i = 0; i < 200000 && errCount < 10; i+= 10)   {   	yaffs_read(h1,x,10);	if(strncmp(x,s,10) != 0)	{		printf("File %s verification failed at %d/n",fn,i);		errCount++;	}   }   if(errCount >= 10)   	printf("Too many errors... aborted/n");         yaffs_close(h1);	   	}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:25,


示例14: write_200k_file

void write_200k_file(const char *fn, const char *fdel, const char *fdel1){   int h1;   int i;   int offs;      h1 = yaffs_open(fn, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);      for(i = 0; i < 100000; i+= 10000)   {   	write_10k(h1);   }      offs = yaffs_lseek(h1,0,SEEK_CUR);   if( offs != 100000)   {   	printf("Could not write file/n");   }      yaffs_unlink(fdel);   for(i = 0; i < 100000; i+= 10000)   {   	write_10k(h1);   }      offs = yaffs_lseek(h1,0,SEEK_CUR);   if( offs != 200000)   {   	printf("Could not write file/n");   }      yaffs_close(h1);   yaffs_unlink(fdel1);   }
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:35,


示例15: cat

/*============================================================================== * - cat() * * - print a file context */int cat(int argc, char *argv[]){    int fd;    int read_byte;    char file_context[1024];    char path_name[PATH_LEN_MAX];    CHECK_ARG_NUM(2, "please type file name");    _make_abs_path(path_name, argv[1]);    /*     * open file     */    fd = yaffs_open(path_name, O_RDONLY, 0);    if ( fd ==  -1) {        serial_printf("cannot open file '%s'", path_name);        return CMD_ERROR;    }    /*     * read and print file context     */    read_byte = yaffs_read(fd, file_context, 1023);    while (read_byte > 0) {        file_context[read_byte] = '/0';        serial_printf(file_context);        read_byte = yaffs_read(fd, file_context, 1023);    }    yaffs_close(fd);    return CMD_OK;}
开发者ID:WangDongfang,项目名称:DfewOS,代码行数:39,


示例16: test_yaffs_rename_full_dir_over_dir

int  test_yaffs_rename_full_dir_over_dir(void){	int output=0;	int error_code =0;	if (yaffs_mkdir(DIR_PATH,O_CREAT | O_RDWR)==-1){		print_message("failed to create dir/n",1);		return -1;	}	if (yaffs_mkdir(DIR_PATH2,O_CREAT | O_RDWR)==-1){		print_message("failed to create dir2/n",1);		return -1;	}	if (yaffs_close(yaffs_open(DIR_PATH2_FILE,O_CREAT | O_RDWR, FILE_MODE))==-1){		print_message("failed to create file/n",1);		return -1;	}	output = yaffs_rename( DIR_PATH2,DIR_PATH );	if (output<0){ 		print_message("could not rename a directory over a empty directory (which is a bad thing)/n",2);		return -1;	} 			return 1;}
开发者ID:cargabsj175,项目名称:yaffs2,代码行数:27,


示例17: dump_file_data

int dump_file_data(char *fn){	int h;	int i = 0;	int ok = 1;	unsigned char b;		h = yaffs_open(fn, O_RDWR,0);					printf("%s/n",fn);	while(yaffs_read(h,&b,1)> 0)	{		printf("%02x",b);		i++;		if(i > 32) 		{		   printf("/n");		   i = 0;;		 }	}	printf("/n");	yaffs_close(h);	return ok;}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:25,


示例18: test_yaffs_rename_ENOTEMPTY

int  test_yaffs_rename_ENOTEMPTY(void){	int output=0;	int error_code =0;	if (yaffs_mkdir(DIR_PATH,O_CREAT | O_RDWR)==-1){		print_message("failed to create dir/n",1);		return -1;	}	if (yaffs_mkdir(DIR_PATH2,O_CREAT | O_RDWR)==-1){		print_message("failed to create dir2/n",1);		return -1;	}	if (yaffs_close(yaffs_open(DIR_PATH2_FILE,O_CREAT | O_RDWR, FILE_MODE))==-1){		print_message("failed to create file/n",1);		return -1;	}	output = yaffs_rename( DIR_PATH,DIR_PATH2 );	if (output<0){ 		error_code=yaffs_get_error();		if (abs(error_code)==ENOTEMPTY){			return 1;		} else {			print_message("different error than expected/n",2);			return -1;		}		print_message("could not rename a directory over a nonempty directory (which is a bad thing)/n",2);		return -1;	} 			return 1;}
开发者ID:cargabsj175,项目名称:yaffs2,代码行数:34,


示例19: read_a_file

void read_a_file(char *fn){	int h;	int i = 0;	unsigned char b;	h = yaffs_open(fn, O_RDWR,0);	if(h<0)	{		printf("File not found/n");		return;	}	while(yaffs_read(h,&b,1)> 0)	{		printf("%02x ",b);		i++;		if(i > 32)		{		   printf("/n");		   i = 0;;		 }	}	printf("/n");	yaffs_close(h);}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:26,


示例20: test_yaffs_ftruncate_EROFS

int test_yaffs_ftruncate_EROFS(void){	int output = 0;	int error_code = 0;	handle = yaffs_open(FILE_PATH,O_CREAT | O_RDWR  , S_IREAD | S_IWRITE );	if (handle<0){		print_message("failed to open file/n",2);		return -1;	}	EROFS_setup();	output = yaffs_ftruncate(handle,FILE_SIZE_TRUNCATED );	if (output < 0){		error_code=yaffs_get_error();		//printf("EISDIR def %d, Error code %d/n", EISDIR,error_code);		if (abs(error_code) == EROFS){			return 1;		} else {			print_message("different error than expected/n", 2);			return -1;		}	} else {		print_message("file truncated with EROFS set.(which is a bad thing)/n", 2);		return -1;	}}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:25,


示例21: test_yaffs_chmod_EROFS

int test_yaffs_chmod_EROFS(void){	int error=0;	int output;	if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){		print_message("failed to create file/n",1);		return -1;	}	EROFS_setup();	output = yaffs_chmod(FILE_PATH,S_IREAD|S_IWRITE);	if (output<0){		error=yaffs_get_error();		if (abs(error)==EROFS){			return 1;		} else {			print_message("different error than expected/n",2);			return -1;		}	} else {		print_message("chmoded with EROFS setup (which is a bad thing)/n",2);		return -1;	}}
开发者ID:cargabsj175,项目名称:yaffs2,代码行数:26,


示例22: check_pattern_file

int check_pattern_file(char *fn){	int h;	int marker;	int i;	int size;	int ok = 1;		h = yaffs_open(fn, O_RDWR,0);	size = yaffs_lseek(h,0,SEEK_END);			for(i = 0; i < size; i+=256)	{		yaffs_lseek(h,i,SEEK_SET);		yaffs_read(h,&marker,sizeof(marker));		ok = (marker == ~i);		if(!ok)		{		   printf("pattern check failed on file %s, size %d at position %d. Got %x instead of %x/n",					fn,size,i,marker,~i);		}	}	yaffs_close(h);	return ok;}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:25,


示例23: fill_empty_files_test

void fill_empty_files_test(const char *mountpt){	int i;	yaffs_StartUp();	char name[100];	int result = 0;		int d,f;	for(i = 0; i < 5; i++)	{		yaffs_mount(mountpt);		for(d = 0; result >= 0 && d < 1000; d++){			sprintf(name,"%s/%d",mountpt,d);			result= yaffs_mkdir(name,0);			printf("creating directory %s result %d/n",name,result);						for(f = 0; result >= 0 && f < 100; f++){				sprintf(name,"%s/%d/%d",mountpt,d,f);				result= yaffs_open(name,O_CREAT, 0);				yaffs_close(result);				printf("creating file %s result %d/n",name,result);			}		}		yaffs_unmount(mountpt);	}	}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:28,


示例24: handle_test

void handle_test(const char *mountpt){	int i;	int h;	int cycle;	char a[100];	sprintf(a,"%s/aaa",mountpt);		yaffs_StartUp();		yaffs_mount(mountpt);        for(cycle = 0; cycle < 5; cycle++){        printf("Start cycle %d/n",cycle); 	i = 0;	do {        h = yaffs_open(a, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);	printf("%d  handle %d/n",i,h);	i++;	} while(h >= 0);		while(i >= -1) {	 yaffs_close(i);	 i--;        }        }		yaffs_unmount(mountpt);}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:30,


示例25: verify_file_of_size

void verify_file_of_size(const char *fn,int syze){	int h;	int result;		char xx[200];	char yy[200];	int l;		int iterations = (syze + strlen(fn) -1)/ strlen(fn);		h = yaffs_open(fn, O_RDONLY, S_IREAD | S_IWRITE);			while (iterations > 0)	{		sprintf(xx,"%s %8d",fn,iterations);		l = strlen(xx);				result = yaffs_read(h,yy,l);		yy[l] = 0;				if(strcmp(xx,yy)){			printf("=====>>>>> verification of file %s failed near position %lld/n",fn,(long long)yaffs_lseek(h,0,SEEK_CUR));		}		iterations--;	}	yaffs_close (h);}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:28,


示例26: test_yaffs_rmdir_ENOTDIR

int test_yaffs_rmdir_ENOTDIR(void){	int output=0;	int error_code =0;	if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){		print_message("failed to create file/n",1);		return -1;	}	if (0 !=  yaffs_access(DIR_PATH,0)) {		output = yaffs_mkdir(DIR_PATH,S_IWRITE | S_IREAD);		if (output < 0) {			print_message("failed to create directory/n",2);			return -1;		}	}	output = yaffs_rmdir("/yaffs2/test_dir/foo/dir/");	if (output<0){ 		error_code=yaffs_get_error();		if (abs(error_code)==ENOTDIR){			return 1;		} else {			print_message("returned error does not match the the expected error/n",2);			return -1;		}	} else{		print_message("removed /yaffs2/ directory (which is a bad thing)/n",2);		return -1;	}	}
开发者ID:cargabsj175,项目名称:yaffs2,代码行数:29,


示例27: test_yaffs_open_ENAMETOOLONG

int test_yaffs_open_ENAMETOOLONG(void){	int output = 0;	int x = 0;	int error_code = 0;	int file_name_length = 1000000;	char file_name[file_name_length];	strcat(file_name,YAFFS_MOUNT_POINT);	for (x = strlen(YAFFS_MOUNT_POINT); x<file_name_length -1; x++){		file_name[x] = 'a';	}	file_name[file_name_length-2]='/0';	handle = yaffs_open(file_name, O_CREAT | O_TRUNC| O_RDWR ,FILE_MODE );	if (handle == -1){		error_code = yaffs_get_error();		if (abs(error_code) == ENAMETOOLONG){			return 1;		} else {			print_message("different error than expected/n",2);			return -1;		}	} else {		//printf("handle %d /n",handle);		print_message("non existant file opened.(which is a bad thing)/n", 2);		return -1;	}}
开发者ID:Blackrose,项目名称:yaffs2,代码行数:30,


示例28: make_a_file

void make_a_file(char *yaffsName, char bval, int sizeOfFile){	int outh;	int i;	unsigned char buffer[100];	outh = yaffs_open(yaffsName,				O_CREAT | O_RDWR | O_TRUNC,				S_IREAD | S_IWRITE);	if (outh < 0) {		printf("Error opening file: %d. %s/n", outh, yaffs_error_str());		return;	}	memset(buffer, bval, 100);	do {		i = sizeOfFile;		if (i > 100)			i = 100;		sizeOfFile -= i;		yaffs_write(outh, buffer, i);	} while (sizeOfFile > 0);	yaffs_close(outh);}
开发者ID:0s4l,项目名称:u-boot-xlnx,代码行数:29,


示例29: cp

/*============================================================================== * - cp() * * - copy a file form here to there */int cp(int argc, char *argv[]){    int fd_in, fd_out;    int read_byte, write_byte;    char file_context[1024];    char old_path_name[PATH_LEN_MAX];    char new_path_name[PATH_LEN_MAX];    CHECK_ARG_NUM(3, "too few argument");    _make_abs_path(old_path_name, argv[1]);    fd_in = yaffs_open(old_path_name, O_RDONLY, 0);    CHECK_YAFFS_RETVAL(fd_in, "can't open file '%s'%s/n", old_path_name, "");    _make_abs_path(new_path_name, argv[2]);    fd_out = yaffs_open(new_path_name, O_CREAT|O_RDWR|O_TRUNC, S_IREAD|S_IWRITE);    if (fd_out == -1) {        yaffs_close(fd_in);        serial_printf("can't create file '%s'", new_path_name);        return CMD_ERROR;    }    /*     * read from fd_in and write to fd_out     */    read_byte = yaffs_read(fd_in, file_context, 1024);    while (read_byte > 0) {        write_byte = yaffs_write(fd_out, file_context, read_byte);        if (write_byte != read_byte) {            serial_printf("copy file failed!");            break;        }        read_byte = yaffs_read(fd_in, file_context, 1024);    }    yaffs_close(fd_in);    yaffs_close(fd_out);    if (read_byte > 0) {        return CMD_ERROR;    } else {        return CMD_OK;    }}
开发者ID:WangDongfang,项目名称:DfewOS,代码行数:51,


示例30: V5M_SaveImageFile

void V5M_SaveImageFile(char *str, char *buf, UINT32 len){	int h;	yaffs_unlink(str);	h = yaffs_open(str,  O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);	yaffs_write(h, buf, (unsigned int)len);	yaffs_close(h);}
开发者ID:stormbay,项目名称:DragonVer1.0,代码行数:9,



注:本文中的yaffs_open函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ yaffs_trace函数代码示例
C++ yaffs_dev_to_mtd函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。