mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 00:00:30 +01:00
platform: use NMPlatformError type instead of int
This commit is contained in:
parent
a6a330581c
commit
1929471d5f
2 changed files with 28 additions and 15 deletions
|
|
@ -129,6 +129,19 @@ nm_platform_get (void)
|
|||
|
||||
/******************************************************************/
|
||||
|
||||
/**
|
||||
* nm_platform_set_error:
|
||||
* @error: The error code
|
||||
*
|
||||
* Convenience function to falsify platform->error. It can be used for example
|
||||
* by functions that want to save the error, execute some operations and
|
||||
* restore it.
|
||||
*/
|
||||
void nm_platform_set_error (NMPlatformError error)
|
||||
{
|
||||
platform->error = error;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_platform_get_error:
|
||||
*
|
||||
|
|
@ -137,7 +150,7 @@ nm_platform_get (void)
|
|||
*
|
||||
* Returns: Integer error code.
|
||||
*/
|
||||
int
|
||||
NMPlatformError
|
||||
nm_platform_get_error (void)
|
||||
{
|
||||
g_assert (platform);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,17 @@
|
|||
|
||||
/******************************************************************/
|
||||
|
||||
typedef enum {
|
||||
/* no error specified, sometimes this means the arguments were wrong */
|
||||
NM_PLATFORM_ERROR_NONE,
|
||||
/* object was not found */
|
||||
NM_PLATFORM_ERROR_NOT_FOUND,
|
||||
/* object already exists */
|
||||
NM_PLATFORM_ERROR_EXISTS,
|
||||
/* object is not a slave */
|
||||
NM_PLATFORM_ERROR_NOT_SLAVE
|
||||
} NMPlatformError;
|
||||
|
||||
typedef enum {
|
||||
NM_LINK_TYPE_NONE,
|
||||
NM_LINK_TYPE_UNKNOWN,
|
||||
|
|
@ -117,7 +128,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
GObject parent;
|
||||
|
||||
int error;
|
||||
NMPlatformError error;
|
||||
} NMPlatform;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -206,18 +217,6 @@ typedef struct {
|
|||
#define NM_PLATFORM_IP6_ROUTE_CHANGED "ip6-route-changed"
|
||||
#define NM_PLATFORM_IP6_ROUTE_REMOVED "ip6-route-removed"
|
||||
|
||||
/* NMPlatform error codes */
|
||||
enum {
|
||||
/* no error specified, sometimes this means the arguments were wrong */
|
||||
NM_PLATFORM_ERROR_NONE,
|
||||
/* object was not found */
|
||||
NM_PLATFORM_ERROR_NOT_FOUND,
|
||||
/* object already exists */
|
||||
NM_PLATFORM_ERROR_EXISTS,
|
||||
/* object is not a slave */
|
||||
NM_PLATFORM_ERROR_NOT_SLAVE
|
||||
};
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
GType nm_platform_get_type (void);
|
||||
|
|
@ -228,7 +227,8 @@ void nm_platform_free (void);
|
|||
|
||||
/******************************************************************/
|
||||
|
||||
int nm_platform_get_error (void);
|
||||
void nm_platform_set_error (NMPlatformError error);
|
||||
NMPlatformError nm_platform_get_error (void);
|
||||
const char *nm_platform_get_error_msg (void);
|
||||
|
||||
gboolean nm_platform_sysctl_set (const char *path, const char *value);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue