7 #define PRINTF(fmt,args...) printf (fmt ,##args)
9 #define PRINTF(fmt,args...)
12 extern void cmd_yaffs_mount(char *mp);
13 extern void cmd_yaffs_umount(char *mp);
14 extern void cmd_yaffs_read_file(char *fn);
15 extern void cmd_yaffs_write_file(char *fn,char bval,int sizeOfFile);
16 extern void cmd_yaffs_ls(const char *mountpt, int longlist);
17 extern void cmd_yaffs_mwrite_file(char *fn, char *addr, int size);
18 extern void cmd_yaffs_mread_file(char *fn, char *addr);
19 extern void cmd_yaffs_mkdir(const char *dir);
20 extern void cmd_yaffs_rmdir(const char *dir);
21 extern void cmd_yaffs_rm(const char *path);
22 extern void cmd_yaffs_mv(const char *oldPath, const char *newPath);
24 extern int yaffs_DumpDevStruct(const char *path);
27 int do_ymount (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
29 char *mtpoint = argv[1];
30 cmd_yaffs_mount(mtpoint);
35 int do_yumount (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
37 char *mtpoint = argv[1];
38 cmd_yaffs_umount(mtpoint);
43 int do_yls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
45 char *dirname = argv[argc-1];
47 cmd_yaffs_ls(dirname, (argc>2)?1:0);
52 int do_yrd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
54 char *filename = argv[1];
55 printf ("Reading file %s ", filename);
57 cmd_yaffs_read_file(filename);
63 int do_ywr (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
65 char *filename = argv[1];
66 ulong value = simple_strtoul(argv[2], NULL, 16);
67 ulong numValues = simple_strtoul(argv[3], NULL, 16);
69 printf ("Writing value (%lx) %lx times to %s... ", value, numValues, filename);
71 cmd_yaffs_write_file(filename,value,numValues);
77 int do_yrdm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
79 char *filename = argv[1];
80 ulong addr = simple_strtoul(argv[2], NULL, 16);
82 cmd_yaffs_mread_file(filename, (char *)addr);
87 int do_ywrm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
89 char *filename = argv[1];
90 ulong addr = simple_strtoul(argv[2], NULL, 16);
91 ulong size = simple_strtoul(argv[3], NULL, 16);
93 cmd_yaffs_mwrite_file(filename, (char *)addr, size);
98 int do_ymkdir (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
100 char *dirname = argv[1];
102 cmd_yaffs_mkdir(dirname);
107 int do_yrmdir (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
109 char *dirname = argv[1];
111 cmd_yaffs_rmdir(dirname);
116 int do_yrm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
118 char *path = argv[1];
125 int do_ymv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
127 char *oldPath = argv[1];
128 char *newPath = argv[2];
130 cmd_yaffs_mv(newPath, oldPath);
135 int do_ydump (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
137 char *dirname = argv[1];
138 if (yaffs_DumpDevStruct(dirname) != 0)
139 printf("yaffs_DumpDevStruct returning error when dumping path: , %s\n", dirname);
144 ymount, 3, 0, do_ymount,
150 yumount, 3, 0, do_yumount,
163 "read file from yaffs",
169 "write file to yaffs",
170 "filename value num_vlues"
175 "read file to memory from yaffs",
181 "write file from memory to yaffs",
182 "filename offset size"
186 ymkdir, 2, 0, do_ymkdir,
192 yrmdir, 2, 0, do_yrmdir,
210 ydump, 2, 0, do_ydump,
211 "YAFFS device struct",