Page MenuHomeFreeBSD

[GEOM/disk] Add function to find disk by device softc
AbandonedPublic

Authored by mizhka on May 16 2016, 10:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 8:43 PM
Unknown Object (File)
Fri, Apr 26, 8:43 PM
Unknown Object (File)
Fri, Apr 26, 4:50 PM
Unknown Object (File)
Feb 23 2024, 1:46 PM
Unknown Object (File)
Jan 28 2024, 1:06 AM
Unknown Object (File)
Jan 13 2024, 6:01 AM
Unknown Object (File)
Jan 8 2024, 6:48 PM
Unknown Object (File)
Jan 4 2024, 11:04 PM

Details

Reviewers
sobomax
adrian
Summary

Hi,

This patch introduces simple function to find disk by device softc.

Use case is geom_flashmap. It provides way to register callback to identify slices on flash device. It passes device_t into callback, but flash size is required to calculate end of memory-mapped flash region. This functions helps to retrieve flash size of any device (CFI, SPI and so on).

Test Plan

Tested on Asus RT-N53 (SPI / mx25l)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mizhka retitled this revision from to [GEOM/disk] Add function to find disk by device softc.
mizhka updated this object.
mizhka edited the test plan for this revision. (Show Details)
mizhka added reviewers: adrian, sobomax.
mizhka set the repository for this revision to rS FreeBSD src repository - subversion.

Why not just store the disk pointer in the softc?

I see 2 disadvantages of softc->disk reference:

  1. It requires setting of disks for all possible drivers (cfi, mx25l, at45 and etc.).
  2. fetch of disk will require casting+switch logic for all possible drivers.

Proposed method is isolated from driver implementation and softc structure type.