2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002-2018 Aleph One Ltd.
6 * Created by Timothy Manning <timothy@yaffs.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include "linux_test_write.h"
15 int linux_test_write(arg_temp *args_struct)
21 join_paths(linux_struct.root_path,args_struct->string1, path );
22 sprintf(message,"trying to write to: %s\nwith mode set to %o \n",path,args_struct->char1 );
23 print_message(3,message);
24 printf("mode S_IREAD %d S_IWRITE %d\n",(args_struct->char2 & S_IREAD),(args_struct->char2 & S_IWRITE));
25 handle=open(path,((args_struct->char1 &(O_TRUNC|O_EXCL|O_CREAT|O_APPEND))|O_RDWR),(args_struct->char2&(S_IREAD|S_IWRITE)));
26 printf("handle %d\n",handle);
28 print_message(3,"failed to open a handle\n");
29 return -1; //handle failed to open
31 sprintf(message,"trying to write: %d bytes into the file\n",strlen(args_struct->string2));
32 print_message(3,message);
33 output=write(handle,args_struct->string2,strlen(args_struct->string2));