os: define CAP_QUOTA as constexpr (C++20)

Issue #4869
This commit is contained in:
Norman Feske 2023-05-15 17:47:54 +02:00 committed by Christian Helmuth
parent 604d6bf567
commit 29079b2ac8
19 changed files with 22 additions and 20 deletions

View File

@ -293,7 +293,7 @@ class Audio_in::Session : public Genode::Session
*/ */
static const char *service_name() { return "Audio_in"; } static const char *service_name() { return "Audio_in"; }
enum { CAP_QUOTA = 4 }; static constexpr unsigned CAP_QUOTA = 4;
/** /**
* Return stream of this session, see 'Stream' above * Return stream of this session, see 'Stream' above

View File

@ -314,7 +314,7 @@ class Audio_out::Session : public Genode::Session
*/ */
static const char *service_name() { return "Audio_out"; } static const char *service_name() { return "Audio_out"; }
enum { CAP_QUOTA = 4 }; static constexpr unsigned CAP_QUOTA = 4;
/** /**
* Return stream of this session, see 'Stream' above * Return stream of this session, see 'Stream' above

View File

@ -182,7 +182,7 @@ struct Block::Session : public Genode::Session
*/ */
static const char *service_name() { return "Block"; } static const char *service_name() { return "Block"; }
enum { CAP_QUOTA = 5 }; static constexpr unsigned CAP_QUOTA = 5;
virtual ~Session() { } virtual ~Session() { }

View File

@ -47,7 +47,7 @@ struct Capture::Session : Genode::Session
* session-object allocation, a session capability, and a dataspace * session-object allocation, a session capability, and a dataspace
* capability for the pixel buffer. * capability for the pixel buffer.
*/ */
enum { CAP_QUOTA = 3 }; static constexpr unsigned CAP_QUOTA = 3;
/** /**
* Return number of bytes needed for pixel buffer of specified size * Return number of bytes needed for pixel buffer of specified size

View File

@ -33,7 +33,7 @@ struct Event::Session : Genode::Session
* session-object allocation, a dataspace capability for the event * session-object allocation, a dataspace capability for the event
* buffer, and its session capability. * buffer, and its session capability.
*/ */
enum { CAP_QUOTA = 3 }; static constexpr unsigned CAP_QUOTA = 3;
/********************* /*********************

View File

@ -330,7 +330,7 @@ struct File_system::Session : public Genode::Session
*/ */
static const char *service_name() { return "File_system"; } static const char *service_name() { return "File_system"; }
enum { CAP_QUOTA = 12 }; static constexpr unsigned CAP_QUOTA = 12;
virtual ~Session() { } virtual ~Session() { }

View File

@ -31,7 +31,7 @@ struct Gpio::Session : Genode::Session
*/ */
static const char *service_name() { return "Gpio"; } static const char *service_name() { return "Gpio"; }
enum { CAP_QUOTA = 2 }; static constexpr unsigned CAP_QUOTA = 2;
enum Direction { IN, OUT }; enum Direction { IN, OUT };

View File

@ -112,7 +112,6 @@ struct Gpu::Virtual_address
}; };
/* /*
* Gpu session interface * Gpu session interface
*/ */
@ -124,12 +123,15 @@ struct Gpu::Session : public Genode::Session
struct Conflicting_id : Genode::Exception { }; struct Conflicting_id : Genode::Exception { };
struct Mapping_vram_failed : Genode::Exception { }; struct Mapping_vram_failed : Genode::Exception { };
enum { REQUIRED_QUOTA = 1024 * 1024, CAP_QUOTA = 32, }; static constexpr Genode::size_t REQUIRED_QUOTA = 1024*1024;
static constexpr unsigned CAP_QUOTA = 32;
static const char *service_name() { return "Gpu"; } static const char *service_name() { return "Gpu"; }
virtual ~Session() { } virtual ~Session() { }
/*********************** /***********************
** Session interface ** ** Session interface **
***********************/ ***********************/

View File

@ -32,7 +32,7 @@ struct I2c::Session : public Genode::Session
*/ */
static char const *service_name() { return "I2c"; } static char const *service_name() { return "I2c"; }
enum { CAP_QUOTA = 2 }; static constexpr unsigned CAP_QUOTA = 2;
/** /**
* Exception thrown in case of a bus error * Exception thrown in case of a bus error

View File

@ -62,7 +62,7 @@ struct Loader::Session : Genode::Session
*/ */
static const char *service_name() { return "Loader"; } static const char *service_name() { return "Loader"; }
enum { CAP_QUOTA = 2 }; static constexpr unsigned CAP_QUOTA = 2;
virtual ~Session() { } virtual ~Session() { }

View File

@ -77,7 +77,7 @@ struct Nic::Session : Genode::Session
* rx and tx, and four signal context capabilities for the data-flow * rx and tx, and four signal context capabilities for the data-flow
* signals. * signals.
*/ */
enum { CAP_QUOTA = 8 }; static constexpr unsigned CAP_QUOTA = 8;
virtual ~Session() { } virtual ~Session() { }

View File

@ -36,7 +36,7 @@ struct Pin_control::Session : Genode::Session
* A pin-control session consumes a dataspace capability for the server's * A pin-control session consumes a dataspace capability for the server's
* session-object allocation and its session capability. * session-object allocation and its session capability.
*/ */
enum { CAP_QUOTA = 2 }; static constexpr unsigned CAP_QUOTA = 2;
virtual void state(bool) = 0; virtual void state(bool) = 0;

View File

@ -36,7 +36,7 @@ struct Pin_state::Session : Genode::Session
* A pin-state session consumes a dataspace capability for the server's * A pin-state session consumes a dataspace capability for the server's
* session-object allocation and its session capability. * session-object allocation and its session capability.
*/ */
enum { CAP_QUOTA = 2 }; static constexpr unsigned CAP_QUOTA = 2;
virtual bool state() const = 0; virtual bool state() const = 0;

View File

@ -57,7 +57,7 @@ struct Platform::Session : Genode::Session
*/ */
static const char *service_name() { return "Platform"; } static const char *service_name() { return "Platform"; }
enum { CAP_QUOTA = 6 }; static constexpr unsigned CAP_QUOTA = 6;
virtual ~Session() { } virtual ~Session() { }

View File

@ -60,7 +60,7 @@ struct Report::Session : Genode::Session
* session-object allocation, the session capability, and a dataspace * session-object allocation, the session capability, and a dataspace
* capability for the report buffer. * capability for the report buffer.
*/ */
enum { CAP_QUOTA = 3 }; static constexpr unsigned CAP_QUOTA = 3;
typedef Session_client Client; typedef Session_client Client;

View File

@ -55,7 +55,7 @@ struct Rtc::Session : Genode::Session
*/ */
static const char *service_name() { return "Rtc"; } static const char *service_name() { return "Rtc"; }
enum { CAP_QUOTA = 2 }; static constexpr unsigned CAP_QUOTA = 2;
/*********************** /***********************

View File

@ -34,7 +34,7 @@ struct Terminal::Session : Genode::Session
* session-object allocation, its session capability, and a dataspace * session-object allocation, its session capability, and a dataspace
* capability for the communication buffer. * capability for the communication buffer.
*/ */
enum { CAP_QUOTA = 3 }; static constexpr unsigned CAP_QUOTA = 3;
class Size class Size
{ {

View File

@ -72,7 +72,7 @@ struct Uplink::Session : Genode::Session
* rx and tx, and four signal context capabilities for the data-flow * rx and tx, and four signal context capabilities for the data-flow
* signals. * signals.
*/ */
enum { CAP_QUOTA = 8 }; static constexpr unsigned CAP_QUOTA = 8;
virtual ~Session() { } virtual ~Session() { }

View File

@ -181,7 +181,7 @@ struct Usb::Session : public Genode::Session
*/ */
static const char *service_name() { return "Usb"; } static const char *service_name() { return "Usb"; }
enum { CAP_QUOTA = 5 }; static constexpr unsigned CAP_QUOTA = 5;
/** /**
* Send from the server to the client upon device state change * Send from the server to the client upon device state change