SET(PKG_MODULES ${PKG_MODULES} libinput capi-system-sensor)
ENDIF()
IF(BLOCK_MODULE STREQUAL on)
- SET(PKG_MODULES ${PKG_MODULES} storage app2sd)
+ SET(PKG_MODULES ${PKG_MODULES} storage app2sd blkid)
ENDIF()
IF(TZIP_MODULE STREQUAL on)
SET(PKG_MODULES ${PKG_MODULES} minizip fuse)
#include <tzplatform_config.h>
#include <app2ext_interface.h>
#include <libmount.h>
+#include <blkid/blkid.h>
#include "core/log.h"
#include "core/common.h"
static bool check_primary_partition(const char *devnode)
{
+ struct block_fs_ops *fs;
+ blkid_probe probe;
+ dd_list *elem;
+ const char *filesystem = NULL;
char str[PATH_MAX];
char str2[PATH_MAX];
+ size_t fs_len;
int len;
+ int ret;
int i;
+ bool found = false;
if (fnmatch(MMC_LINK_PATH, devnode, 0) &&
fnmatch(MMC_PATH, devnode, 0) &&
len = strlen(str);
str[len - 1] = '\0';
- for (i = 1; i < 9; ++i) {
+ for (i = 1; i <= 9; ++i) {
snprintf(str2, sizeof(str2), "%s%d", str, i);
- if (access(str2, R_OK) == 0)
- break;
+ if (access(str2, R_OK) != 0)
+ continue;
+
+ probe = blkid_new_probe_from_filename(str2);
+ if (!probe)
+ continue;
+ if (blkid_do_probe(probe) != 0)
+ continue;
+
+ ret = blkid_probe_lookup_value(probe, "TYPE", &filesystem, &fs_len);
+ if (ret < 0) {
+ blkid_free_probe(probe);
+ continue;
+ }
+ DD_LIST_FOREACH(fs_head, elem, fs) {
+ if (!strncmp(fs->name, filesystem, fs_len)) {
+ found = true;
+ break;
+ }
+ }
+ blkid_free_probe(probe);
+ if (!found)
+ continue;
+ break;
}
- if (!strncmp(devnode, str2, strlen(str2) + 1))
+ if (found && !strncmp(devnode, str2, strlen(str2) + 1))
return true;
return false;
return -EPERM;
}
+ if (!block_conf[data->block_type].multimount && !data->primary) {
+ _D("Not support multi mount by config info");
+ return -EPERM;
+ }
+
bdev = make_block_device(data);
if (!bdev) {
_E("fail to make block device for %s", devnode);