Lines Matching refs:item
86 const SUPPORTED_FILE_SYSTEM *item = GetSupportedFileSystemInfo(fsType);
87 if (item == NULL) {
90 if (item->for_userdata) {
98 const SUPPORTED_FILE_SYSTEM *item = GetSupportedFileSystemInfo(fsType);
99 if (item == NULL) {
259 // Second item in /proc/mounts is mount point
451 static int DoMountOneItem(FstabItem *item)
453 BEGET_LOGI("Mount device %s to %s", item->deviceName, item->mountPoint);
457 mountFlags = GetMountFlags(item->mountOptions, fsSpecificData, sizeof(fsSpecificData),
458 item->mountPoint);
463 rc = Mount(item->deviceName, item->mountPoint, item->fsType, mountFlags, fsSpecificData);
468 if (FM_MANAGER_FORMATTABLE_ENABLED(item->fsManagerFlags)) {
470 int ret = DoFormat(item->deviceName, item->fsType);
475 rc = Mount(item->deviceName, item->mountPoint, item->fsType, mountFlags, fsSpecificData);
480 BEGET_LOGE("Mount device %s to %s failed, err = %d, retry", item->deviceName, item->mountPoint, errno);
486 static int MountItemByFsType(FstabItem *item)
488 if (CheckIsErofs(item->deviceName)) {
489 if (strcmp(item->fsType, "erofs") == 0) {
491 return DoMountOverlayDevice(item);
493 int rc = DoMountOneItem(item);
494 if (rc == 0 && strcmp(item->mountPoint, "/usr") == 0) {
499 BEGET_LOGI("fsType not erofs system, device [%s] skip erofs mount process", item->deviceName);
504 if (strcmp(item->fsType, "erofs") != 0) {
505 int rc = DoMountOneItem(item);
506 if (rc == 0 && strcmp(item->mountPoint, "/usr") == 0) {
512 BEGET_LOGI("fsType is erofs system, device [%s] skip ext4 or hms mount process", item->deviceName);
517 int MountOneItem(FstabItem *item)
519 if (item == NULL) {
523 if (FM_MANAGER_WAIT_ENABLED(item->fsManagerFlags)) {
524 WaitForFile(item->deviceName, WAIT_MAX_SECOND);
527 if (strcmp(item->mountPoint, "/data") == 0 && IsSupportedDataType(item->fsType)) {
528 int ret = DoResizeF2fs(item->deviceName, 0, item->fsManagerFlags);
530 BEGET_LOGE("Failed to resize.f2fs dir %s , ret = %d", item->deviceName, ret);
533 ret = DoFsckF2fs(item->deviceName);
535 BEGET_LOGE("Failed to fsck.f2fs dir %s , ret = %d", item->deviceName, ret);
537 } else if (strcmp(item->fsType, "ext4") == 0 && strcmp(item->mountPoint, "/data") == 0) {
538 int ret = DoResizeExt(item->deviceName, 0);
540 BEGET_LOGE("Failed to resize2fs dir %s , ret = %d", item->deviceName, ret);
542 ret = DoFsckExt(item->deviceName);
544 BEGET_LOGE("Failed to e2fsck dir %s , ret = %d", item->deviceName, ret);
550 rc = MountItemByFsType(item);
552 rc = DoMountOneItem(item);
553 if (rc == 0 && (strcmp(item->mountPoint, "/usr") == 0)) {
557 InitPostMount(item->mountPoint, rc);
559 if (FM_MANAGER_NOFAIL_ENABLED(item->fsManagerFlags)) {
560 BEGET_LOGE("Mount no fail device %s to %s failed, err = %d", item->deviceName, item->mountPoint, errno);
562 BEGET_LOGW("Mount %s to %s failed, err = %d. Ignore failure", item->deviceName, item->mountPoint, errno);
566 BEGET_LOGI("Mount %s to %s successful", item->deviceName, item->mountPoint);
572 static bool NeedDmVerity(FstabItem *item)
574 if (CheckIsErofs(item->deviceName)) {
575 if (strcmp(item->fsType, "erofs") == 0) {
579 if (strcmp(item->fsType, "erofs") != 0) {
587 static void AdjustPartitionNameByPartitionSlot(FstabItem *item)
589 BEGET_CHECK_ONLY_RETURN(strstr(item->deviceName, "/system") != NULL ||
590 strstr(item->deviceName, "/vendor") != NULL);
594 BEGET_ERROR_CHECK(sprintf_s(buffer, sizeof(buffer), "%s_%c", item->deviceName, 'a' + slot - 1) > 0,
596 free(item->deviceName);
597 item->deviceName = strdup(buffer);
598 if (item->deviceName == NULL) {
602 BEGET_LOGI("partition name with slot suffix: %s", item->deviceName);
605 static int CheckRequiredAndMount(FstabItem *item, bool required)
608 if (item == NULL) {
614 if (!FM_MANAGER_REQUIRED_ENABLED(item->fsManagerFlags)) {
615 rc = MountOneItem(item);
621 if (FM_MANAGER_REQUIRED_ENABLED(item->fsManagerFlags)) {
623 BEGET_INFO_CHECK(bootSlots <= 1, AdjustPartitionNameByPartitionSlot(item),
627 if (!NeedDmVerity(item)) {
628 BEGET_LOGI("not need dm verity, do mount item %s", item->deviceName);
629 return MountOneItem(item);
632 rc = HvbDmVeritySetUp(item);
635 if (!FM_MANAGER_NOFAIL_ENABLED(item->fsManagerFlags)) {
637 BEGET_LOGW("DmVeritySetUp fail for %s, ignore error and do not mount", item->deviceName);
639 BEGET_LOGE("DmVeritySetUp fail for no fail devices %s, error!", item->deviceName);
644 rc = MountOneItem(item);
653 FstabItem *item = NULL;
666 for (item = fstab->head; item != NULL; item = item->next) {
667 rc = CheckRequiredAndMount(item, required);
710 FstabItem *item = NULL;
712 for (item = fstab->head; item != NULL; item = item->next) {
713 BEGET_LOGI("Umount %s.", item->mountPoint);
714 MountStatus status = GetMountStatusForMountPoint(item->mountPoint);
716 BEGET_LOGW("Cannot get mount status of mount point \" %s \"", item->mountPoint);
720 item->mountPoint, item->deviceName, item->fsType);
723 rc = umount(item->mountPoint);
726 item->mountPoint, item->deviceName, item->fsType, errno);
728 BEGET_LOGE("Umount %s successfully.", item->mountPoint);
754 FstabItem *item = NULL;
767 for (item = fstab->head; item != NULL; item = item->next) {
768 if (strcmp(item->mountPoint, devName) == 0) {
769 rc = CheckRequiredAndMount(item, required);