Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151280056
D39046.id118723.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D39046.id118723.diff
View Options
diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -109,6 +109,8 @@
static int ifc_simple_match(struct if_clone *ifc, const char *name);
static int ifc_handle_unit(struct if_clone *ifc, char *name, size_t len, int *punit);
+static struct if_clone *ifc_find_cloner(const char *name);
+static struct if_clone *ifc_find_cloner_match(const char *name);
#ifdef CLONE_COMPAT_13
static int ifc_simple_create_wrapper(struct if_clone *ifc, char *name, size_t maxlen,
@@ -189,19 +191,12 @@
ifc_create_ifp(const char *name, struct ifc_data *ifd,
struct ifnet **ifpp)
{
- struct if_clone *ifc;
char ifname[IFNAMSIZ];
struct ifnet *ifp = NULL;
int error;
/* Try to find an applicable cloner for this request */
- IF_CLONERS_LOCK();
- LIST_FOREACH(ifc, &V_if_cloners, ifc_list) {
- if (ifc->ifc_match(ifc, name))
- break;
- }
- IF_CLONERS_UNLOCK();
-
+ struct if_clone *ifc = ifc_find_cloner_match(name);
if (ifc == NULL)
return (EINVAL);
@@ -265,12 +260,27 @@
return (ifcifp != NULL);
}
+
static struct if_clone *
-ifc_find_cloner(const char *name, struct vnet *vnet)
+ifc_find_cloner_match(const char *name)
+{
+ struct if_clone *ifc;
+
+ IF_CLONERS_LOCK();
+ LIST_FOREACH(ifc, &V_if_cloners, ifc_list) {
+ if (ifc->ifc_match(ifc, name))
+ break;
+ }
+ IF_CLONERS_UNLOCK();
+
+ return (ifc);
+}
+
+static struct if_clone *
+ifc_find_cloner(const char *name)
{
struct if_clone *ifc;
- CURVNET_SET_QUIET(vnet);
IF_CLONERS_LOCK();
LIST_FOREACH(ifc, &V_if_cloners, ifc_list) {
if (strcmp(ifc->ifc_name, name) == 0) {
@@ -278,6 +288,15 @@
}
}
IF_CLONERS_UNLOCK();
+
+ return (ifc);
+}
+
+static struct if_clone *
+ifc_find_cloner_vnet(const char *name, struct vnet *vnet)
+{
+ CURVNET_SET_QUIET(vnet);
+ struct if_clone *ifc = ifc_find_cloner(name);
CURVNET_RESTORE();
return (ifc);
@@ -326,7 +345,7 @@
if (ifp == NULL)
return (ENXIO);
- ifc = ifc_find_cloner(ifp->if_dname, ifp->if_home_vnet);
+ ifc = ifc_find_cloner_vnet(ifp->if_dname, ifp->if_home_vnet);
if (ifc == NULL) {
if_rele(ifp);
return (EINVAL);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 7:22 AM (15 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31085274
Default Alt Text
D39046.id118723.diff (2 KB)
Attached To
Mode
D39046: net: refactor if_clone.c #1
Attached
Detach File
Event Timeline
Log In to Comment