rand/system_linux: avoid the 'linux' symbol as it's a platform define
This commit is contained in:
parent
0df4fd4bfa
commit
2089893124
@ -15,7 +15,7 @@
|
||||
#include <linux/random.h>
|
||||
|
||||
|
||||
using cruft::rand::linux::device;
|
||||
using cruft::rand::file;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -27,20 +27,20 @@ static std::string const& default_source (void)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
device::device ():
|
||||
device (default_source ())
|
||||
file::file ():
|
||||
file (default_source ())
|
||||
{ ; }
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
device::device (std::string const &token)
|
||||
file::file (std::string const &token)
|
||||
: m_fd (token, O_RDONLY | O_BINARY)
|
||||
{ ; }
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
device::result_type
|
||||
device::operator() (void)
|
||||
file::result_type
|
||||
file::operator() (void)
|
||||
{
|
||||
result_type res;
|
||||
cruft::read (m_fd, cruft::make_byte_view<u08> (res));
|
||||
@ -50,7 +50,7 @@ device::operator() (void)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
double
|
||||
device::entropy () const noexcept
|
||||
file::entropy () const noexcept
|
||||
{
|
||||
int val;
|
||||
|
||||
|
@ -12,17 +12,16 @@
|
||||
|
||||
|
||||
namespace cruft::rand {
|
||||
namespace linux {
|
||||
/// Models std::random_device and is suitable as a drop-in replacement.
|
||||
class device {
|
||||
class file {
|
||||
public:
|
||||
using result_type = unsigned;
|
||||
|
||||
device ();
|
||||
device (std::string const&);
|
||||
device (device const &) = delete;
|
||||
file ();
|
||||
file (std::string const&);
|
||||
file (file const &) = delete;
|
||||
|
||||
device& operator= (device const&) = delete;
|
||||
file& operator= (file const&) = delete;
|
||||
|
||||
result_type operator() (void);
|
||||
|
||||
@ -34,7 +33,6 @@ namespace cruft::rand {
|
||||
private:
|
||||
cruft::posix::fd m_fd;
|
||||
};
|
||||
}
|
||||
|
||||
using system = linux::device;
|
||||
using system = file;
|
||||
}
|
Loading…
Reference in New Issue
Block a user