Skip to content

Commit

Permalink
Merge pull request #43 from jluebbe/type-handling
Browse files Browse the repository at this point in the history
Refactor slot and image type handling
  • Loading branch information
Enrico Jorns committed May 4, 2016
2 parents 724c292 + 8a69b9a commit e74aea2
Show file tree
Hide file tree
Showing 12 changed files with 721 additions and 240 deletions.
7 changes: 6 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ librauc_la_SOURCES = \
src/network.c \
src/service.c \
src/signature.c \
src/utils.c
src/utils.c \
src/update_handler.c
nodist_librauc_la_SOURCES = \
$(gdbus_installer_generated)
librauc_la_CFLAGS = $(AM_CFLAGS) $(CODE_COVERAGE_CFLAGS)
Expand Down Expand Up @@ -75,6 +76,7 @@ check_PROGRAMS = \
test/config_file.test \
test/manifest.test \
test/signature.test \
test/update_handler.test \
test/install.test \
test/network.test \
test/service.test \
Expand Down Expand Up @@ -110,6 +112,9 @@ test_service_test_LDADD = librauctest.la
test_signature_test_SOURCES = test/signature.c
test_signature_test_LDADD = librauctest.la

test_update_handler_test_SOURCES = test/update_handler.c
test_update_handler_test_LDADD = librauc.la librauctest.la

test_install_test_SOURCES = test/install.c
test_install_test_LDADD = librauctest.la

Expand Down
3 changes: 2 additions & 1 deletion include/config_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ typedef struct _RaucSlot {
/** current state of the slot (runtime) */
SlotState state;
struct _RaucSlot *parent;
gchar *mountpoint;
gchar *mount_point;
gboolean mount_internal;
} RaucSlot;

typedef struct {
Expand Down
32 changes: 27 additions & 5 deletions include/mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,39 @@ gboolean r_mount_full(const gchar *source, const gchar *mountpoint, const gchar*
*/
gboolean r_mount_loop(const gchar *filename, const gchar *mountpoint, gsize size, GError **error);

/**
* Unmount a slot or a file.
*
* @param dirdev directory or device to unmount
*/
gboolean r_umount(const gchar *dirdev, GError **error);

/**
* Create a mount dir under mount prefix path.
*
* @param name
* @param error
*/
gchar* r_create_mount_point(const gchar *name, GError **error);

/**
* Mount a slot.
*
* The mountpoint will be available as slot->mount_point.
*
* @param slot Slot to mount
* @param mountpoint destination mount point
*
* @return True if succeeded, False if failed
*/
gboolean r_mount_slot(RaucSlot *slot, const gchar *mountpoint, GError **error);
gboolean r_mount_slot(RaucSlot *slot, GError **error);

/**
* Unmount a slot or a file.
* Unmount a slot.
*
* @param dirdev directory or device to unmount
* This only works for Slots that were mounted by rauc.
*
* @param slot Slot to unmount
*
* @return True if succeeded, False if failed
*/
gboolean r_umount(const gchar *dirdev, GError **error);
gboolean r_umount_slot(RaucSlot *slot, GError **error);
9 changes: 9 additions & 0 deletions include/update_handler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <glib.h>

#include "manifest.h"

typedef gboolean (*img_to_fs_handler) (RaucImage *image, RaucSlot *dest_slot, GError **error);

img_to_fs_handler get_update_handler(RaucImage *mfimage, RaucSlot *dest_slot, GError **error);

0 comments on commit e74aea2

Please sign in to comment.