Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Add a way to delete all media for a specified instance.
details: https://anonhg.NetBSD.org/src/rev/cee695059e12
branches: trunk
changeset: 481356:cee695059e12
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Jan 26 21:58:17 2000 +0000
description:
Add a way to delete all media for a specified instance.
diffstat:
sys/net/if_media.c | 23 ++++++++++++++++++++++-
sys/net/if_media.h | 6 +++++-
2 files changed, 27 insertions(+), 2 deletions(-)
diffs (64 lines):
diff -r 7618288a71d8 -r cee695059e12 sys/net/if_media.c
--- a/sys/net/if_media.c Wed Jan 26 18:50:18 2000 +0000
+++ b/sys/net/if_media.c Wed Jan 26 21:58:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_media.c,v 1.7 1999/11/03 23:06:35 thorpej Exp $ */
+/* $NetBSD: if_media.c,v 1.8 2000/01/26 21:58:17 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -388,6 +388,27 @@
return match;
}
+/*
+ * Delete all media for a given instance.
+ */
+void
+ifmedia_delete_instance(ifm, inst)
+ struct ifmedia *ifm;
+ int inst;
+{
+ struct ifmedia_entry *ife, *nife;
+
+ for (ife = TAILQ_FIRST(&ifm->ifm_list); ife != NULL;
+ ife = nife) {
+ nife = TAILQ_NEXT(ife, ifm_list);
+ if (inst == IFM_INST_ANY ||
+ inst == IFM_INST(ife->ifm_media)) {
+ TAILQ_REMOVE(&ifm->ifm_list, ife, ifm_list);
+ free(ife, M_DEVBUF);
+ }
+ }
+}
+
#ifdef IFMEDIA_DEBUG
struct ifmedia_description ifm_type_descriptions[] =
diff -r 7618288a71d8 -r cee695059e12 sys/net/if_media.h
--- a/sys/net/if_media.h Wed Jan 26 18:50:18 2000 +0000
+++ b/sys/net/if_media.h Wed Jan 26 21:58:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_media.h,v 1.19 2000/01/25 20:18:52 thorpej Exp $ */
+/* $NetBSD: if_media.h,v 1.20 2000/01/26 21:58:18 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -141,6 +141,9 @@
struct ifmedia_entry *ifmedia_match __P((struct ifmedia *ifm, int flags,
int mask));
+/* Delete all media for a given media instance */
+void ifmedia_delete_instance __P((struct ifmedia *, int));
+
#endif /*_KERNEL */
/*
@@ -262,6 +265,7 @@
#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK))
#define IFM_INST_MAX IFM_INST(IFM_IMASK)
+#define IFM_INST_ANY -1
/*
* Macro to create a media word.
Home |
Main Index |
Thread Index |
Old Index