History log of /freebsd/stand/common/disk.c (Results 1 – 25 of 33)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 3e15b01d 22-Feb-2024 Warner Losh <imp@FreeBSD.org>

libsa: Remove redundant sys/cdefs.h

Sponsored by: Netflix


Revision tags: release/14.0.0
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


Revision tags: release/13.2.0
# 33bbe5dd 30-Nov-2022 Warner Losh <imp@FreeBSD.org>

stand: parsedev API change: devspec now points to start of full device name

To support more flexible device matching, we now pass in the full
devspec to the parsedev routines. For everything execpt

stand: parsedev API change: devspec now points to start of full device name

To support more flexible device matching, we now pass in the full
devspec to the parsedev routines. For everything execpt uboot, this is
just a drop in (since everything except uboot and openfirmware always
uses disk...: and/or zfs:, but openfirmware isn't really affected).

uboot we kludge around it by subtracting 4 from where the rest of the
device name starts. This is unforunate, and can compute the address one
before the string. But we never dereference that address. uboot needs
more work, and this is an acceptable UB until that other work happens.

OFW doesn't really use the parsedev routines these days (since none of
the supported device uses this... yet). It too needs more work, but it
needs device matching support first.

Sponsored by: Netflix
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D37553

show more ...


# 17276525 30-Nov-2022 Warner Losh <imp@FreeBSD.org>

stand: Change disk_parsedev() API

Change the first argument to disk_parsedev() to be a pointer to a struct
devdesc *. This now gets filled in with a malloc'd structure that's
returned to the caller

stand: Change disk_parsedev() API

Change the first argument to disk_parsedev() to be a pointer to a struct
devdesc *. This now gets filled in with a malloc'd structure that's
returned to the caller that the caller is repsonsible for freeing. Most
places in the tree passed in a malloc'd pointer anyway, and this moves
knowledge of disk_devdesc more firmly into the disk.[ch] code.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37335

show more ...


Revision tags: release/12.4.0
# c32dde31 11-Aug-2022 Warner Losh <imp@FreeBSD.org>

stand: Change disk_fmtdev to take a struct devdesc *

We do a number of games with ploymorphism for different types struct
*devdesc. Adjust one place that this affects to take the address of the
base

stand: Change disk_fmtdev to take a struct devdesc *

We do a number of games with ploymorphism for different types struct
*devdesc. Adjust one place that this affects to take the address of the
base class (most others have void * at the moment). This is more type
safe than a bare void *.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35914

show more ...


# 865a58d2 25-Jul-2022 Warner Losh <imp@FreeBSD.org>

stand/disk: Trivial formatting nit

style(9) wants a space here.

Sponsored by: Netflix


Revision tags: release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0
# e532a999 20-Jun-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @349234

Sponsored by: The FreeBSD Foundation


# ed29b75c 06-Jun-2019 Toomas Soome <tsoome@FreeBSD.org>

loader: disk_open() should honor D_PARTNONE

The D_PARTNONE is documented to make it possible to open raw MBR
partition, but the current disk_open() does not really implement this
statement.

The cur

loader: disk_open() should honor D_PARTNONE

The D_PARTNONE is documented to make it possible to open raw MBR
partition, but the current disk_open() does not really implement this
statement.

The current code is checking partition against -1 (D_PARTNONE) but does
attempt to open partition table in case we do have FreeBSD MBR partition type.
Instead, we should check -2 (D_PARTWILD).

In case we do have MBR + BSD label, this code is only working because
by default, the first BSD partiton is created starting with relative sector
0, and we can still access the BSD table from that MBR slice.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20501

show more ...


# 7648bc9f 13-May-2019 Alan Somers <asomers@FreeBSD.org>

MFHead @347527

Sponsored by: The FreeBSD Foundation


# 82c29d4f 09-May-2019 Toomas Soome <tsoome@FreeBSD.org>

loader: use DPRINTF in biosdisk.c and define safe DPRINTF

r345066 did miss biosdisk.c.

Also define DPRINTF as ((void)0) for case we do not want debug printouts.

MFC after: 1 week


# 41a1c642 09-May-2019 Toomas Soome <tsoome@FreeBSD.org>

loader: ptable_print() needs two tabs sometimes

Since the partition/slice names do vary in length, check the length
of the fixed part of the line against 3 * 8, if the lenth is less than
3 tab stops

loader: ptable_print() needs two tabs sometimes

Since the partition/slice names do vary in length, check the length
of the fixed part of the line against 3 * 8, if the lenth is less than
3 tab stops, print out extra tab.

use snprintf() instead of sprintf.

show more ...


# 15f5e297 05-May-2019 Toomas Soome <tsoome@FreeBSD.org>

loader: validate sectorsize argument in disk_open()

The bug and patch is reported against 11.2, but it is good idea to have
the check in place for all versions.

PR: 236585
Submitted by: john@feith

loader: validate sectorsize argument in disk_open()

The bug and patch is reported against 11.2, but it is good idea to have
the check in place for all versions.

PR: 236585
Submitted by: john@feith.com
Reported by: john@feith.com
MFC after: 1 day

show more ...


# fa4b8179 01-May-2019 Warner Losh <imp@FreeBSD.org>

Use D_PARTISGPT rather than bare 255

These three cases dovetail with other places in the code where we use
or set D_PARTISGPT when we mean that the partitioning scheme is
GPT. Use this #define to ma

Use D_PARTISGPT rather than bare 255

These three cases dovetail with other places in the code where we use
or set D_PARTISGPT when we mean that the partitioning scheme is
GPT. Use this #define to make the code easier to undertand.

Reviewed by: tsoome@
Differential Revision: https://reviews.freebsd.org/D20122

show more ...


# e77f4eb2 25-Apr-2019 Ian Lepore <ian@FreeBSD.org>

Restore the ability to open a raw disk or partition in loader(8).

The disk_open() function searches for "the best partition" when slice and
partition information is not provided as part of the devic

Restore the ability to open a raw disk or partition in loader(8).

The disk_open() function searches for "the best partition" when slice and
partition information is not provided as part of the device name. As of
r345477 the slice and partition fields of a disk_devdesc are initialized to
D_SLICEWILD and D_PARTWILD; in the past they were initialized to -1, which
was sometimes interpreted as meaning 'wildcard' and sometimes as 'open the
raw partition' depending on the context. So as an unintended side effect of
r345477 it became basically impossible to ever open a disk or partition
without doing the 'best partition' search. One visible effect of that was
the inability to open the raw disk to read the partition table correctly in
zfs_probe_dev(), leading to failures to find the zfs pool unless it was on
the first partition.

Now instead of always initializing slice and partition to wildcards, the
disk_parsedev() function initializes them based on the presence of a
path/file name following the device. If there is any path or filename
following the ':' that ends the device name, then slice and partition are
initialized to D_SLICEWILD and D_PARTWILD. If there is nothing after the
':' then it is considered to be a request to open the raw device or
partition itself (not a file stored within it), and the fields are
initialized to D_SLICENONE and D_PARTNONE.

With this change in place, all the tests in src/tools/boot are succesful
again, including the recently-added cases of booting from a zfs pool on
a partition other than slice 1 of the device.

PR: 236981

show more ...


# 415e34c4 29-Mar-2019 Alan Somers <asomers@FreeBSD.org>

MFHead@r345677


# 14243f8d 24-Mar-2019 Ian Lepore <ian@FreeBSD.org>

Distinguish between "no partition" and "choose best partition" with a constant.

The values of the d_slice and d_partition fields of a disk_devdesc have a
few values with special meanings in the disk

Distinguish between "no partition" and "choose best partition" with a constant.

The values of the d_slice and d_partition fields of a disk_devdesc have a
few values with special meanings in the disk_open() routine. Through various
evolutions of the loader code over time, a d_partition value of -1 has
meant both "use the first ufs partition found in the bsd label" and "don't
open a bsd partition at all, open the raw slice."

This defines a new special value of -2 to mean open the raw slice, and it
gives symbolic names to all the special values used in d_slice and
d_partition, and adjusts all existing uses of those fields to use the new
constants.

The phab review for this timed out without being accepted, but I'm still
citing it below because there is useful commentary there.

Differential Revision: https://reviews.freebsd.org/D19262

show more ...


# 2aaf9152 18-Mar-2019 Alan Somers <asomers@FreeBSD.org>

MFHead@r345275


# 7325df02 12-Mar-2019 Kyle Evans <kevans@FreeBSD.org>

stand: Improve some debugging experience

Some of these files using <FOO>_DEBUG defined a DEBUG() macro to serve as a
debug-printf. -DDEBUG is useful to enable some debugging output across
multiple E

stand: Improve some debugging experience

Some of these files using <FOO>_DEBUG defined a DEBUG() macro to serve as a
debug-printf. -DDEBUG is useful to enable some debugging output across
multiple ELF/common parts, so switch the DEBUG-as-printf macros over to
something more like DPRINTF that is more commonly used for this kind of
thing and less likely to conflict.

userboot/elf64_freebsd debugging also assumed %llx for uint64; use PRIx64
instead.

MFC after: 1 week

show more ...


# a8fe8db4 25-Feb-2019 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r344178 through r344512.


# 30e009fc 19-Feb-2019 Enji Cooper <ngie@FreeBSD.org>

MFhead@r344270


# 7827bb1c 18-Feb-2019 Ian Lepore <ian@FreeBSD.org>

Garbage collection no-longer-used constant.


# 5b777dbf 18-Feb-2019 Ian Lepore <ian@FreeBSD.org>

Make lsdev -v output line up in neat columns by using a fixed width for
the size field and a tab between the partition type and the size.

Changes this

disk devices:
disk0 (MMC)
di

Make lsdev -v output line up in neat columns by using a fixed width for
the size field and a tab between the partition type and the size.

Changes this

disk devices:
disk0 (MMC)
disk0s1: DOS/Windows 49MB
disk0s2: FreeBSD 14GB
disk0s2a: FreeBSD UFS 14GB
disk0s2b: Unknown 2048KB
disk0s2d: FreeBSD UFS 2040KB

to this

disk devices:
disk0 (MMC)
disk0s1: DOS/Windows 49MB
disk0s2: FreeBSD 14GB
disk0s2a: FreeBSD UFS 14GB
disk0s2b: Unknown 2048KB
disk0s2d: FreeBSD UFS 2040KB

show more ...


# 71c96def 18-Feb-2019 Ian Lepore <ian@FreeBSD.org>

Use a couple local variables to avoid repetitive long expressions that
cause line-wrapping.


# 4d02caf7 18-Feb-2019 Ian Lepore <ian@FreeBSD.org>

Restore loader(8)'s ability for lsdev to show partitions within a bsd slice.

I'm pretty sure this used to work at one time, perhaps long ago. It has
been failing recently because if you call disk_o

Restore loader(8)'s ability for lsdev to show partitions within a bsd slice.

I'm pretty sure this used to work at one time, perhaps long ago. It has
been failing recently because if you call disk_open() with dev->d_partition
set to -1 when d_slice refers to a bsd slice, it assumes you want it to
open the first partition within that slice. When you then pass that open
dev instance to ptable_open(), it tries to read the start of the 'a'
partition and decides there is no recognizable partition type there.

This restores the old functionality by resetting d_offset to the start
of the raw slice after disk_open() returns. For good measure, d_partition
is also set back to -1, although that doesn't currently affect anything.

I would have preferred to make disk_open() avoid such rude assumptions and
if you ask for partition -1 you get the raw slice. But the commit history
shows that someone already did that once (r239058), and had to revert it
(r239232), so I didn't even try to go down that road.

show more ...


Revision tags: release/12.0.0
# 8c153822 07-Nov-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r340213 through r340234.


12