svn commit: r268680 - stable/10/sys/cam/ctl
Alexander Motin
mav at FreeBSD.org
Tue Jul 15 17:00:42 UTC 2014
Author: mav
Date: Tue Jul 15 17:00:41 2014
New Revision: 268680
URL: http://svnweb.freebsd.org/changeset/base/268680
Log:
MFC r268287:
Implement and use ctl_frontend_find().
Modified:
stable/10/sys/cam/ctl/ctl.c
stable/10/sys/cam/ctl/ctl_frontend.c
stable/10/sys/cam/ctl/ctl_frontend.h
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c Tue Jul 15 16:59:46 2014 (r268679)
+++ stable/10/sys/cam/ctl/ctl.c Tue Jul 15 17:00:41 2014 (r268680)
@@ -3123,13 +3123,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd,
ci = (struct ctl_iscsi *)addr;
- mtx_lock(&softc->ctl_lock);
- STAILQ_FOREACH(fe, &softc->fe_list, links) {
- if (strcmp(fe->name, "iscsi") == 0)
- break;
- }
- mtx_unlock(&softc->ctl_lock);
-
+ fe = ctl_frontend_find("iscsi");
if (fe == NULL) {
ci->status = CTL_ISCSI_ERROR;
snprintf(ci->error_str, sizeof(ci->error_str),
Modified: stable/10/sys/cam/ctl/ctl_frontend.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend.c Tue Jul 15 16:59:46 2014 (r268679)
+++ stable/10/sys/cam/ctl/ctl_frontend.c Tue Jul 15 17:00:41 2014 (r268680)
@@ -118,6 +118,23 @@ ctl_frontend_deregister(struct ctl_front
return (0);
}
+struct ctl_frontend *
+ctl_frontend_find(char *frontend_name)
+{
+ struct ctl_softc *ctl_softc = control_softc;
+ struct ctl_frontend *fe;
+
+ mtx_lock(&ctl_softc->ctl_lock);
+ STAILQ_FOREACH(fe, &ctl_softc->fe_list, links) {
+ if (strcmp(fe->name, frontend_name) == 0) {
+ mtx_unlock(&ctl_softc->ctl_lock);
+ return (fe);
+ }
+ }
+ mtx_unlock(&ctl_softc->ctl_lock);
+ return (NULL);
+}
+
int
ctl_port_register(struct ctl_port *port, int master_shelf)
{
Modified: stable/10/sys/cam/ctl/ctl_frontend.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend.h Tue Jul 15 16:59:46 2014 (r268679)
+++ stable/10/sys/cam/ctl/ctl_frontend.h Tue Jul 15 17:00:41 2014 (r268680)
@@ -259,6 +259,11 @@ int ctl_frontend_register(struct ctl_fro
int ctl_frontend_deregister(struct ctl_frontend *fe);
/*
+ * Find the frontend by its name. Returns NULL if not found.
+ */
+struct ctl_frontend * ctl_frontend_find(char *frontend_name);
+
+/*
* This may block until resources are allocated. Called at FETD module load
* time. Returns 0 for success, non-zero for failure.
*/
More information about the svn-src-stable
mailing list