Blame view
cmd/reiser.c
3.73 KB
83d290c56 SPDX: Convert all... |
1 |
// SPDX-License-Identifier: GPL-2.0+ |
518e2e1ae * Patch by Pavel ... |
2 3 4 5 |
/* * (C) Copyright 2003 - 2004 * Sysgo Real-Time Solutions, AG <www.elinos.com> * Pavel Bartusek <pba@sysgo.com> |
518e2e1ae * Patch by Pavel ... |
6 7 8 9 10 11 |
*/ /* * Reiserfs support */ #include <common.h> |
518e2e1ae * Patch by Pavel ... |
12 13 14 15 16 17 |
#include <config.h> #include <command.h> #include <image.h> #include <linux/ctype.h> #include <asm/byteorder.h> #include <reiserfs.h> |
735dd97b1 [PATCH 1_4] Merge... |
18 |
#include <part.h> |
518e2e1ae * Patch by Pavel ... |
19 |
|
b0cf73393 disk: convert CON... |
20 |
#if !CONFIG_IS_ENABLED(DOS_PARTITION) |
518e2e1ae * Patch by Pavel ... |
21 22 23 24 25 26 27 28 29 30 |
#error DOS partition support must be selected #endif /* #define REISER_DEBUG */ #ifdef REISER_DEBUG #define PRINTF(fmt,args...) printf (fmt ,##args) #else #define PRINTF(fmt,args...) #endif |
54841ab50 Make sure that ar... |
31 |
int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
518e2e1ae * Patch by Pavel ... |
32 33 |
{ char *filename = "/"; |
650f36641 cmd_reiser: use c... |
34 |
int dev, part; |
4101f6879 dm: Drop the bloc... |
35 |
struct blk_desc *dev_desc = NULL; |
650f36641 cmd_reiser: use c... |
36 |
disk_partition_t info; |
518e2e1ae * Patch by Pavel ... |
37 |
|
47e26b1bf cmd_usage(): simp... |
38 |
if (argc < 3) |
4c12eeb8b Convert cmd_usage... |
39 |
return CMD_RET_USAGE; |
47e26b1bf cmd_usage(): simp... |
40 |
|
e35929e4a dm: blk: Rename g... |
41 |
part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); |
650f36641 cmd_reiser: use c... |
42 |
if (part < 0) |
518e2e1ae * Patch by Pavel ... |
43 |
return 1; |
518e2e1ae * Patch by Pavel ... |
44 45 46 47 |
if (argc == 4) { filename = argv[3]; } |
bcce53d04 dm: block: Rename... |
48 |
dev = dev_desc->devnum; |
518e2e1ae * Patch by Pavel ... |
49 50 |
PRINTF("Using device %s %d:%d, directory: %s ", argv[1], dev, part, filename); |
650f36641 cmd_reiser: use c... |
51 |
reiserfs_set_blk_dev(dev_desc, &info); |
518e2e1ae * Patch by Pavel ... |
52 |
|
650f36641 cmd_reiser: use c... |
53 |
if (!reiserfs_mount(info.size)) { |
566a494f5 [PCS440EP] u... |
54 55 |
printf ("** Bad Reiserfs partition or disk - %s %d:%d ** ", argv[1], dev, part); |
518e2e1ae * Patch by Pavel ... |
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
return 1; } if (reiserfs_ls (filename)) { printf ("** Error reiserfs_ls() ** "); return 1; }; return 0; } U_BOOT_CMD( reiserls, 4, 1, do_reiserls, |
2fb2604d5 Command usage cle... |
70 |
"list files in a directory (default /)", |
518e2e1ae * Patch by Pavel ... |
71 72 |
"<interface> <dev[:part]> [directory] " |
a89c33db9 General help mess... |
73 |
" - list files from 'dev' on 'interface' in a 'directory'" |
518e2e1ae * Patch by Pavel ... |
74 75 76 77 78 |
); /****************************************************************************** * Reiserfs boot command intepreter. Derived from diskboot */ |
54841ab50 Make sure that ar... |
79 |
int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
518e2e1ae * Patch by Pavel ... |
80 81 |
{ char *filename = NULL; |
650f36641 cmd_reiser: use c... |
82 83 |
int dev, part; ulong addr = 0, filelen; |
518e2e1ae * Patch by Pavel ... |
84 |
disk_partition_t info; |
4101f6879 dm: Drop the bloc... |
85 |
struct blk_desc *dev_desc = NULL; |
518e2e1ae * Patch by Pavel ... |
86 87 88 89 90 |
unsigned long count; char *addr_str; switch (argc) { case 3: |
00caae6d4 env: Rename geten... |
91 |
addr_str = env_get("loadaddr"); |
518e2e1ae * Patch by Pavel ... |
92 93 94 |
if (addr_str != NULL) { addr = simple_strtoul (addr_str, NULL, 16); } else { |
6d0f6bcf3 rename CFG_ macro... |
95 |
addr = CONFIG_SYS_LOAD_ADDR; |
518e2e1ae * Patch by Pavel ... |
96 |
} |
00caae6d4 env: Rename geten... |
97 |
filename = env_get("bootfile"); |
518e2e1ae * Patch by Pavel ... |
98 99 100 101 |
count = 0; break; case 4: addr = simple_strtoul (argv[3], NULL, 16); |
00caae6d4 env: Rename geten... |
102 |
filename = env_get("bootfile"); |
518e2e1ae * Patch by Pavel ... |
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
count = 0; break; case 5: addr = simple_strtoul (argv[3], NULL, 16); filename = argv[4]; count = 0; break; case 6: addr = simple_strtoul (argv[3], NULL, 16); filename = argv[4]; count = simple_strtoul (argv[5], NULL, 16); break; default: |
4c12eeb8b Convert cmd_usage... |
117 |
return CMD_RET_USAGE; |
518e2e1ae * Patch by Pavel ... |
118 119 120 121 122 123 124 125 |
} if (!filename) { puts (" ** No boot file defined ** "); return 1; } |
e35929e4a dm: blk: Rename g... |
126 |
part = blk_get_device_part_str(argv[1], argv[2], &dev_desc, &info, 1); |
650f36641 cmd_reiser: use c... |
127 |
if (part < 0) |
518e2e1ae * Patch by Pavel ... |
128 |
return 1; |
518e2e1ae * Patch by Pavel ... |
129 |
|
bcce53d04 dm: block: Rename... |
130 |
dev = dev_desc->devnum; |
518e2e1ae * Patch by Pavel ... |
131 |
|
650f36641 cmd_reiser: use c... |
132 133 134 135 |
printf("Loading file \"%s\" from %s device %d%c%c ", filename, argv[1], dev, part ? ':' : ' ', part ? part + '0' : ' '); |
518e2e1ae * Patch by Pavel ... |
136 |
|
650f36641 cmd_reiser: use c... |
137 |
reiserfs_set_blk_dev(dev_desc, &info); |
518e2e1ae * Patch by Pavel ... |
138 |
|
650f36641 cmd_reiser: use c... |
139 |
if (!reiserfs_mount(info.size)) { |
566a494f5 [PCS440EP] u... |
140 141 |
printf ("** Bad Reiserfs partition or disk - %s %d:%d ** ", argv[1], dev, part); |
518e2e1ae * Patch by Pavel ... |
142 143 144 145 146 |
return 1; } filelen = reiserfs_open(filename); if (filelen < 0) { |
2e18cb267 cmd_reiser: norma... |
147 148 |
printf("** File not found %s ** ", filename); |
518e2e1ae * Patch by Pavel ... |
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
return 1; } if ((count < filelen) && (count != 0)) { filelen = count; } if (reiserfs_read((char *)addr, filelen) != filelen) { printf(" ** Unable to read \"%s\" from %s %d:%d ** ", filename, argv[1], dev, part); return 1; } /* Loading ok, update default load address */ load_addr = addr; printf (" %ld bytes read ", filelen); |
018f53032 env: Rename commo... |
168 |
env_set_hex("filesize", filelen); |
518e2e1ae * Patch by Pavel ... |
169 170 171 172 173 174 |
return filelen; } U_BOOT_CMD( reiserload, 6, 0, do_reiserload, |
2fb2604d5 Command usage cle... |
175 |
"load binary file from a Reiser filesystem", |
518e2e1ae * Patch by Pavel ... |
176 177 178 179 |
"<interface> <dev[:part]> [addr] [filename] [bytes] " " - load binary file 'filename' from 'dev' on 'interface' " |
a89c33db9 General help mess... |
180 |
" to address 'addr' from dos filesystem" |
518e2e1ae * Patch by Pavel ... |
181 |
); |