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
F154736171: D6400.id16414.diff
Wed, Apr 29, 8:25 AM
F154688060: D6400.id16414.diff
Wed, Apr 29, 5:40 AM
F154576859: D6400.id.diff
Tue, Apr 28, 11:14 PM
Unknown Object (File)
Wed, Apr 15, 1:45 AM
Unknown Object (File)
Tue, Apr 14, 1:15 PM
Unknown Object (File)
Sat, Apr 11, 12:56 PM
Unknown Object (File)
Fri, Apr 10, 10:49 AM
Unknown Object (File)
Sun, Apr 5, 12:46 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.