ghw icon indicating copy to clipboard operation
ghw copied to clipboard

May disk's driver type need more checks

Open nevermore-muyi opened this issue 3 years ago • 5 comments

As the code https://github.com/jaypipes/ghw/blob/main/pkg/block/block_linux.go#L271 shows, when I create a device mapper device which starts with dm- prefix, and the function https://github.com/jaypipes/ghw/blob/main/pkg/block/block_linux.go#L316 thinks it's a unknown device, but (https://github.com/jaypipes/ghw/blob/main/pkg/block/block_linux.go#L274) may define it's a SSD. image

So, in my option, driver type may need more checks.

nevermore-muyi avatar Jan 19 '22 08:01 nevermore-muyi

@nevermore-muyi hi! thanks for your submission!

Are you suggesting that instead of returning an UNKNOWN disk type, we should check for whether the disk is rotational, and if not, return SSD disk type?

jaypipes avatar Jan 19 '22 14:01 jaypipes

@jaypipes Maybe a little different. I suggest only KNOWN disk type needs more check if it's rotational and define it's a SSD, but UNKNOWN disk type, just return it?

nevermore-muyi avatar Jan 20 '22 01:01 nevermore-muyi

I tend to agree the code should not set the drive type depending only on the value of rotational

ffromani avatar Mar 11 '22 15:03 ffromani

@nevermore-muyi we are considering creating a separate package for devicemappings/devicemapper. See conversation here.

jaypipes avatar Mar 24 '22 15:03 jaypipes

@nevermore-muyi we are considering creating a separate package for devicemappings/devicemapper. See conversation here.

Got it. Looks very cool.

nevermore-muyi avatar Mar 28 '22 03:03 nevermore-muyi