Page MenuHomeFreeBSD

Make /dev/sndstat writeable
ClosedPublic

Authored by hselasky on Feb 4 2016, 1:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 8:17 AM
Unknown Object (File)
Sat, Apr 27, 8:17 AM
Unknown Object (File)
Sat, Apr 27, 8:17 AM
Unknown Object (File)
Sat, Apr 27, 8:17 AM
Unknown Object (File)
Sat, Apr 27, 8:17 AM
Unknown Object (File)
Sat, Apr 27, 7:05 AM
Unknown Object (File)
Sat, Apr 27, 6:38 AM
Unknown Object (File)
Fri, Apr 26, 5:37 AM
Subscribers

Details

Summary

To support userspace audio deamons like Virtual OSS, /dev/sndstat is made writeable to facilitate more smooth integration.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

hselasky retitled this revision from to Make /dev/sndstat writeable.
hselasky updated this object.
hselasky edited the test plan for this revision. (Show Details)
hselasky added a reviewer: mav.
hselasky set the repository for this revision to rS FreeBSD src repository - subversion.

I have no serious objections. The idea of writing this device info just in textual form looks somewhat simplistic to me, but I can live with that, if you think it is fine.

sys/dev/sound/pcm/sndstat.c
67

Does this really help, or just obfuscate the code?

230

What's the idea of these dummy acquire/release now?

365

I worry that some software may incorrectly parse this.

sys/dev/sound/pcm/sndstat.c
67

It is quite common to define macros when locking. I think it makes it more readable.

230

It's kind of like Read/Copy/Update lock.

If you look where sndstat_acquire is used:

pcm_unregister():
...
        PCM_LOCK(d);
        d->flags |= SD_F_DYING;
        d->flags &= ~SD_F_REGISTERED;
        PCM_UNLOCK(d);
...
sndstat_release();

The dummy lock/unlock ensures that next time someone reads the sound status it sees that the device is gone. Or if it was currently iterating that it waits for that.

I'll look into it a bit and see if there are any races left.

365

Yes, it's a risk. I checked some tools like pulseaudio() and they mostly look for pcm%d . I can check a bit more.

hselasky edited edge metadata.

Improve patch as per mav's suggestions.

Remove now superfluous sndstat_acquire() and sndstat_release() functions.

Re-add PCM_REGISTERED() check.

mav edited edge metadata.

I have no objections.

This revision is now accepted and ready to land.Feb 9 2016, 2:20 PM
This revision was automatically updated to reflect the committed changes.