Message ID | 1563204929-2762-2-git-send-email-philippe.reynes@softathome.com |
---|---|
State | Accepted |
Headers | show |
Series | handlers: add a flag NO_DATA_HANDLER | expand |
On 15/07/19 17:35, Philippe Reynes wrote: > This commit add a special handler flag NO_DATA_HANDLER > to define a handler that don't use a file from the > swupdate image. > > Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> > --- > core/handler.c | 12 ++++++++++++ > include/handler.h | 8 ++++++-- > 2 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/core/handler.c b/core/handler.c > index 5716be9..d8f879e 100644 > --- a/core/handler.c > +++ b/core/handler.c > @@ -78,3 +78,15 @@ struct installer_handler *get_next_handler(void) > return &supported_types[handler_index++]; > } > > +unsigned int get_handler_mask(struct img_type *img) > +{ > + struct installer_handler *hnd; > + unsigned int mask = 0; > + > + hnd = find_handler(img); > + > + if (hnd) > + mask = hnd->mask; > + > + return mask; > +} > diff --git a/include/handler.h b/include/handler.h > index 73e855a..74c94dc 100644 > --- a/include/handler.h > +++ b/include/handler.h > @@ -25,11 +25,13 @@ typedef enum { > FILE_HANDLER = 2, > SCRIPT_HANDLER = 4, > BOOTLOADER_HANDLER = 8, > - PARTITION_HANDLER = 16 > + PARTITION_HANDLER = 16, > + NO_DATA_HANDLER = 32 > } HANDLER_MASK; > > #define ANY_HANDLER (IMAGE_HANDLER | FILE_HANDLER | SCRIPT_HANDLER | \ > - BOOTLOADER_HANDLER | PARTITION_HANDLER) > + BOOTLOADER_HANDLER | PARTITION_HANDLER | \ > + NO_DATA_HANDLER) > > typedef int (*handler)(struct img_type *img, void *data); > struct installer_handler{ > @@ -45,4 +47,6 @@ int register_handler(const char *desc, > struct installer_handler *find_handler(struct img_type *img); > void print_registered_handlers(void); > struct installer_handler *get_next_handler(void); > +unsigned int get_handler_mask(struct img_type *img); > + > #endif > Acked-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic
diff --git a/core/handler.c b/core/handler.c index 5716be9..d8f879e 100644 --- a/core/handler.c +++ b/core/handler.c @@ -78,3 +78,15 @@ struct installer_handler *get_next_handler(void) return &supported_types[handler_index++]; } +unsigned int get_handler_mask(struct img_type *img) +{ + struct installer_handler *hnd; + unsigned int mask = 0; + + hnd = find_handler(img); + + if (hnd) + mask = hnd->mask; + + return mask; +} diff --git a/include/handler.h b/include/handler.h index 73e855a..74c94dc 100644 --- a/include/handler.h +++ b/include/handler.h @@ -25,11 +25,13 @@ typedef enum { FILE_HANDLER = 2, SCRIPT_HANDLER = 4, BOOTLOADER_HANDLER = 8, - PARTITION_HANDLER = 16 + PARTITION_HANDLER = 16, + NO_DATA_HANDLER = 32 } HANDLER_MASK; #define ANY_HANDLER (IMAGE_HANDLER | FILE_HANDLER | SCRIPT_HANDLER | \ - BOOTLOADER_HANDLER | PARTITION_HANDLER) + BOOTLOADER_HANDLER | PARTITION_HANDLER | \ + NO_DATA_HANDLER) typedef int (*handler)(struct img_type *img, void *data); struct installer_handler{ @@ -45,4 +47,6 @@ int register_handler(const char *desc, struct installer_handler *find_handler(struct img_type *img); void print_registered_handlers(void); struct installer_handler *get_next_handler(void); +unsigned int get_handler_mask(struct img_type *img); + #endif
This commit add a special handler flag NO_DATA_HANDLER to define a handler that don't use a file from the swupdate image. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com> --- core/handler.c | 12 ++++++++++++ include/handler.h | 8 ++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)