Skip to content

Commit

Permalink
Ignore SD card state changes when not SD card is not used (#88)
Browse files Browse the repository at this point in the history
Prevent SD card state change from restarting dockerd when SD card is
not being used.

Also clarifying the comment about SD card unmounting.

Co-authored-by: Mattias Axelsson <[email protected]>
  • Loading branch information
github-actions[bot] and killenheladagen authored Apr 8, 2024
1 parent cf12ea1 commit 552ca1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/dockerdwrapperwithcompose.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,12 @@ static void
sd_card_callback(const char *sd_card_area, void *app_state_void_ptr)
{
struct app_state *app_state = app_state_void_ptr;
if (!sd_card_area)
const bool using_sd_card = is_parameter_yes(PARAM_SD_CARD_SUPPORT);
if (using_sd_card && !sd_card_area)
stop_dockerd(); // Block here until dockerd has stopped using the SD card.
app_state->sd_card_area = sd_card_area ? strdup(sd_card_area) : NULL;
g_main_loop_quit(loop); // Trigger a restart of dockerd from main()
if (using_sd_card)
g_main_loop_quit(loop); // Trigger a restart of dockerd from main()
}

// Stop the application and start it from an SSH prompt with
Expand Down
6 changes: 4 additions & 2 deletions app/sd_disk_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

typedef void (*SdDiskCallback)(const char *area_path, void *user_data);

// Call sd_disk_callback with a path to the SD card when it has become available
// and with NULL when it is about to be unmounted.
// Call sd_disk_callback with a path to the SD card when it has become
// available. Call sd_disk_callback with NULL when it is about to be unmounted.
// Unmounting will fail if the SD card area contains open files when the
// callback returns.
struct sd_disk_storage *sd_disk_storage_init(SdDiskCallback sd_disk_callback,
void *user_data);

Expand Down

0 comments on commit 552ca1d

Please sign in to comment.