1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
4 *
5 * Inspired by cmd_ext_common.c, cmd_fat.c.
6 */
7
8 #include <command.h>
9 #include <fs.h>
10
do_size_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])11 static int do_size_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
12 char *const argv[])
13 {
14 return do_size(cmdtp, flag, argc, argv, FS_TYPE_ANY);
15 }
16
17 U_BOOT_CMD(
18 size, 4, 0, do_size_wrapper,
19 "determine a file's size",
20 "<interface> <dev[:part]> <filename>\n"
21 " - Find file 'filename' from 'dev' on 'interface'\n"
22 " determine its size, and store in the 'filesize' variable."
23 );
24
do_load_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])25 static int do_load_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
26 char *const argv[])
27 {
28 return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
29 }
30
31 U_BOOT_CMD(
32 load, 7, 0, do_load_wrapper,
33 "load binary file from a filesystem",
34 "<interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]\n"
35 " - Load binary file 'filename' from partition 'part' on device\n"
36 " type 'interface' instance 'dev' to address 'addr' in memory.\n"
37 " 'bytes' gives the size to load in bytes.\n"
38 " If 'bytes' is 0 or omitted, the file is read until the end.\n"
39 " 'pos' gives the file byte position to start reading from.\n"
40 " If 'pos' is 0 or omitted, the file is read from the start."
41 );
42
do_save_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])43 static int do_save_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
44 char *const argv[])
45 {
46 return do_save(cmdtp, flag, argc, argv, FS_TYPE_ANY);
47 }
48
49 U_BOOT_CMD(
50 save, 7, 0, do_save_wrapper,
51 "save file to a filesystem",
52 "<interface> <dev[:part]> <addr> <filename> bytes [pos]\n"
53 " - Save binary file 'filename' to partition 'part' on device\n"
54 " type 'interface' instance 'dev' from addr 'addr' in memory.\n"
55 " 'bytes' gives the size to save in bytes and is mandatory.\n"
56 " 'pos' gives the file byte position to start writing to.\n"
57 " If 'pos' is 0 or omitted, the file is written from the start."
58 );
59
do_ls_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])60 static int do_ls_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
61 char *const argv[])
62 {
63 return do_ls(cmdtp, flag, argc, argv, FS_TYPE_ANY);
64 }
65
66 U_BOOT_CMD(
67 ls, 4, 1, do_ls_wrapper,
68 "list files in a directory (default /)",
69 "<interface> [<dev[:part]> [directory]]\n"
70 " - List files in directory 'directory' of partition 'part' on\n"
71 " device type 'interface' instance 'dev'."
72 );
73
do_ln_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])74 static int do_ln_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
75 char *const argv[])
76 {
77 return do_ln(cmdtp, flag, argc, argv, FS_TYPE_ANY);
78 }
79
80 U_BOOT_CMD(
81 ln, 5, 1, do_ln_wrapper,
82 "Create a symbolic link",
83 "<interface> <dev[:part]> target linkname\n"
84 " - create a symbolic link to 'target' with the name 'linkname' on\n"
85 " device type 'interface' instance 'dev'."
86 );
87
do_mkdir_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])88 static int do_mkdir_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
89 char *const argv[])
90 {
91 return do_mkdir(cmdtp, flag, argc, argv, FS_TYPE_ANY);
92 }
93
94 U_BOOT_CMD(
95 mkdir, 4, 1, do_mkdir_wrapper,
96 "create a directory",
97 "<interface> [<dev[:part]>] <directory>\n"
98 " - Create a directory 'directory' of partition 'part' on\n"
99 " device type 'interface' instance 'dev'."
100 );
101
do_rm_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])102 static int do_rm_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
103 char *const argv[])
104 {
105 return do_rm(cmdtp, flag, argc, argv, FS_TYPE_ANY);
106 }
107
108 U_BOOT_CMD(
109 rm, 4, 1, do_rm_wrapper,
110 "delete a file",
111 "<interface> [<dev[:part]>] <filename>\n"
112 " - delete a file with the name 'filename' on\n"
113 " device type 'interface' instance 'dev'."
114 );
115
do_fstype_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])116 static int do_fstype_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
117 char *const argv[])
118 {
119 return do_fs_type(cmdtp, flag, argc, argv);
120 }
121
122 U_BOOT_CMD(
123 fstype, 4, 1, do_fstype_wrapper,
124 "Look up a filesystem type",
125 "<interface> <dev>:<part>\n"
126 "- print filesystem type\n"
127 "fstype <interface> <dev>:<part> <varname>\n"
128 "- set environment variable to filesystem type\n"
129 );
130
do_fstypes_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])131 static int do_fstypes_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
132 char * const argv[])
133 {
134 return do_fs_types(cmdtp, flag, argc, argv);
135 }
136
137 U_BOOT_CMD(
138 fstypes, 1, 1, do_fstypes_wrapper,
139 "List supported filesystem types", ""
140 );
141
do_mv_wrapper(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])142 static int do_mv_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
143 char *const argv[])
144 {
145 return do_mv(cmdtp, flag, argc, argv, FS_TYPE_ANY);
146 }
147
148 U_BOOT_CMD(
149 mv, 5, 1, do_mv_wrapper,
150 "rename/move a file/directory",
151 "<interface> [<dev[:part]>] <old_path> <new_path>\n"
152 " - renames/moves a file/directory in 'dev' on 'interface' from\n"
153 " 'old_path' to 'new_path'"
154 );
155