Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Add dkwedge_find_by_parent()



details:   https://anonhg.NetBSD.org/src/rev/540b695219b2
branches:  trunk
changeset: 815042:540b695219b2
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 27 02:19:12 2016 +0000

description:
Add dkwedge_find_by_parent()

diffstat:

 sys/dev/dkwedge/dk.c |  21 +++++++++++++++++++--
 sys/sys/disk.h       |   4 +++-
 2 files changed, 22 insertions(+), 3 deletions(-)

diffs (63 lines):

diff -r 9e56174fc4c5 -r 540b695219b2 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Tue Apr 26 21:17:20 2016 +0000
+++ b/sys/dev/dkwedge/dk.c      Wed Apr 27 02:19:12 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.88 2016/01/15 07:48:22 mlelstv Exp $  */
+/*     $NetBSD: dk.c,v 1.89 2016/04/27 02:19:12 christos Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.88 2016/01/15 07:48:22 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.89 2016/04/27 02:19:12 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -761,6 +761,23 @@
        return dv;
 }
 
+device_t
+dkwedge_find_by_parent(const char *name, size_t *i)
+{
+       rw_enter(&dkwedges_lock, RW_WRITER);
+       for (; *i < (size_t)ndkwedges; (*i)++) {
+               struct dkwedge_softc *sc;
+               if ((sc = dkwedges[*i]) == NULL)
+                       continue;
+               if (strcmp(sc->sc_parent->dk_name, name) != 0)
+                       continue;
+               rw_exit(&dkwedges_lock);
+               return sc->sc_dev;
+       }
+       rw_exit(&dkwedges_lock);
+       return NULL;
+}
+
 void
 dkwedge_print_wnames(void)
 {
diff -r 9e56174fc4c5 -r 540b695219b2 sys/sys/disk.h
--- a/sys/sys/disk.h    Tue Apr 26 21:17:20 2016 +0000
+++ b/sys/sys/disk.h    Wed Apr 27 02:19:12 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disk.h,v 1.66 2015/11/12 15:25:22 christos Exp $       */
+/*     $NetBSD: disk.h,v 1.67 2016/04/27 02:19:12 christos Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
@@ -547,9 +547,11 @@
 void   dkwedge_discover(struct disk *);
 int    dkwedge_read(struct disk *, struct vnode *, daddr_t, void *, size_t);
 device_t dkwedge_find_by_wname(const char *);
+device_t dkwedge_find_by_parent(const char *, size_t *);
 const char *dkwedge_get_parent_name(dev_t);
 void   dkwedge_print_wnames(void);
 device_t dkwedge_find_partition(device_t, daddr_t, uint64_t);
+
 #endif
 
 #endif /* _SYS_DISK_H_ */



Home | Main Index | Thread Index | Old Index