#define alignment_required (grain != sector_size)
struct pte ptes[MAXIMUM_PARTS];
-unsigned long long extended_offset;
+sector_t extended_offset;
int ext_index;
static int get_nonexisting_partition(int warn, int max)
/* Allocate a buffer and read a partition table sector */
-static void read_pte(struct fdisk_context *cxt, int pno, unsigned long long offset)
+static void read_pte(struct fdisk_context *cxt, int pno, sector_t offset)
{
struct pte *pe = &ptes[pno];
t == 0xc1 || t == 0xc4 || t == 0xc6);
}
-static void set_partition(int i, int doext, unsigned long long start,
- unsigned long long stop, int sysid)
+static void set_partition(int i, int doext, sector_t start,
+ sector_t stop, int sysid)
{
struct partition *p;
- unsigned long long offset;
+ sector_t offset;
if (doext) {
p = ptes[i].ext_pointer;
ptes[i].changed = 1;
}
-static unsigned long long get_unused_start(int part_n,
- unsigned long long start,
- unsigned long long first[],
- unsigned long long last[])
+static sector_t get_unused_start(int part_n, sector_t start,
+ sector_t first[], sector_t last[])
{
int i;
for (i = 0; i < partitions; i++) {
- unsigned long long lastplusoff;
+ sector_t lastplusoff;
if (start == ptes[i].offset)
start += sector_offset;
return start;
}
-static unsigned long long align_lba_in_range( unsigned long long lba,
- unsigned long long start,
- unsigned long long stop)
+static sector_t align_lba_in_range(sector_t lba, sector_t start, sector_t stop)
{
start = align_lba(start, ALIGN_UP);
stop = align_lba(stop, ALIGN_DOWN);
int i, read = 0;
struct partition *p = ptes[n].part_table;
struct partition *q = ptes[ext_index].part_table;
- unsigned long long start, stop = 0, limit, temp,
+ sector_t start, stop = 0, limit, temp,
first[partitions], last[partitions];
if (p && p->sys_ind) {
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
do {
- unsigned long long dflt, aligned;
+ sector_t dflt, aligned;
temp = start;
dflt = start = get_unused_start(n, start, first, last);
read = 0;
}
if (!read && start == temp) {
- unsigned long long i = start;
+ sector_t i = start;
start = read_int(cround(i), cround(dflt), cround(limit),
0, mesg);
struct partition *part_table; /* points into sectorbuffer */
struct partition *ext_pointer; /* points into sectorbuffer */
char changed; /* boolean */
- unsigned long long offset; /* disk sector number */
+ sector_t offset; /* disk sector number */
unsigned char *sectorbuffer; /* disk sector contents */
};
(n) * sizeof(struct partition)))
extern int ext_index; /* the prime extended partition */
-extern unsigned long long extended_offset, sector_offset;
+extern sector_t extended_offset, sector_offset;
static inline void write_part_table_flag(unsigned char *b)
{
return ((unsigned int) b[510]) + (((unsigned int) b[511]) << 8);
}
-static inline unsigned long long get_partition_start(struct pte *pe)
+static inline sector_t get_partition_start(struct pte *pe)
{
return pe->offset + get_start_sect(pe->part_table);
}