am 8a5796b1: am 98a4dd48: Merge "\'usb\' doesn\'t need to be global in fastboot."
* commit '8a5796b1c54e1c3e42581ee6628fb55895998d90': 'usb' doesn't need to be global in fastboot.
This commit is contained in:
commit
9d4a8a7763
|
@ -59,7 +59,6 @@
|
|||
|
||||
char cur_product[FB_RESPONSE_SZ + 1];
|
||||
|
||||
static usb_handle *usb = 0;
|
||||
static const char *serial = 0;
|
||||
static const char *product = 0;
|
||||
static const char *cmdline = 0;
|
||||
|
@ -609,7 +608,7 @@ static int64_t get_sparse_limit(struct usb_handle *usb, int64_t size)
|
|||
* erase partitions of type ext4 before flashing a filesystem so no stale
|
||||
* inodes are left lying around. Otherwise, e2fsck gets very upset.
|
||||
*/
|
||||
static int needs_erase(const char *part)
|
||||
static int needs_erase(usb_handle* usb, const char *part)
|
||||
{
|
||||
/* The function fb_format_supported() currently returns the value
|
||||
* we want, so just call it.
|
||||
|
@ -737,7 +736,7 @@ void do_update(usb_handle *usb, const char *filename, int erase_first)
|
|||
int rc = load_buf_fd(usb, fd, &buf);
|
||||
if (rc) die("cannot load %s from flash", images[i].img_name);
|
||||
do_update_signature(zip, images[i].sig_name);
|
||||
if (erase_first && needs_erase(images[i].part_name)) {
|
||||
if (erase_first && needs_erase(usb, images[i].part_name)) {
|
||||
fb_queue_erase(images[i].part_name);
|
||||
}
|
||||
flash_buf(images[i].part_name, &buf);
|
||||
|
@ -792,7 +791,7 @@ void do_flashall(usb_handle *usb, int erase_first)
|
|||
die("could not load %s\n", images[i].img_name);
|
||||
}
|
||||
do_send_signature(fname);
|
||||
if (erase_first && needs_erase(images[i].part_name)) {
|
||||
if (erase_first && needs_erase(usb, images[i].part_name)) {
|
||||
fb_queue_erase(images[i].part_name);
|
||||
}
|
||||
flash_buf(images[i].part_name, &buf);
|
||||
|
@ -860,7 +859,8 @@ static int64_t parse_num(const char *arg)
|
|||
return num;
|
||||
}
|
||||
|
||||
void fb_perform_format(const char *partition, int skip_if_not_supported,
|
||||
void fb_perform_format(usb_handle* usb,
|
||||
const char *partition, int skip_if_not_supported,
|
||||
const char *type_override, const char *size_override)
|
||||
{
|
||||
char pTypeBuff[FB_RESPONSE_SZ + 1], pSizeBuff[FB_RESPONSE_SZ + 1];
|
||||
|
@ -1063,7 +1063,7 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
usb = open_device();
|
||||
usb_handle* usb = open_device();
|
||||
|
||||
while (argc > 0) {
|
||||
if(!strcmp(*argv, "getvar")) {
|
||||
|
@ -1105,10 +1105,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
if (type_override && !type_override[0]) type_override = NULL;
|
||||
if (size_override && !size_override[0]) size_override = NULL;
|
||||
if (erase_first && needs_erase(argv[1])) {
|
||||
if (erase_first && needs_erase(usb, argv[1])) {
|
||||
fb_queue_erase(argv[1]);
|
||||
}
|
||||
fb_perform_format(argv[1], 0, type_override, size_override);
|
||||
fb_perform_format(usb, argv[1], 0, type_override, size_override);
|
||||
skip(2);
|
||||
} else if(!strcmp(*argv, "signature")) {
|
||||
require(2);
|
||||
|
@ -1163,7 +1163,7 @@ int main(int argc, char **argv)
|
|||
skip(2);
|
||||
}
|
||||
if (fname == 0) die("cannot determine image filename for '%s'", pname);
|
||||
if (erase_first && needs_erase(pname)) {
|
||||
if (erase_first && needs_erase(usb, pname)) {
|
||||
fb_queue_erase(pname);
|
||||
}
|
||||
do_flash(usb, pname, fname);
|
||||
|
@ -1214,9 +1214,9 @@ int main(int argc, char **argv)
|
|||
|
||||
if (wants_wipe) {
|
||||
fb_queue_erase("userdata");
|
||||
fb_perform_format("userdata", 1, NULL, NULL);
|
||||
fb_perform_format(usb, "userdata", 1, NULL, NULL);
|
||||
fb_queue_erase("cache");
|
||||
fb_perform_format("cache", 1, NULL, NULL);
|
||||
fb_perform_format(usb, "cache", 1, NULL, NULL);
|
||||
}
|
||||
if (wants_reboot) {
|
||||
fb_queue_reboot();
|
||||
|
|
Loading…
Reference in New Issue