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
F176268504: D6400.id.diff
Sat, Oct 17, 1:16 PM
Unknown Object (File)
Thu, Oct 15, 3:57 PM
Unknown Object (File)
Fri, Oct 9, 10:22 AM
Unknown Object (File)
Tue, Oct 6, 5:47 PM
Unknown Object (File)
Sun, Oct 4, 8:23 PM
Unknown Object (File)
Sun, Oct 4, 2:28 PM
Unknown Object (File)
Sat, Oct 3, 12:27 PM
Unknown Object (File)
Tue, Sep 29, 6:45 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.