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
F105989490: D6400.diff
Mon, Dec 23, 1:32 PM
Unknown Object (File)
Fri, Nov 29, 2:57 PM
Unknown Object (File)
Tue, Nov 26, 11:11 AM
Unknown Object (File)
Mon, Nov 25, 12:06 PM
Unknown Object (File)
Mon, Nov 25, 10:07 AM
Unknown Object (File)
Nov 21 2024, 12:29 AM
Unknown Object (File)
Nov 20 2024, 11:32 PM
Unknown Object (File)
Oct 6 2024, 8:21 AM

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.