Allan Streib <astr...@indiana.edu> wrote:

> Seems like one of those numbers that was chosen long ago, when disks
> had orders of magnitude less storage capacity they have now, and 16
> partitions really would have been more than enough.

the word "chosen" makes it seem like such an arbitrary decision.

As currently written, the partition table must fit in a single sector.

Read disklabel.h and figure out how this part works:

        struct  partition {             /* the partition table */
                u_int32_t p_size;       /* number of sectors (low part) */
                u_int32_t p_offset;     /* starting sector (low part) */
                u_int16_t p_offseth;    /* starting sector (high part) */
                u_int16_t p_sizeh;      /* number of sectors (high part) */
                u_int8_t p_fstype;      /* filesystem type, see below */
                u_int8_t p_fragblock;   /* encoded filesystem frag/block */
                u_int16_t p_cpg;        /* UFS: FS cylinders per group */
        } d_partitions[MAXPARTITIONS];  /* actually may be more */

...

#define DL_GETDSIZE(d)          (((u_int64_t)(d)->d_secperunith << 32) + \
                                    (d)->d_secperunit)
#define DL_SETDSIZE(d, n)       do { \
                                        u_int64_t x = (n); \
                                        (d)->d_secperunith = x >> 32; \
                                        (d)->d_secperunit = x; \
                                } while (0)
#define DL_GETBSTART(d)         (((u_int64_t)(d)->d_bstarth << 32) + \
                                    (d)->d_bstart)
#define DL_SETBSTART(d, n)      do { \
                                        u_int64_t x = (n); \
                                        (d)->d_bstarth = x >> 32; \
                                        (d)->d_bstart = x; \
                                } while (0)


etc etc etc

Long time ago, it was chosen that cars should have 4 wheels.

Reply via email to