Home | History | Annotate | Download | only in cgpt

Lines Matching full:sector_bytes

65                 const uint64_t sector_bytes,
71 if (!sector_count || !sector_bytes) {
72 Error("%s() failed at line %d: sector_count=%d, sector_bytes=%d\n",
73 __FUNCTION__, __LINE__, sector_count, sector_bytes);
76 /* Make sure that sector_bytes * sector_count doesn't roll over. */
77 if (sector_bytes > (UINT64_MAX / sector_count)) {
78 Error("%s() failed at line %d: sector_count=%d, sector_bytes=%d\n",
79 __FUNCTION__, __LINE__, sector_count, sector_bytes);
82 count = sector_bytes * sector_count;
86 if (-1 == lseek(drive->fd, sector * sector_bytes, SEEK_SET)) {
130 const uint64_t sector_bytes,
136 count = sector_bytes * sector_count;
138 if (-1 == lseek(drive->fd, sector * sector_bytes, SEEK_SET))
148 static int GptLoad(struct drive *drive, uint32_t sector_bytes) {
149 drive->gpt.sector_bytes = sector_bytes;
150 if (drive->size % drive->gpt.sector_bytes) {
152 (long long unsigned int)drive->size, drive->gpt.sector_bytes);
155 drive->gpt.streaming_drive_sectors = drive->size / drive->gpt.sector_bytes;
165 drive->gpt.sector_bytes, GPT_HEADER_SECTORS)) {
171 drive->gpt.sector_bytes, GPT_HEADER_SECTORS)) {
181 drive->gpt.sector_bytes,
195 drive->gpt.sector_bytes,
211 drive->gpt.sector_bytes, GPT_HEADER_SECTORS)) {
220 drive->gpt.sector_bytes, GPT_HEADER_SECTORS)) {
229 drive->gpt.sector_bytes,
239 drive->gpt.sector_bytes,
265 static int ObtainDriveSize(int fd, uint64_t* size, uint32_t* sector_bytes) {
275 if (ioctl(fd, BLKSSZGET, sector_bytes) < 0) {
279 *sector_bytes = 512; /* bytes */
283 *sector_bytes = 512; /* bytes */
291 uint32_t sector_bytes;
309 sector_bytes = 512;
311 if (ObtainDriveSize(drive->fd, &gpt_drive_size, &sector_bytes) != 0) {
317 drive->gpt.gpt_drive_sectors = gpt_drive_size / sector_bytes;
327 if (GptLoad(drive, sector_bytes)) {