Lines Matching defs:part
39 static int BlkpgPartCommand(const Partition &part, struct blkpg_partition &pg, int op)
49 ret = ioctl(part.partfd, BLKPG, &args);
52 LOG(ERROR) << "ioctl of partition " << part.partName << " with operation " << op << " failed";
57 static int DoUmountDiskPartition(const Partition &part)
59 std::string partName = std::string("/") + part.partName;
90 static int BlkpgRemovePartition(const Partition &part)
96 blkPart.pno = part.partNum;
97 return BlkpgPartCommand(part, blkPart, BLKPG_DEL_PARTITION);
121 Partition *part = nullptr;
122 part = GetPartition(disk, partn);
123 if (part == nullptr) {
131 part->partfd = disk.dev->fd;
132 int ret = BlkpgRemovePartition(*part);
133 part->partfd = -1;
135 LOG(ERROR) << "Delete part failed";
141 static int BlkpgAddPartition(Partition &part)
147 blkPart.start = static_cast<long long>(part.start * SECTOR_SIZE_DEFAULT);
149 blkPart.length = static_cast<long long>(part.length * SECTOR_SIZE_DEFAULT);
151 blkPart.pno = part.partNum;
153 if (strncpy_s(blkPart.devname, BLKPG_DEVNAMELTH, part.devName.c_str(), part.devName.size()) != EOK) {
157 if (strncpy_s(blkPart.volname, BLKPG_VOLNAMELTH, part.partName.c_str(), part.partName.size()) != EOK) {
161 if (BlkpgPartCommand(part, blkPart, BLKPG_ADD_PARTITION) < 0) {
167 static bool DoAddPartition(const Disk &disk, Partition &part)
173 part.partfd = disk.dev->fd;
174 int ret = BlkpgAddPartition(part);
175 part.partfd = -1;