Page MenuHomeFreeBSD

kboot: Rework hostdisk.c to allow easier ZFS support.
ClosedPublic

Authored by imp on Jan 10 2023, 12:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 14, 3:23 AM
Unknown Object (File)
Fri, Jun 14, 3:22 AM
Unknown Object (File)
Fri, Jun 14, 3:22 AM
Unknown Object (File)
Fri, Jun 14, 3:22 AM
Unknown Object (File)
Fri, Jun 14, 3:22 AM
Unknown Object (File)
Fri, Jun 14, 3:09 AM
Unknown Object (File)
Fri, Jun 14, 2:57 AM
Unknown Object (File)
May 10 2024, 7:09 PM
Subscribers

Details

Summary

Keep a list of disks and partitions that we have. Keep track of the
sizes of the media and sector and use that to implement DIOCGMEDIASIZE
and DIOCGSECTORSIZE. Proivde a way to lookup disks by name.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Jan 10 2023, 12:20 AM
kevans added inline comments.
stand/kboot/hostdisk.c
197

dev needs to be freed here as well upon error

416

As noted; can it be NULL? If it is NULL, I don't see a point to doing any of this last bit in the first place.

stand/kboot/hostdisk.c
197

doh! Will fix

416

At one point this was done to test the validity of a device. I'll have to check to see if that's still possible after the refactoring.

stand/kboot/hostdisk.c
416

ls.c uses it to check to see if there's a path on the device already so it can add '/' of not (eg ls foo: -> ls foo:/). Modules uses it parse a device spec to see if there's a path on it and does things with the path it finds.

Add needed free, init to NULL to make the code easier to modify in the future.

stand/kboot/hostdisk.c
416

ls.c uses it to check to see if there's a path on the device already so it can add '/' of not (eg ls foo: -> ls foo:/). Modules uses it parse a device spec to see if there's a path on it and does things with the path it finds.

But... that's with devparse, which passes in its own pointer so it's always not null. It also does the free dance for the parse-ony case. So I can remove this check here.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 13 2023, 9:27 PM
This revision was automatically updated to reflect the committed changes.