NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: bin/57921: swapon: Do not overwrite Linux swap header



i'm confused.  we skip the first PAGE_SIZE bytes on block devices,
ie, any mbr or gpt accessed for this would be a block device.

so netbsd shouldn't overwrite the first 4096 bytes if it sees
this as a partition, not a file.  *files* are used from the first
moment.  see uvm_swap.c:

         * for block special files, we want to make sure that leave
         * the disklabel and bootblocks alone, so we arrange to skip
         * over them (arbitrarily choosing to skip PAGE_SIZE bytes).
         * note that because of this the "size" can be less than the
         * actual number of blocks on the device.
         */
        if (vp->v_type == VBLK) {
                /* we use pages 1 to (size - 1) [inclusive] */
                size = npages - 1;
                addr = 1;
        } else {
                /* we use pages 0 to (size - 1) [inclusive] */
                size = npages;
                addr = 0;

if that's failing some how, we should fix that problem.

i'm OK with better support for linux swap, but it shouldn't need to
create a random wedge to do this.  it should be just workable easily.


.mrg.


Home | Main Index | Thread Index | Old Index