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