Page MenuHomeFreeBSD

sound: Get rid of useless sndbuf getters and setters
AbandonedPublic

Authored by christos on Nov 1 2025, 10:54 PM.
Tags
None
Referenced Files
F167506680: D53528.id.diff
Sat, Aug 22, 9:04 AM
Unknown Object (File)
Fri, Aug 21, 9:04 AM
Unknown Object (File)
Tue, Aug 18, 4:08 PM
Unknown Object (File)
Fri, Aug 14, 12:02 PM
Unknown Object (File)
Thu, Aug 13, 2:06 PM
Unknown Object (File)
Thu, Aug 13, 12:56 AM
Unknown Object (File)
Mon, Aug 10, 11:23 AM
Unknown Object (File)
Sat, Aug 8, 2:12 PM
Subscribers

Details

Summary

No functional change intended.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68342
Build 65225: arc lint + arc unit

Event Timeline

I know this is rather large for a non-functional change, but I think it's worth cleaning this up. There are a few more gettters/setters in sys/dev/sound/pcm/buffer.c, but I want to think a bit more about them.

Why? It's a lot of churn, and the accessors are harmless. It's nice to have them when looking at how certain fields are accessed. When reviewing a previous change, for instance, I was looking at callers of sndbuf_getsel(). It would have been annoying without that accessor, since there are many fields called "sel".

Why? It's a lot of churn, and the accessors are harmless. It's nice to have them when looking at how certain fields are accessed. When reviewing a previous change, for instance, I was looking at callers of sndbuf_getsel(). It would have been annoying without that accessor, since there are many fields called "sel".

The rationale is that no other part of sound(4) has OOP-like getters and setters, and IMHO these do not really serve a good purpose other than essentially adding an "sndbuf_get*" prefix to the struct's name field. As for sel, we use this field in only a handful of places, and in some we actually need to access the sel's fields (e.g., in D53029), and using the getter will only make that more verbose and ugly.