Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jan 2017 18:36:46 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r312081 - head/sys/dev/iscsi_initiator
Message-ID:  <201701131836.v0DIaklV001972@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Jan 13 18:36:46 2017
New Revision: 312081
URL: https://svnweb.freebsd.org/changeset/base/312081

Log:
  Use getsock_cap() instead of deprecated fgetsock().
  
  Reviewed by:	Daniel Braniss <danny cs.huji.ac.il>

Modified:
  head/sys/dev/iscsi_initiator/isc_soc.c
  head/sys/dev/iscsi_initiator/iscsi.c

Modified: head/sys/dev/iscsi_initiator/isc_soc.c
==============================================================================
--- head/sys/dev/iscsi_initiator/isc_soc.c	Fri Jan 13 17:03:23 2017	(r312080)
+++ head/sys/dev/iscsi_initiator/isc_soc.c	Fri Jan 13 18:36:46 2017	(r312081)
@@ -680,7 +680,6 @@ isc_stop_receiver(isc_session_t *sp)
 
      if(sp->fp != NULL)
 	  fdrop(sp->fp, sp->td);
-     fputsock(sp->soc);
      sp->soc = NULL;
      sp->fp = NULL;
 

Modified: head/sys/dev/iscsi_initiator/iscsi.c
==============================================================================
--- head/sys/dev/iscsi_initiator/iscsi.c	Fri Jan 13 17:03:23 2017	(r312080)
+++ head/sys/dev/iscsi_initiator/iscsi.c	Fri Jan 13 18:36:46 2017	(r312081)
@@ -388,20 +388,14 @@ i_setsoc(isc_session_t *sp, int fd, stru
      if(sp->soc != NULL)
 	  isc_stop_receiver(sp);
 
-     error = fget(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), &sp->fp);
+     error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT),
+	     &sp->fp, NULL, NULL);
      if(error)
 	  return error;
 
-     error = fgetsock(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT),
-        &sp->soc, 0);
-     if(error == 0) {
-	  sp->td = td;
-	  isc_start_receiver(sp);
-     }
-     else {
-	  fdrop(sp->fp, td);
-	  sp->fp = NULL;
-     }
+     sp->soc = sp->fp->f_data;
+     sp->td = td;
+     isc_start_receiver(sp);
 
      return error;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701131836.v0DIaklV001972>