DragonFlyBSD/src 0c27d85sys/kern vfs_vnops.c, sys/sys vnode.h

sys/vfs/{ext2fs,ufs}: Add SEEK_HOLE / SEEK_DATA support

Add VOP_BMAP based generic function vn_bmap_seekhole()
for filesystems with .vop_bmap to support SEEK_HOLE / SEEK_DATA.

FreeBSD has optimized version of FIOSEEKDATA for ext2 and ufs,
but this commit only brings in generic version for both.

taken-from: FreeBSD
DeltaFile
+77-0sys/kern/vfs_vnops.c
+38-1sys/vfs/ufs/ufs_vnops.c
+15-0sys/vfs/ext2fs/ext2_vnops.c
+5-0sys/sys/vnode.h
+135-14 files

DragonFlyBSD/src 128dc99lib/libc/sys lseek.2 pathconf.2, sys/kern vfs_default.c vfs_vnops.c

sys/kern: Add SEEK_HOLE / SEEK_DATA support

No filesystem implements SEEK_HOLE / SEEK_DATA yet.

Filesystems with no .vop_ioctl implementation (e.g. ufs, ext2)
use vop_stdioctl() which simply returns EOF for SEEK_HOLE.
Others usually return EOPNOTSUPP, ENOTTY, etc, depending on what
they have for "default" in a switch case.

taken-from: FreeBSD
DeltaFile
+69-1lib/libc/sys/lseek.2
+37-1sys/kern/vfs_default.c
+19-0sys/kern/vfs_vnops.c
+12-0lib/libc/sys/pathconf.2
+3-0sys/sys/filio.h
+1-0sys/sys/vnode.h
+141-26 files

DragonFlyBSD/src 17078aclib/libefivar Makefile, sbin/gpt gpt.c

libefivar(3): Fix building

This reverts commit e6e12d327e486626dfee68e686362b79a31ea17f and partly
reverts commit 1de074ab63177fef2205996d85e45536042d8891.

TODO: figure out a better way to share code between libefivar(3) and gpt(8).
DeltaFile
+3-3lib/libefivar/Makefile
+2-0sbin/gpt/gpt.c
+5-32 files

DragonFlyBSD/src 0d52b42sbin/gpt gpt.8

gpt(8): Multiple minor improvements/tweaks/fixes to the man page
DeltaFile
+41-32sbin/gpt/gpt.8
+41-321 files

DragonFlyBSD/src 1de074alib/libefivar efivar-dp-xlate.c Makefile

libefivar(3): Fix build by using uuid_dec_le() from libc

It was using le_uuid_dec() from source of gpt(8).  As a result, this
library no longer depends on the 'gpt.c' file from gpt(8).

While there, fix a typo in comment (taken from FreeBSD).
DeltaFile
+4-3lib/libefivar/efivar-dp-xlate.c
+3-3lib/libefivar/Makefile
+7-62 files

DragonFlyBSD/src 2259d95sys/dev/disk/ccd ccd.c, sys/dev/disk/fd fd.c

kernel: Remove obsolete DSO_COMPATMBR from <sys/disk.h>

The last use of this flag was removed in commit
1c3c151b5fca37695bf972f959efb7dda16cfbe6, so this flag has become
effectively obsolete since then.  Now just remove it to reduce any
confusion.

ok by dillon.
DeltaFile
+29-36sys/dev/disk/ccd/ccd.c
+19-19sys/dev/disk/fd/fd.c
+11-19sys/dev/disk/vn/vn.c
+6-9sys/sys/disk.h
+2-1sys/sys/param.h
+67-845 files

DragonFlyBSD/src d69b4edsys/kern subr_diskmbr.c, sys/sys diskmbr.h

kernel: Clean up DOSPTYP_* defines in subr_diskmbr.c

* Move DOSPTYP_ONTRACK to <sys/diskmbr.h> where other DOSPTYP_* defines
  are located.
* Remove DOSPTYP_{EXTENDED,EXTENDEDX} and use DOSPTYP_{EXT,EXTLBA} from
  <sys/diskmbr.h> instead.
DeltaFile
+4-7sys/kern/subr_diskmbr.c
+1-0sys/sys/diskmbr.h
+5-72 files

DragonFlyBSD/src e6e12d3sbin/gpt gpt.c

gpt(8): Remove now obsolete "#ifndef _LIBEFIVAR"
DeltaFile
+0-2sbin/gpt/gpt.c
+0-21 files

DragonFlyBSD/src aac9c1fsbin/gpt show.c

gpt(8): Improve "show" command to print humanized size of partitions

Before:
Disk da0: 50.0GB (104857600 512-byte sectors)
      start       size  index  contents
          0          1      -  PMBR
          1          1      -  Pri GPT header
          2         32      -  Pri GPT table
         34       2014      -  Unused
       2048     262144      0  GPT part - EFI System
     264192  104591360      1  GPT part - DragonFly Label64
  104855552       2015      -  Unused
  104857567         32      -  Sec GPT table
  104857599          1      -  Sec GPT header

After:
Disk da0: 50.0GB (104857600 512-byte sectors)
      Start    Sectors    Size  Index  Contents
          0          1    512B      -  PMBR

    [8 lines not shown]
DeltaFile
+8-3sbin/gpt/show.c
+8-31 files

DragonFlyBSD/src fbe16f5sbin/gpt gpt.c migrate.c

gpt(8): Use uuid_{enc,dec}_le() from libc

See also uuid(3) man page.
DeltaFile
+1-33sbin/gpt/gpt.c
+7-7sbin/gpt/migrate.c
+2-2sbin/gpt/create.c
+2-2sbin/gpt/add.c
+2-2sbin/gpt/boot.c
+2-2sbin/gpt/show.c
+16-483 files not shown
+18-529 files

DragonFlyBSD/src 6452090sbin/gpt gpt.c gpt.8

gpt(8): Refactor parse_uuid() and support more GPT type aliases

Refactor parse_uuid() to parse GPT type aliases by using an array.
Meanwhile, extend it to support more GPT type aliases, which are defined
in <sys/gpt.h> as well as "/etc/defaults/uuids".
DeltaFile
+53-58sbin/gpt/gpt.c
+80-17sbin/gpt/gpt.8
+133-752 files

DragonFlyBSD/src 4b2df40sys/sys gpt.h

<sys/gpt.h>: Small tweaks

* Reorder the DragonFly entries.
* Move the GPT_ENT_TYPE_PREP_BOOT out of the FreeBSD group; it's used by
  the boot partition on some PowerPC systems.
* Remove obsolete description on Linux reusing the
  GPT_ENT_TYPE_MS_BASIC_DATA entry.
DeltaFile
+13-17sys/sys/gpt.h
+13-171 files

DragonFlyBSD/src c7b4313lib/libc/uuid uuid.3

uuid(3): Improve the description for uuid_to_string()

Document that uuid_to_string() will allocate a buffer to hold the
converted string and free(3) should be called to release the memory.

Several more minor tweaks.

Derived from FreeBSD.
DeltaFile
+16-7lib/libc/uuid/uuid.3
+16-71 files

DragonFlyBSD/src b81eabdetc/defaults uuids

etc: Sync entries from <sys/gpt.h>

Some of the GPT type names are derived from FreeBSD's gpart(8) man page.
DeltaFile
+60-11etc/defaults/uuids
+60-111 files

DragonFlyBSD/src ea9e56bsbin/gpt show.c Makefile

gpt(8): Improve "show" command to print a disk summary line

Before print the partition entries, print a disk summary line like:
"Disk /dev/da0: 50.0GB (104857600 512-byte sectors)".

In addition, add a blank line between disks.

Example new output:
```
$ sudo gpt show /dev/da0 ad0
Disk /dev/da0: 50.0GB (104857600 512-byte sectors)
      start       size  index  contents
          0          1      -  PMBR
          1          1      -  Pri GPT header
          2         32      -  Pri GPT table
         34       2014      -  Unused
       2048     262144      0  GPT part - EFI System
     264192  104591360      1  GPT part - DragonFly Label64
  104855552       2015      -  Unused

    [14 lines not shown]
DeltaFile
+12-6sbin/gpt/show.c
+3-1sbin/gpt/Makefile
+15-72 files

DragonFlyBSD/src 6fb1032sbin/fdisk fdisk.c

fdisk(8): Support 4096 sector size and recognize pMBR of 4Kn disks

Tweak the fdisk(8) utility to support 4096-byte sector size, so it now
can read the pMBR on GPT-formatted 4Kn (aka 4K native) disks, e.g.,

     # fdisk -s vbd0
     /dev/vbd0: 14628 cyl 16 hd 56 sec
     Part        Start        Size Type Flags
        1:           1    13107199 0xee 0x00

In addition, tweak read_disk() to report the read error message.
DeltaFile
+6-4sbin/fdisk/fdisk.c
+6-41 files

DragonFlyBSD/src 166e3a7sbin/fdisk fdisk.c

fdisk(8): Styles and cleanups (no functional change)
DeltaFile
+668-732sbin/fdisk/fdisk.c
+668-7321 files

DragonFlyBSD/src 3547abbsbin/fdisk fdisk.c fdisk.8

fdisk(8): Sync TRIM behavior with gpt(8) and clean up code

The TRIM feature is enabled by default in kernel now, so let fdisk(8)
continue the operation if TRIM if the device doesn't support it, similar
to gpt(8).

Update the man page accordingly.
DeltaFile
+11-33sbin/fdisk/fdisk.c
+3-5sbin/fdisk/fdisk.8
+14-382 files

DragonFlyBSD/src e555453sbin/fdisk fdisk.8 fdisk.c

fdisk(8): Add "vbd0" to search list and order "da0" before "ad0"

The virtio_blk(4) device is now very common, so worth adding it to the
search list.

In addition, order "da0" before "ad0" as SATA/SCSI is much more common
than ATA/IDE.
DeltaFile
+3-2sbin/fdisk/fdisk.8
+1-1sbin/fdisk/fdisk.c
+4-32 files

DragonFlyBSD/src 54d7118nrelease/root/etc rc.conf

nrelease: Don't disable syslogd in live CD/USB

We're mounting a tmpfs at /var, so it's okay to write under /var/log.
Don't disable syslogd so that it could write the log files that might
be helpful.
DeltaFile
+0-1nrelease/root/etc/rc.conf
+0-11 files

DragonFlyBSD/src e6e85basbin/fdisk fdisk.c

fdisk(8): Calculate ncylinders and warn about mismatch

The virtio_blk(4) disk driver was directly reporting the ncylinders
parameter specified by the QEMU emulator, which however is capped at
16383 (the legacy MBR maximum).  That confused fdisk(8) to recognize the
disk to have only ~8GB size instead of the full capacity.

The issue virtio_blk(4) has been fixed in a former commit.  This commit
improve fdisk(8) by calculating the ncylinders on its own and comparing
it with the one provided by the disk.  If there is a mismatch, emit a
warning message to remind a fix to the disk driver.

Derived from the patch submitted by mikdusan in bug #3369.

Bug: https://bugs.dragonflybsd.org/issues/3369
DeltaFile
+7-1sbin/fdisk/fdisk.c
+7-11 files

DragonFlyBSD/src 3d51ed7sys/dev/virtual/virtio/block virtio_blk.c

virtio/block: Fix media_blksize and media_blocks calculation

* Correctly report the media block size instead of hardcoded 512.

* Fix the bug in calculating the media blocks.
DeltaFile
+4-4sys/dev/virtual/virtio/block/virtio_blk.c
+4-41 files

DragonFlyBSD/src b42b35csbin/fdisk fdisk.c

fdisk(8): Clear errno in read_disk() to avoid confusing others

For example, even read_disk() succeeded in detecting the sector size and
reading, the errno would remain EIO, which could confuse the later code
that calls err() or others.
DeltaFile
+1-0sbin/fdisk/fdisk.c
+1-01 files

DragonFlyBSD/src 0185730sys/dev/virtual/virtio/block virtio_blk.c

virtio/block: Improve the log to also print sector size
DeltaFile
+5-4sys/dev/virtual/virtio/block/virtio_blk.c
+5-41 files

DragonFlyBSD/src 6e0947fsbin/fdisk fdisk.c

fdisk(8): Improve summary show of unintialized disk

For an unintialized disk, "fdisk -s" would simply exit an error without
printing any useful information, e.g.,

        # fdisk -s vbd0
        fdisk: invalid fdisk partition table found
        fdisk: read_s0: Undefined error: 0

This change makes "fdisk -s" print the geometry of the disk before
exiting.  In addition, check the "errno" value to avoid the confusing
"read_s0: Undefined error: 0" message.

Derived from the patch submitted by mikdusan in bug #3369.

Bug: https://bugs.dragonflybsd.org/issues/3369
DeltaFile
+6-2sbin/fdisk/fdisk.c
+6-21 files

DragonFlyBSD/src 07312d4sbin/fdisk fdisk.c

fdisk(8): Clear errno in read_disk() to avoid confusing others

For example, even read_disk() succeeded in detecting the sector size and
reading, the errno would remain EIO, which could confuse the later code
that calls err() or others.
DeltaFile
+1-0sbin/fdisk/fdisk.c
+1-01 files

DragonFlyBSD/src 9c6513csbin/fdisk fdisk.8 fdisk.c

fdisk(8): Add "vbd0" to search list and order "da0" before "ad0"

The virtio_blk(4) device is now very common, so worth adding it to the
search list.

In addition, order "da0" before "ad0" as SATA/SCSI is much more common
than ATA/IDE.
DeltaFile
+3-2sbin/fdisk/fdisk.8
+1-1sbin/fdisk/fdisk.c
+4-32 files

DragonFlyBSD/src 432f4dcnrelease/root/etc rc.conf

nrelease: Don't disable syslogd in live CD/USB

We're mounting a tmpfs at /var, so it's okay to write under /var/log.
Don't disable syslogd so that it could write the log files that might
be helpful.
DeltaFile
+0-1nrelease/root/etc/rc.conf
+0-11 files

DragonFlyBSD/src d06ed68sbin/fdisk fdisk.c fdisk.8

fdisk(8): Sync TRIM behavior with gpt(8) and clean up code

The TRIM feature is enabled by default in kernel now, so let fdisk(8)
continue the operation if TRIM if the device doesn't support it, similar
to gpt(8).

Update the man page accordingly.
DeltaFile
+11-33sbin/fdisk/fdisk.c
+3-5sbin/fdisk/fdisk.8
+14-382 files

DragonFlyBSD/src 892d09dsbin/fdisk fdisk.c

fdisk(8): Calculate ncylinders and warn about mismatch

The virtio_blk(4) disk driver was directly reporting the ncylinders
parameter specified by the QEMU emulator, which however is capped at
16383 (the legacy MBR maximum).  That confused fdisk(8) to recognize the
disk to have only ~8GB size instead of the full capacity.

The issue virtio_blk(4) has been fixed in a former commit.  This commit
improve fdisk(8) by calculating the ncylinders on its own and comparing
it with the one provided by the disk.  If there is a mismatch, emit a
warning message to remind a fix to the disk driver.

Derived from the patch submitted by mikdusan in bug #3369.

Bug: https://bugs.dragonflybsd.org/issues/3369
DeltaFile
+7-1sbin/fdisk/fdisk.c
+7-11 files