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