-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vhost_user: Remove non-standard request values
NOOP and MAX_CMD are not present in the vhost-user protocol, these are use only to verify that the value is correct before transmuting it to an enum variant. This has two problems, firstly it exposes of non-standard values in a public interface, this internal implementaion detail could be confusing, and secondly it assumes that the values are consecutive with no "holes" between them. This results in having to define requests that are not actually supported, and error prone, which can generate UB when transmuting. Instead, it is better to implement TryFrom<u32> for enums that need to convert between variants and u32. This will allow, in the next commit, to eliminate the need to use an unsafe transmute. Signed-off-by: German Maglione <gmaglione@redhat.com>
- Loading branch information
1 parent
515b8e9
commit eb452c8
Showing
1 changed file
with
146 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters