diff options
author | Daniel Mueller <deso@posteo.net> | 2019-07-14 18:04:32 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-07-14 18:04:32 -0700 |
commit | ec9dddc17d7466ec44fbfd08e71546b8c0ba9b1b (patch) | |
tree | 802f9a136725439eb081ab28e5dd52f2dcf60d27 /libc/src/unix/linux_like/mod.rs | |
parent | 019b1bb66d83bd904df3e545654f16e70e677ce8 (diff) | |
download | nitrocli-ec9dddc17d7466ec44fbfd08e71546b8c0ba9b1b.tar.gz nitrocli-ec9dddc17d7466ec44fbfd08e71546b8c0ba9b1b.tar.bz2 |
Introduce with_*device functionality
The upcoming nitrokey 0.4 release changes the way a device handle can be
acquired, requiring a manager instance for doing so in an attempt to
prevent users from opening multiple sessions (which is not something
that libnitrokey supports).
A straight integration of the reworked API surface into our program
would severely complicate the architecture because of the additional
requirement of keeping a manager object around while a device is being
used.
To make the program more amenable to those changes in nitrokey, this
patch reworks the way we interact with a device handle: instead of
passing the device object around we pass in the functionality making use
of it in the form of a function. In more concrete terms, instead of
retrieving a device handle via get_device() we now have a with_device()
function that takes care of opening the device and then passing it to a
user-provided function.
Diffstat (limited to 'libc/src/unix/linux_like/mod.rs')
0 files changed, 0 insertions, 0 deletions