#include <libmount.h>
#include <blkid/blkid.h>
#include <ode/luks.h>
+#include <glib/gstdio.h>
#include "log.h"
#include "config-parser.h"
#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
+#define FILE_NAME_LEN_MAX 255
+
enum block_dev_operation {
BLOCK_DEV_MOUNT,
BLOCK_DEV_UNMOUNT,
bool start_th;
} th_manager[THREAD_MAX];
+char mmc_default_path[][FILE_NAME_LEN_MAX + 1] = {
+ {"Images"},
+ {"Videos"},
+ {"Sounds"},
+ {"Downloads"},
+};
+
+#define DIR_NUM ((int)(sizeof(mmc_default_path)/sizeof(mmc_default_path[0])))
+
static dd_list *fs_head;
static dd_list *block_ops_list;
static bool smack;
return "unknown";
}
+void mmc_make_default_path(const char *mount_path)
+{
+ int i = 0;
+ int ret = 0;
+ char mmc_path[FILE_NAME_LEN_MAX + 1] = {0, };
+
+ for (i = 0; i < DIR_NUM; ++i) {
+ memset(mmc_path, 0, sizeof(mmc_path));
+ snprintf(mmc_path, sizeof(mmc_path), "%s/%s", mount_path, mmc_default_path[i]);
+ if (!g_file_test(mmc_path, G_FILE_TEST_IS_DIR)) {
+ _D("%s path did not exist", mmc_path);
+ ret = mkdir(mmc_path, 0770);
+ if (ret != 0)
+ _E("mkdir failed: %d", errno);
+
+ /*this fuction for emulator*/
+ /*at the first time, the directroies are made permission 755*/
+ ret = chmod(mmc_path, 0770);
+ if (ret != 0)
+ _E("chmod failed: %d", errno);
+ }
+ }
+}
+
static void create_external_apps_directory(void)
{
int ret;
if (pdata.op == BLOCK_DEV_MOUNT &&
pdata.bdev->data->state == BLOCK_MOUNT &&
pdata.bdev->data->block_type == BLOCK_MMC_DEV &&
- pdata.bdev->data->primary)
+ pdata.bdev->data->primary) {
create_external_apps_directory();
+ mmc_make_default_path(pdata.bdev->data->mount_point);
+ }
if (pdata.op == BLOCK_DEV_UNMOUNT) {
/* Remove file for block device /run/xxxxxx/id */
remove_file(pdata.bdev->data->id, pdata.bdev->data->block_type == BLOCK_EXTENDEDSD_DEV);