@@ -246,7 +246,11 @@ static int do_mkpfs(context_t *ctx, int argc, char *argv[])
246246static int do_mkpart (context_t * ctx , int arg , char * argv [])
247247{
248248
249- static char * sizesString [9 ] = {
249+ static char * sizesString [13 ] = {
250+ "8M" ,
251+ "16M" ,
252+ "32M" ,
253+ "64M" ,
250254 "128M" ,
251255 "256M" ,
252256 "512M" ,
@@ -255,9 +259,14 @@ static int do_mkpart(context_t *ctx, int arg, char *argv[])
255259 "4G" ,
256260 "8G" ,
257261 "16G" ,
258- "32G" };
262+ "32G" ,
263+ };
259264
260- static unsigned int sizesMB [9 ] = {
265+ static unsigned int sizesMB [13 ] = {
266+ 8 ,
267+ 16 ,
268+ 32 ,
269+ 64 ,
261270 128 ,
262271 256 ,
263272 512 ,
@@ -266,7 +275,8 @@ static int do_mkpart(context_t *ctx, int arg, char *argv[])
266275 4096 ,
267276 8192 ,
268277 16384 ,
269- 32768 };
278+ 32768 ,
279+ };
270280
271281 static char * fsType [7 ] = {
272282 "MBR" ,
@@ -275,7 +285,8 @@ static int do_mkpart(context_t *ctx, int arg, char *argv[])
275285 "REISER" ,
276286 "PFS" ,
277287 "CFS" ,
278- "HDL" };
288+ "HDL" ,
289+ };
279290
280291 unsigned int size_in_mb = 0 ;
281292
@@ -580,11 +591,16 @@ static int do_rm(context_t *ctx, int argc, char *argv[])
580591static int do_rename (context_t * ctx , int argc , char * argv [])
581592{
582593 char tmp [256 ];
583- strcpy (tmp , "pfs0:" );
584- strcat (tmp , ctx -> path );
585- if (tmp [strlen (tmp ) - 1 ] != '/' )
586- strcat (tmp , "/" );
594+ if (!ctx -> mount )
595+ strcpy (tmp , "hdd0:" );
596+ else {
597+ strcpy (tmp , "pfs0:" );
598+ strcat (tmp , ctx -> path );
599+ if (tmp [strlen (tmp ) - 1 ] != '/' )
600+ strcat (tmp , "/" );
601+ }
587602 strcat (tmp , argv [1 ]);
603+ tmp [sizeof (tmp ) - 1 ] = '\0' ; // Ensure null-termination
588604 int result = iomanX_rename (tmp , argv [2 ]);
589605 if (result < 0 )
590606 fprintf (stderr , "(!) %s: %s.\n" , tmp , strerror (- result ));
@@ -615,7 +631,8 @@ static int do_help(context_t *ctx, int argc, char *argv[])
615631 "\tOnly fs type PFS will format partition, other partitions should be formatted by another utilities;\n"
616632 "mount <part_name> - mount a partition;\n"
617633 "umount - un-mount a partition;\n"
618- "ls [-l] - no mount: list partitions; mount: list files/dirs;\n"
634+ "ls [-l] - no mount: list partitions; mount: list files/dirs; -l: verbose list;\n"
635+ "rename <curr_name> <new_name> - no mount: rename partition; mount: rename a file/dir.\n"
619636 "mkdir <dir_name> - create a new directory;\n"
620637 "rmdir <dir_name> - delete an existing directory;\n"
621638 "pwd - print current PS2 HDD directory;\n"
@@ -663,7 +680,7 @@ static int exec(void *data, int argc, char *argv[])
663680 {"put" , 1 , need_device + need_mount , & do_put },
664681 {"rm" , 1 , need_device + need_mount , & do_rm },
665682 {"rmpart" , 1 , need_device , & do_rmpart },
666- {"rename" , 2 , need_device + need_mount , & do_rename },
683+ {"rename" , 2 , need_device , & do_rename },
667684 {"help" , 0 , no_req , & do_help },
668685 };
669686 static const size_t CMD_COUNT = sizeof (CMD ) / sizeof (CMD [0 ]);
0 commit comments