Lines Matching refs:part
249 static UINT64 GetFirstPartStart(const los_part *part) in GetFirstPartStart() argument
252 los_disk *disk = get_disk((INT32)part->disk_id); in GetFirstPartStart()
257 static VOID DiskPartAddToDisk(los_disk *disk, los_part *part) in DiskPartAddToDisk() argument
259 part->disk_id = disk->disk_id; in DiskPartAddToDisk()
260 part->part_no_disk = disk->part_count; in DiskPartAddToDisk()
261 LOS_ListTailInsert(&disk->head, &part->list); in DiskPartAddToDisk()
265 static VOID DiskPartDelFromDisk(los_disk *disk, los_part *part) in DiskPartDelFromDisk() argument
267 LOS_ListDelete(&part->list); in DiskPartDelFromDisk()
274 los_part *part = get_part(0); /* traversing from the beginning of the array */ in DiskPartAllocate() local
276 if (part == NULL) { in DiskPartAllocate()
281 if (part->dev == NULL) { in DiskPartAllocate()
282 part->part_id = i; in DiskPartAllocate()
283 part->part_no_mbr = 0; in DiskPartAllocate()
284 part->dev = dev; in DiskPartAllocate()
285 part->sector_start = start; in DiskPartAllocate()
286 part->sector_count = count; in DiskPartAllocate()
287 part->part_name = NULL; in DiskPartAllocate()
288 LOS_ListInit(&part->list); in DiskPartAllocate()
290 return part; in DiskPartAllocate()
292 part++; in DiskPartAllocate()
298 static VOID DiskPartRelease(los_part *part) in DiskPartRelease() argument
300 part->dev = NULL; in DiskPartRelease()
301 part->part_no_disk = 0; in DiskPartRelease()
302 part->part_no_mbr = 0; in DiskPartRelease()
303 if (part->part_name != NULL) { in DiskPartRelease()
304 free(part->part_name); in DiskPartRelease()
305 part->part_name = NULL; in DiskPartRelease()
322 los_part *part = NULL; in DiskAddPart() local
352 part = DiskPartAllocate(partDev, sectorStart, sectorCount); in DiskAddPart()
354 if (part == NULL) { in DiskAddPart()
359 part = DiskPartAllocate(diskDev, sectorStart, sectorCount); in DiskAddPart()
360 if (part == NULL) { in DiskAddPart()
365 DiskPartAddToDisk(disk, part); in DiskAddPart()
367 part->type = EMMC; in DiskAddPart()
369 return (INT32)part->part_id; in DiskAddPart()
377 disk->type = info->part[0].type; in DiskDivide()
379 if (info->sector_count < info->part[i].sector_start) { in DiskDivide()
382 if (info->part[i].sector_count > (info->sector_count - info->part[i].sector_start)) { in DiskDivide()
384 info->part[i].sector_start, info->part[i].sector_count, in DiskDivide()
385 (info->sector_count - info->part[i].sector_start)); in DiskDivide()
386 info->part[i].sector_count = info->sector_count - info->part[i].sector_start; in DiskDivide()
387 PRINT_ERR("Part[%u] sector_count change to %llu.\n", i, info->part[i].sector_count); in DiskDivide()
389 ret = DiskAddPart(disk, info->part[i].sector_start, info->part[i].sector_count, TRUE); in DiskDivide()
395 ret = DiskAddPart(disk, info->part[i].sector_start, info->part[i].sector_count, TRUE); in DiskDivide()
476 info->part[*partitionCount].type = partitionType; in OsGPTPartitionRecognitionSub()
477 info->part[*partitionCount].sector_start = partitionStart; in OsGPTPartitionRecognitionSub()
478 info->part[*partitionCount].sector_count = (partitionEnd - partitionStart) + 1; in OsGPTPartitionRecognitionSub()
639 info->part[i].type = mbrPartitionType; in OsPrimaryPartitionRecognition()
640 …info->part[i].sector_start = LD_DWORD_DISK(&mbrBuf[PAR_OFFSET + PAR_START_OFFSET + (i * PAR_TABLE_… in OsPrimaryPartitionRecognition()
641 …info->part[i].sector_count = LD_DWORD_DISK(&mbrBuf[PAR_OFFSET + PAR_COUNT_OFFSET + (i * PAR_TABLE_… in OsPrimaryPartitionRecognition()
679 info->part[MAX_PRIMARY_PART_PER_DISK + ebrCount].type = ebrPartitionType; in OsLogicalPartitionRecognition()
680 … info->part[MAX_PRIMARY_PART_PER_DISK + ebrCount].sector_start = extendedAddress + extendedOffset + in OsLogicalPartitionRecognition()
683 … info->part[MAX_PRIMARY_PART_PER_DISK + ebrCount].sector_count = LD_DWORD_DISK(&ebrBuf[PAR_OFFSET + in OsLogicalPartitionRecognition()
756 los_part *part = NULL; in DiskPartitionRegister() local
760 (VOID)memset_s(parInfo.part, sizeof(parInfo.part), 0, sizeof(parInfo.part)); in DiskPartitionRegister()
761 partSize = sizeof(parInfo.part) / sizeof(parInfo.part[0]); in DiskPartitionRegister()
767 part = get_part(DiskAddPart(disk, 0, disk->sector_count, FALSE)); in DiskPartitionRegister()
768 if (part == NULL) { in DiskPartitionRegister()
771 part->part_no_mbr = 0; in DiskPartitionRegister()
780 part = get_part(DiskAddPart(disk, 0, disk->sector_count, TRUE)); in DiskPartitionRegister()
781 if (part == NULL) { in DiskPartitionRegister()
784 part->part_no_mbr = 0; in DiskPartitionRegister()
792 if ((parInfo.part[i].type != 0) && (parInfo.part[i].type != EXTENDED_PAR) && in DiskPartitionRegister()
793 (parInfo.part[i].type != EXTENDED_8G)) { in DiskPartitionRegister()
794 …part = get_part(DiskAddPart(disk, parInfo.part[i].sector_start, parInfo.part[i].sector_count, TRUE… in DiskPartitionRegister()
795 if (part == NULL) { in DiskPartitionRegister()
798 part->part_no_mbr = i + 1; in DiskPartitionRegister()
799 part->filesystem_type = parInfo.part[i].type; in DiskPartitionRegister()
1047 const los_part *part = get_part(pt); in los_part_read() local
1051 if (part == NULL) { in los_part_read()
1055 disk = get_disk((INT32)part->disk_id); in los_part_read()
1061 if ((part->dev == NULL) || (disk->disk_status != STAT_INUSED)) { in los_part_read()
1065 if (count > part->sector_count) { in los_part_read()
1071 if (part->type == EMMC) { in los_part_read()
1072 if ((disk->sector_count - part->sector_start) > sector) { in los_part_read()
1073 sector += part->sector_start; in los_part_read()
1080 if ((sector >= GetFirstPartStart(part)) && in los_part_read()
1081 …(((sector + count) > (part->sector_start + part->sector_count)) || (sector < part->sector_start)))… in los_part_read()
1083 … "part->sector_count = %llu\n", sector, count, part->sector_start, part->sector_count); in los_part_read()
1088 ret = los_disk_read((INT32)part->disk_id, buf, sector, count, useRead); in los_part_read()
1103 const los_part *part = get_part(pt); in los_part_write() local
1107 if (part == NULL) { in los_part_write()
1111 disk = get_disk((INT32)part->disk_id); in los_part_write()
1117 if ((part->dev == NULL) || (disk->disk_status != STAT_INUSED)) { in los_part_write()
1121 if (count > part->sector_count) { in los_part_write()
1127 if (part->type == EMMC) { in los_part_write()
1128 if ((disk->sector_count - part->sector_start) > sector) { in los_part_write()
1129 sector += part->sector_start; in los_part_write()
1136 if ((sector >= GetFirstPartStart(part)) && in los_part_write()
1137 …(((sector + count) > (part->sector_start + part->sector_count)) || (sector < part->sector_start)))… in los_part_write()
1139 … "part->sector_count = %llu\n", sector, count, part->sector_start, part->sector_count); in los_part_write()
1143 ret = los_disk_write((INT32)part->disk_id, buf, sector, count); in los_part_write()
1161 los_part *part = get_part(pt); in los_part_ioctl() local
1164 if (part == NULL) { in los_part_ioctl()
1168 disk = get_disk((INT32)part->disk_id); in los_part_ioctl()
1174 if ((part->dev == NULL) || (disk->disk_status != STAT_INUSED)) { in los_part_ioctl()
1189 …struct block_operations *bops = (struct block_operations *)((struct drv_data *)part->dev->data)->o… in los_part_ioctl()
1191 (bops->geometry(part->dev, &info) != 0)) { in los_part_ioctl()
1196 *(UINT64 *)buf = part->sector_count; in los_part_ioctl()
1204 (bops->ioctl(part->dev, GET_ERASE_BLOCK_SIZE, (UINTPTR)buf) != 0)) { in los_part_ioctl()
1223 los_part *part = get_part(drvID); in los_disk_cache_clear() local
1226 if (part == NULL) { in los_disk_cache_clear()
1229 result = OsSdSync(part->disk_id); in los_disk_cache_clear()
1235 disk = get_disk(part->disk_id); in los_disk_cache_clear()
1367 los_part *part = NULL; in DiskDeinit() local
1373 part = LOS_DL_LIST_ENTRY(disk->head.pstNext, los_part, list); in DiskDeinit()
1374 while (&part->list != &disk->head) { in DiskDeinit()
1381 DiskPartDelFromDisk(disk, part); in DiskDeinit()
1383 DiskPartRelease(part); in DiskDeinit()
1385 part = LOS_DL_LIST_ENTRY(disk->head.pstNext, los_part, list); in DiskDeinit()
1623 los_part *part = NULL; in OsPartFind() local
1629 part = LOS_DL_LIST_ENTRY(disk->head.pstNext, los_part, list); in OsPartFind()
1634 while (&part->list != &disk->head) { in OsPartFind()
1635 if (part->dev == blkDriver) { in OsPartFind()
1638 part = LOS_DL_LIST_ENTRY(part->list.pstNext, los_part, list); in OsPartFind()
1640 part = NULL; in OsPartFind()
1644 return part; in OsPartFind()
1651 los_part *part = NULL; in los_part_find() local
1662 part = OsPartFind(disk, blkDriver); in los_part_find()
1663 if (part != NULL) { in los_part_find()
1664 return part; in los_part_find()
1673 los_part *part = NULL; in los_part_access() local
1682 part = los_part_find(node); in los_part_access()
1684 if (part == NULL) { in los_part_access()
1691 INT32 SetDiskPartName(los_part *part, const CHAR *src) in SetDiskPartName() argument
1696 if ((part == NULL) || (src == NULL)) { in SetDiskPartName()
1705 disk = get_disk((INT32)part->disk_id); in SetDiskPartName()
1715 part->part_name = (CHAR *)zalloc(len + 1); in SetDiskPartName()
1716 if (part->part_name == NULL) { in SetDiskPartName()
1721 if (strcpy_s(part->part_name, len + 1, src) != EOK) { in SetDiskPartName()
1722 free(part->part_name); in SetDiskPartName()
1723 part->part_name = NULL; in SetDiskPartName()
1753 if (sectorStart < (info->part[i].sector_start + info->part[i].sector_count)) { in add_mmc_partition()
1758 info->part[index].sector_start = sectorStart; in add_mmc_partition()
1759 info->part[index].sector_count = sectorCount; in add_mmc_partition()
1760 info->part[index].type = EMMC; in add_mmc_partition()
1766 VOID show_part(los_part *part) in show_part() argument
1768 if ((part == NULL) || (part->dev == NULL)) { in show_part()
1774 PRINTK("disk id : %u\n", part->disk_id); in show_part()
1775 PRINTK("part_id in system: %u\n", part->part_id); in show_part()
1776 PRINTK("part no in disk : %u\n", part->part_no_disk); in show_part()
1777 PRINTK("part no in mbr : %u\n", part->part_no_mbr); in show_part()
1778 PRINTK("part filesystem : %02X\n", part->filesystem_type); in show_part()
1779 PRINTK("part sec start : %llu\n", part->sector_start); in show_part()
1780 PRINTK("part sec count : %llu\n", part->sector_count); in show_part()