From e23ba4891d73f4c601e4df8eb03196473fe0218b Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Fri, 20 Jun 2025 11:18:59 +0800 Subject: [PATCH] system/fastboot: rename argument context to ctx Rename argument "context" to "ctx" for all functions. Signed-off-by: wangjianyu3 --- system/fastboot/fastboot.c | 307 ++++++++++++++++++------------------- 1 file changed, 147 insertions(+), 160 deletions(-) diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index 063476e45..67a01dd0d 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -171,7 +171,7 @@ struct fastboot_ctx_s uint64_t left; FAR void *download_buffer; FAR struct fastboot_var_s *varlist; - CODE int (*upload_func)(FAR struct fastboot_ctx_s *context); + CODE int (*upload_func)(FAR struct fastboot_ctx_s *); FAR const struct fastboot_transport_ops_s *ops; struct { @@ -187,8 +187,7 @@ struct fastboot_ctx_s struct fastboot_cmd_s { FAR const char *prefix; - CODE void (*handle)(FAR struct fastboot_ctx_s *context, - FAR const char *arg); + CODE void (*handle)(FAR struct fastboot_ctx_s *, FAR const char *); }; typedef void (*memdump_print_t)(FAR void *, FAR const char *); @@ -197,29 +196,29 @@ typedef void (*memdump_print_t)(FAR void *, FAR const char *); * Private Function Prototypes ****************************************************************************/ -static void fastboot_getvar(FAR struct fastboot_ctx_s *context, +static void fastboot_getvar(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_download(FAR struct fastboot_ctx_s *context, +static void fastboot_download(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_erase(FAR struct fastboot_ctx_s *context, +static void fastboot_erase(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_flash(FAR struct fastboot_ctx_s *context, +static void fastboot_flash(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_reboot(FAR struct fastboot_ctx_s *context, +static void fastboot_reboot(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_reboot_bootloader(FAR struct fastboot_ctx_s *context, +static void fastboot_reboot_bootloader(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_oem(FAR struct fastboot_ctx_s *context, +static void fastboot_oem(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_upload(FAR struct fastboot_ctx_s *context, +static void fastboot_upload(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_memdump(FAR struct fastboot_ctx_s *context, +static void fastboot_memdump(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); -static void fastboot_filedump(FAR struct fastboot_ctx_s *context, +static void fastboot_filedump(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); #ifdef CONFIG_SYSTEM_FASTBOOTD_SHELL -static void fastboot_shell(FAR struct fastboot_ctx_s *context, +static void fastboot_shell(FAR struct fastboot_ctx_s *ctx, FAR const char *arg); #endif @@ -335,9 +334,8 @@ static int fastboot_write(int fd, FAR const void *buf, size_t len) return OK; } -static void fastboot_ack(FAR struct fastboot_ctx_s *context, - FAR const char *code, - FAR const char *reason) +static void fastboot_ack(FAR struct fastboot_ctx_s *ctx, + FAR const char *code, FAR const char *reason) { char response[FASTBOOT_MSG_LEN]; @@ -347,10 +345,10 @@ static void fastboot_ack(FAR struct fastboot_ctx_s *context, } snprintf(response, FASTBOOT_MSG_LEN, "%s%s", code, reason); - context->ops->write(context, response, strlen(response)); + ctx->ops->write(ctx, response, strlen(response)); } -static void fastboot_fail(FAR struct fastboot_ctx_s *context, +static void fastboot_fail(FAR struct fastboot_ctx_s *ctx, FAR const char *fmt, ...) { char reason[FASTBOOT_MSG_LEN]; @@ -358,14 +356,14 @@ static void fastboot_fail(FAR struct fastboot_ctx_s *context, va_start(ap, fmt); vsnprintf(reason, sizeof(reason), fmt, ap); - fastboot_ack(context, "FAIL", reason); + fastboot_ack(ctx, "FAIL", reason); va_end(ap); } -static void fastboot_okay(FAR struct fastboot_ctx_s *context, +static void fastboot_okay(FAR struct fastboot_ctx_s *ctx, FAR const char *info) { - fastboot_ack(context, "OKAY", info); + fastboot_ack(ctx, "OKAY", info); } static int fastboot_flash_open(FAR const char *name) @@ -458,11 +456,10 @@ static int fastboot_flash_erase(int fd) return ret < 0 ? -errno : ret; } -static int -fastboot_flash_program(FAR struct fastboot_ctx_s *context, int fd) +static int fastboot_flash_program(FAR struct fastboot_ctx_s *ctx, int fd) { - FAR char *chunk_ptr = context->download_buffer; - FAR char *end_ptr = chunk_ptr + context->download_size; + FAR char *chunk_ptr = ctx->download_buffer; + FAR char *end_ptr = chunk_ptr + ctx->download_size; FAR struct fastboot_sparse_header_s *sparse; uint32_t chunk_num; int ret = OK; @@ -472,14 +469,14 @@ fastboot_flash_program(FAR struct fastboot_ctx_s *context, int fd) sparse = (FAR struct fastboot_sparse_header_s *)chunk_ptr; if (sparse->magic != FASTBOOT_SPARSE_MAGIC) { - ret = fastboot_flash_write(fd, 0, context->download_buffer, - context->download_size); + ret = fastboot_flash_write(fd, 0, ctx->download_buffer, + ctx->download_size); goto end; } - if (context->total_imgsize == 0) + if (ctx->total_imgsize == 0) { - context->total_imgsize = sparse->blk_sz * sparse->total_blks; + ctx->total_imgsize = sparse->blk_sz * sparse->total_blks; } chunk_num = sparse->total_chunks; @@ -497,14 +494,14 @@ fastboot_flash_program(FAR struct fastboot_ctx_s *context, int fd) case FASTBOOT_CHUNK_RAW: { uint32_t chunk_size = chunk->chunk_sz * sparse->blk_sz; - ret = fastboot_flash_write(fd, context->download_offset, + ret = fastboot_flash_write(fd, ctx->download_offset, chunk_ptr, chunk_size); if (ret < 0) { goto end; } - context->download_offset += chunk_size; + ctx->download_offset += chunk_size; chunk_ptr += chunk_size; } break; @@ -512,15 +509,14 @@ fastboot_flash_program(FAR struct fastboot_ctx_s *context, int fd) { uint32_t fill_data = be32toh(*(FAR uint32_t *)chunk_ptr); uint32_t chunk_size = chunk->chunk_sz * sparse->blk_sz; - ret = ffastboot_flash_fill(fd, context->download_offset, - fill_data, sparse->blk_sz, - chunk->chunk_sz); + ret = ffastboot_flash_fill(fd, ctx->download_offset, fill_data, + sparse->blk_sz, chunk->chunk_sz); if (ret < 0) { goto end; } - context->download_offset += chunk_size; + ctx->download_offset += chunk_size; chunk_ptr += 4; } break; @@ -533,18 +529,18 @@ fastboot_flash_program(FAR struct fastboot_ctx_s *context, int fd) } } - if (context->download_offset < context->total_imgsize) + if (ctx->download_offset < ctx->total_imgsize) { return 1; } end: - context->total_imgsize = 0; - context->download_offset = 0; + ctx->total_imgsize = 0; + ctx->download_offset = 0; return ret; } -static void fastboot_flash(FAR struct fastboot_ctx_s *context, +static void fastboot_flash(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { char blkdev[PATH_MAX]; @@ -552,34 +548,34 @@ static void fastboot_flash(FAR struct fastboot_ctx_s *context, snprintf(blkdev, PATH_MAX, FASTBOOT_BLKDEV, arg); - if (context->flash_fd < 0) + if (ctx->flash_fd < 0) { - context->flash_fd = fastboot_flash_open(blkdev); - if (context->flash_fd < 0) + ctx->flash_fd = fastboot_flash_open(blkdev); + if (ctx->flash_fd < 0) { - fastboot_fail(context, "Flash open failure"); + fastboot_fail(ctx, "Flash open failure"); return; } } - ret = fastboot_flash_program(context, context->flash_fd); + ret = fastboot_flash_program(ctx, ctx->flash_fd); if (ret < 0) { - fastboot_fail(context, "Image flash failure"); + fastboot_fail(ctx, "Image flash failure"); } else { - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); } if (ret <= 0) { - fastboot_flash_close(context->flash_fd); - context->flash_fd = -1; + fastboot_flash_close(ctx->flash_fd); + ctx->flash_fd = -1; } } -static void fastboot_erase(FAR struct fastboot_ctx_s *context, +static void fastboot_erase(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { char blkdev[PATH_MAX]; @@ -592,7 +588,7 @@ static void fastboot_erase(FAR struct fastboot_ctx_s *context, fd = fastboot_flash_open(blkdev); if (fd < 0) { - fastboot_fail(context, "Flash open failure"); + fastboot_fail(ctx, "Flash open failure"); return; } @@ -604,13 +600,13 @@ static void fastboot_erase(FAR struct fastboot_ctx_s *context, ret = fstat(fd, &sb); if (ret >= 0) { - memset(context->download_buffer, 0xff, context->download_max); + memset(ctx->download_buffer, 0xff, ctx->download_max); while (sb.st_size > 0) { - size_t len = MIN(sb.st_size, context->download_max); + size_t len = MIN(sb.st_size, ctx->download_max); - ret = fastboot_write(fd, context->download_buffer, len); + ret = fastboot_write(fd, ctx->download_buffer, len); if (ret < 0) { break; @@ -623,17 +619,17 @@ static void fastboot_erase(FAR struct fastboot_ctx_s *context, if (ret < 0) { - fastboot_fail(context, "Flash erase failure"); + fastboot_fail(ctx, "Flash erase failure"); } else { - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); } fastboot_flash_close(fd); } -static void fastboot_download(FAR struct fastboot_ctx_s *context, +static void fastboot_download(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { FAR char *download; @@ -642,29 +638,29 @@ static void fastboot_download(FAR struct fastboot_ctx_s *context, int ret; len = strtoul(arg, NULL, 16); - if (len > context->download_max) + if (len > ctx->download_max) { - fastboot_fail(context, "Data too large"); + fastboot_fail(ctx, "Data too large"); return; } snprintf(response, FASTBOOT_MSG_LEN, "DATA%08lx", len); - ret = context->ops->write(context, response, strlen(response)); + ret = ctx->ops->write(ctx, response, strlen(response)); if (ret < 0) { fb_err("Reponse error [%d]\n", -ret); return; } - download = context->download_buffer; - context->download_size = len; + download = ctx->download_buffer; + ctx->download_size = len; while (len > 0) { - ssize_t r = context->ops->read(context, download, len); + ssize_t r = ctx->ops->read(ctx, download, len); if (r < 0) { - context->download_size = 0; + ctx->download_size = 0; fb_err("fastboot_download usb read error\n"); return; } @@ -673,62 +669,62 @@ static void fastboot_download(FAR struct fastboot_ctx_s *context, download += r; } - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); } -static void fastboot_getvar(FAR struct fastboot_ctx_s *context, +static void fastboot_getvar(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { FAR struct fastboot_var_s *var; char buffer[FASTBOOT_MSG_LEN]; - for (var = context->varlist; var != NULL; var = var->next) + for (var = ctx->varlist; var != NULL; var = var->next) { if (!strcmp(var->name, arg)) { if (var->string == NULL) { itoa(var->data, buffer, 10); - fastboot_okay(context, buffer); + fastboot_okay(ctx, buffer); } else { - fastboot_okay(context, var->string); + fastboot_okay(ctx, var->string); } return; } } - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); } -static void fastboot_reboot(FAR struct fastboot_ctx_s *context, +static void fastboot_reboot(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { #ifdef CONFIG_BOARDCTL_RESET - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); boardctl(BOARDIOC_RESET, BOARDIOC_SOFTRESETCAUSE_USER_REBOOT); #else - fastboot_fail(context, "Operation not supported"); + fastboot_fail(ctx, "Operation not supported"); #endif } -static void fastboot_reboot_bootloader(FAR struct fastboot_ctx_s *context, +static void fastboot_reboot_bootloader(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { #ifdef CONFIG_BOARDCTL_RESET - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); boardctl(BOARDIOC_RESET, BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER); #else - fastboot_fail(context, "Operation not supported"); + fastboot_fail(ctx, "Operation not supported"); #endif } -static int fastboot_memdump_upload(FAR struct fastboot_ctx_s *context) +static int fastboot_memdump_upload(FAR struct fastboot_ctx_s *ctx) { - return context->ops->write(context, context->upload_param.u.mem.addr, - context->upload_param.size); + return ctx->ops->write(ctx, ctx->upload_param.u.mem.addr, + ctx->upload_param.size); } static void fastboot_memdump_region(memdump_print_t memprint, FAR void *priv) @@ -771,60 +767,56 @@ static void fastboot_memdump_response(FAR void *priv, * fastboot get_staged mem_44000000_440b6c00.bin */ -static void fastboot_memdump(FAR struct fastboot_ctx_s *context, +static void fastboot_memdump(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { if (!arg || - sscanf(arg, "%p %zx", - &context->upload_param.u.mem.addr, - &context->upload_param.size) != 2) + sscanf(arg, "%p %zx", &ctx->upload_param.u.mem.addr, + &ctx->upload_param.size) != 2) { - fastboot_memdump_region(fastboot_memdump_response, context); - fastboot_fail(context, "Invalid argument"); + fastboot_memdump_region(fastboot_memdump_response, ctx); + fastboot_fail(ctx, "Invalid argument"); return; } - fb_info("Memdump Addr: %p, Size: 0x%zx\n", - context->upload_param.u.mem.addr, - context->upload_param.size); - context->upload_func = fastboot_memdump_upload; - fastboot_okay(context, ""); + fb_info("Memdump Addr: %p, Size: 0x%zx\n", ctx->upload_param.u.mem.addr, + ctx->upload_param.size); + ctx->upload_func = fastboot_memdump_upload; + fastboot_okay(ctx, ""); } -static int fastboot_filedump_upload(FAR struct fastboot_ctx_s *context) +static int fastboot_filedump_upload(FAR struct fastboot_ctx_s *ctx) { - size_t size = context->upload_param.size; + size_t size = ctx->upload_param.size; int fd; - fd = open(context->upload_param.u.file.path, O_RDONLY | O_CLOEXEC); + fd = open(ctx->upload_param.u.file.path, O_RDONLY | O_CLOEXEC); if (fd < 0) { fb_err("No such file or directory %d\n", errno); return -errno; } - if (context->upload_param.u.file.offset && - lseek(fd, context->upload_param.u.file.offset, - context->upload_param.u.file.offset > 0 ? SEEK_SET : - SEEK_END) < 0) + if (ctx->upload_param.u.file.offset && + lseek(fd, ctx->upload_param.u.file.offset, + ctx->upload_param.u.file.offset > 0 ? SEEK_SET : SEEK_END) < 0) { fb_err("Invalid argument, offset: %" PRIdOFF "\n", - context->upload_param.u.file.offset); + ctx->upload_param.u.file.offset); close(fd); return -errno; } while (size > 0) { - ssize_t nread = fastboot_read(fd, context->download_buffer, - MIN(size, context->download_max)); + ssize_t nread = fastboot_read(fd, ctx->download_buffer, + MIN(size, ctx->download_max)); if (nread == 0) { break; } else if (nread < 0 || - context->ops->write(context, context->download_buffer, - nread) < 0) + ctx->ops->write(ctx, ctx->download_buffer, nread) < 0) { fb_err("Upload failed (%zu bytes left)\n", size); close(fd); @@ -855,7 +847,7 @@ static int fastboot_filedump_upload(FAR struct fastboot_ctx_s *context) * fastboot get_staged bl_l1044480_l1042432.txt */ -static void fastboot_filedump(FAR struct fastboot_ctx_s *context, +static void fastboot_filedump(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { struct stat sb; @@ -863,42 +855,39 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *context, if (!arg) { - fastboot_fail(context, "Invalid argument"); + fastboot_fail(ctx, "Invalid argument"); return; } - ret = sscanf(arg, "%s %" PRIdOFF " %zu", - context->upload_param.u.file.path, - &context->upload_param.u.file.offset, - &context->upload_param.size); + ret = sscanf(arg, "%s %" PRIdOFF " %zu", ctx->upload_param.u.file.path, + &ctx->upload_param.u.file.offset, &ctx->upload_param.size); if (ret != 1 && ret != 3) { - fastboot_fail(context, "Failed to parse arguments"); + fastboot_fail(ctx, "Failed to parse arguments"); return; } else if (ret == 1) { - ret = stat(context->upload_param.u.file.path, &sb); + ret = stat(ctx->upload_param.u.file.path, &sb); if (ret < 0) { - fastboot_fail(context, "No such file or directory"); + fastboot_fail(ctx, "No such file or directory"); return; } - context->upload_param.size = sb.st_size; - context->upload_param.u.file.offset = 0; + ctx->upload_param.size = sb.st_size; + ctx->upload_param.u.file.offset = 0; } fb_info("Filedump Path: %s, Offset: %" PRIdOFF ", Size: %zu\n", - context->upload_param.u.file.path, - context->upload_param.u.file.offset, - context->upload_param.size); - context->upload_func = fastboot_filedump_upload; - fastboot_okay(context, ""); + ctx->upload_param.u.file.path, ctx->upload_param.u.file.offset, + ctx->upload_param.size); + ctx->upload_func = fastboot_filedump_upload; + fastboot_okay(ctx, ""); } #ifdef CONFIG_SYSTEM_FASTBOOTD_SHELL -static void fastboot_shell(FAR struct fastboot_ctx_s *context, +static void fastboot_shell(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { char response[FASTBOOT_MSG_LEN - 4]; @@ -908,66 +897,64 @@ static void fastboot_shell(FAR struct fastboot_ctx_s *context, fp = popen(arg, "r"); if (fp == NULL) { - fastboot_fail(context, "popen() fails %d", errno); + fastboot_fail(ctx, "popen() fails %d", errno); return; } while (fgets(response, sizeof(response), fp)) { - fastboot_ack(context, "TEXT", response); + fastboot_ack(ctx, "TEXT", response); } ret = pclose(fp); if (WIFEXITED(ret) && WEXITSTATUS(ret) == 0) { - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); return; } - fastboot_fail(context, "error detected 0x%x %d", ret, errno); + fastboot_fail(ctx, "error detected 0x%x %d", ret, errno); } #endif -static void fastboot_upload(FAR struct fastboot_ctx_s *context, +static void fastboot_upload(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { char response[FASTBOOT_MSG_LEN]; int ret; - if (!context->upload_param.size || !context->upload_func) + if (!ctx->upload_param.size || !ctx->upload_func) { - fastboot_fail(context, "No data staged by the last command"); + fastboot_fail(ctx, "No data staged by the last command"); return; } - snprintf(response, FASTBOOT_MSG_LEN, "DATA%08zx", - context->upload_param.size); + snprintf(response, FASTBOOT_MSG_LEN, "DATA%08zx", ctx->upload_param.size); - ret = context->ops->write(context, response, strlen(response)); + ret = ctx->ops->write(ctx, response, strlen(response)); if (ret < 0) { fb_err("Reponse error [%d]\n", -ret); goto done; } - ret = context->upload_func(context); + ret = ctx->upload_func(ctx); if (ret < 0) { fb_err("Upload failed, [%d]\n", -ret); - fastboot_fail(context, "Upload failed"); + fastboot_fail(ctx, "Upload failed"); } else { - fastboot_okay(context, ""); + fastboot_okay(ctx, ""); } done: - context->upload_param.size = 0; - context->upload_func = NULL; + ctx->upload_param.size = 0; + ctx->upload_func = NULL; } -static void fastboot_oem(FAR struct fastboot_ctx_s *context, - FAR const char *arg) +static void fastboot_oem(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { size_t ncmds = nitems(g_oem_cmd); size_t index; @@ -980,27 +967,27 @@ static void fastboot_oem(FAR struct fastboot_ctx_s *context, if (memcmp(arg, g_oem_cmd[index].prefix, len) == 0) { arg += len; - g_oem_cmd[index].handle(context, *arg == ' ' ? ++arg : NULL); + g_oem_cmd[index].handle(ctx, *arg == ' ' ? ++arg : NULL); break; } } if (index == ncmds) { - fastboot_fail(context, "Unknown command"); + fastboot_fail(ctx, "Unknown command"); } } -static void fastboot_command_loop(FAR struct fastboot_ctx_s *context) +static void fastboot_command_loop(FAR struct fastboot_ctx_s *ctx) { - if (context->left > 0) + if (ctx->left > 0) { struct pollfd fds[1]; - fds[0].fd = context->tran_fd[0]; + fds[0].fd = ctx->tran_fd[0]; fds[0].events = POLLIN; - if (poll(fds, 1, context->left) <= 0) + if (poll(fds, 1, ctx->left) <= 0) { return; } @@ -1008,7 +995,7 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *context) /* Reinitialize for storing TCP transport remaining data size. */ - context->left = 0; + ctx->left = 0; while (1) { @@ -1016,7 +1003,7 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *context) size_t ncmds = nitems(g_fast_cmd); size_t index; - ssize_t r = context->ops->read(context, buffer, FASTBOOT_MSG_LEN); + ssize_t r = ctx->ops->read(ctx, buffer, FASTBOOT_MSG_LEN); if (r < 0) { fb_err("fastboot transport read() %zd\n", r); @@ -1029,19 +1016,19 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *context) size_t len = strlen(g_fast_cmd[index].prefix); if (memcmp(buffer, g_fast_cmd[index].prefix, len) == 0) { - g_fast_cmd[index].handle(context, buffer + len); + g_fast_cmd[index].handle(ctx, buffer + len); break; } } if (index == ncmds) { - fastboot_fail(context, "Unknown command"); + fastboot_fail(ctx, "Unknown command"); } } } -static void fastboot_publish(FAR struct fastboot_ctx_s *context, +static void fastboot_publish(FAR struct fastboot_ctx_s *ctx, FAR const char *name, FAR const char *string, int data) @@ -1058,29 +1045,29 @@ static void fastboot_publish(FAR struct fastboot_ctx_s *context, var->name = name; var->string = string; var->data = data; - var->next = context->varlist; - context->varlist = var; + var->next = ctx->varlist; + ctx->varlist = var; } -static void fastboot_create_publish(FAR struct fastboot_ctx_s *context) +static void fastboot_create_publish(FAR struct fastboot_ctx_s *ctx) { - fastboot_publish(context, "product", "NuttX", 0); - fastboot_publish(context, "kernel", "NuttX", 0); - fastboot_publish(context, "version", CONFIG_VERSION_STRING, 0); - fastboot_publish(context, "slot-count", "1", 0); - fastboot_publish(context, "max-download-size", NULL, + fastboot_publish(ctx, "product", "NuttX", 0); + fastboot_publish(ctx, "kernel", "NuttX", 0); + fastboot_publish(ctx, "version", CONFIG_VERSION_STRING, 0); + fastboot_publish(ctx, "slot-count", "1", 0); + fastboot_publish(ctx, "max-download-size", NULL, CONFIG_SYSTEM_FASTBOOTD_DOWNLOAD_MAX); } -static void fastboot_free_publish(FAR struct fastboot_ctx_s *context) +static void fastboot_free_publish(FAR struct fastboot_ctx_s *ctx) { FAR struct fastboot_var_s *next; - while (context->varlist) + while (ctx->varlist) { - next = context->varlist->next; - free(context->varlist); - context->varlist = next; + next = ctx->varlist->next; + free(ctx->varlist); + ctx->varlist = next; } }