From 37ebeccaa7247664d69cdfbdb20861bf78f8d72d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 20 Jan 2015 21:06:31 +0100 Subject: device: implement flag NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER for is_available() --- src/devices/nm-device.c | 8 +++++++- src/devices/nm-device.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 79befb36db..c4ec949aee 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1738,7 +1738,13 @@ is_available (NMDevice *self, NMDeviceCheckDevAvailableFlags flags) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - return priv->carrier || priv->ignore_carrier; + if (priv->carrier || priv->ignore_carrier) + return TRUE; + + if (NM_FLAGS_HAS (flags, NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER)) + return TRUE; + + return FALSE; } /** diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 4c2d4f8c53..a863571f29 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -93,6 +93,7 @@ typedef enum NMActStageReturn NMActStageReturn; * not available if it would be available otherwise. */ typedef enum { NM_DEVICE_CHECK_CON_AVAILABLE_NONE = 0, + NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST = (1L << 0), __NM_DEVICE_CHECK_CON_AVAILABLE_ALL, @@ -107,6 +108,7 @@ struct _NMDevice { * a device appear more available. It can never make a device less available. */ typedef enum { NM_DEVICE_CHECK_DEV_AVAILABLE_NONE = 0, + NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER = (1L << 0), __NM_DEVICE_CHECK_DEV_AVAILABLE_ALL, NM_DEVICE_CHECK_DEV_AVAILABLE_ALL = (((__NM_DEVICE_CHECK_DEV_AVAILABLE_ALL - 1) << 1) - 1), -- cgit v1.2.1