Increase line coverage using LCOV_EXCL
[platform/core/system/libstorage.git] / src / storage-inhouse.c
index e0dedc8..b6513af 100755 (executable)
@@ -178,8 +178,10 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
 
        dbus_handle_h dbus_handle = gdbus_get_connection(G_BUS_TYPE_SYSTEM, true);
        if (dbus_handle == NULL) {
+               //LCOV_EXCL_START Dbus error
                _E("Failed to get dbus connection");
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        ret_dbus = gdbus_priv_call_sync_with_reply(dbus_handle,
@@ -206,8 +208,10 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
                        NULL, &reply_mount_point,
                        NULL, NULL,
                        NULL, &reply_id)) {
+               //LCOV_EXCL_START Dbus error
                g_variant_unref(reply);
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_unref(reply);
@@ -220,7 +224,7 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
        *path = strdup(reply_mount_point);
        if (*path == NULL) {
                ret = STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
-               goto out;
+               goto out; //LCOV_EXCL_LINE System Error
        }
 
        *storage_id = reply_id;
@@ -232,6 +236,7 @@ out:
        return ret;
 }
 
+//LCOV_EXCL_START Internal API
 API int storage_get_storage_level(const char *path, char **level)
 {
        int ret_level;
@@ -249,6 +254,7 @@ API int storage_get_storage_level(const char *path, char **level)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP Internal API
 
 //LCOV_EXCL_START Not called callback
 static void mount_mmc_cb(GVariant *var, void *user_data, GError *err)
@@ -275,6 +281,7 @@ exit:
 }
 //LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
 {
        void (*mount_cb)(GVariant *, void *, GError *) = NULL;
@@ -292,10 +299,8 @@ API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
        ret_val = storage_get_primary_sdcard(&id, &path);
        if (ret_val != STORAGE_ERROR_NONE)
                return ret_val;
-//LCOV_EXCL_START System Error
        if (path)
                free(path);
-//LCOV_EXCL_STOP
 
        ret_val = gdbus_call_async_with_reply(STORAGE_EXT_BUS_NAME,
                        STORAGE_EXT_PATH_MANAGER,
@@ -315,6 +320,7 @@ API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP Internal API
 
 //LCOV_EXCL_START Not called callback
 static void unmount_mmc_cb(GVariant *var, void *user_data, GError *err)
@@ -341,6 +347,7 @@ exit:
 }
 //LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
 {
        void (*unmount_cb)(GVariant *, void *, GError *) = NULL;
@@ -361,10 +368,8 @@ API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
        ret_val = storage_get_primary_sdcard(&id, &path);
        if (ret_val != STORAGE_ERROR_NONE)
                return ret_val;
-//LCOV_EXCL_START System Error
        if (path)
                free(path);
-//LCOV_EXCL_STOP
 
        ret_val = gdbus_call_async_with_reply(STORAGE_EXT_BUS_NAME,
                        STORAGE_EXT_PATH_MANAGER,
@@ -384,6 +389,7 @@ API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 //LCOV_EXCL_START Not called callback
 static void format_mmc_cb(GVariant *var, void *user_data, GError *err)
@@ -410,11 +416,14 @@ exit:
 }
 //LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_request_format_mmc(struct mmc_contents *mmc_data)
 {
        return storage_format_mmc(mmc_data, 1);
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
 {
        void (*format_cb)(GVariant *, void *, GError *) = NULL;
@@ -435,10 +444,8 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
        ret_val = storage_get_primary_sdcard(&id, &path);
        if (ret_val != STORAGE_ERROR_NONE)
                return ret_val;
-//LCOV_EXCL_START System Error
        if (path)
                free(path);
-//LCOV_EXCL_STOP
 
        ret_val = gdbus_call_async_with_reply(STORAGE_EXT_BUS_NAME,
                        STORAGE_EXT_PATH_MANAGER,
@@ -458,7 +465,9 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
 {
        blkid_cache cache = NULL;
@@ -535,3 +544,4 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP