aboutsummaryrefslogtreecommitdiff
path: root/sys/netsmb
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2018-07-30 15:46:40 +0000
committerAlan Somers <asomers@FreeBSD.org>2018-07-30 15:46:40 +0000
commit6040822c4e20fb46638ecaaad543fc56f6ec2b0f (patch)
tree133352663bf8c98c65abf581f6a4a8769325ca09 /sys/netsmb
parent19fe43f796f3d962b3bf023a4484a82d7b2a5711 (diff)
downloadsrc-6040822c4e20fb46638ecaaad543fc56f6ec2b0f.tar.gz
src-6040822c4e20fb46638ecaaad543fc56f6ec2b0f.zip
Make timespecadd(3) and friends public
The timespecadd(3) family of macros were imported from NetBSD back in r35029. However, they were initially guarded by #ifdef _KERNEL. In the meantime, we have grown at least 28 syscalls that use timespecs in some way, leading many programs both inside and outside of the base system to redefine those macros. It's better just to make the definitions public. Our kernel currently defines two-argument versions of timespecadd and timespecsub. NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define three-argument versions. Solaris also defines a three-argument version, but only in its kernel. This revision changes our definition to match the common three-argument version. Bump _FreeBSD_version due to the breaking KPI change. Discussed with: cem, jilles, ian, bde Differential Revision: https://reviews.freebsd.org/D14725
Notes
Notes: svn path=/head/; revision=336914
Diffstat (limited to 'sys/netsmb')
-rw-r--r--sys/netsmb/smb_iod.c6
-rw-r--r--sys/netsmb/smb_trantcp.c9
2 files changed, 7 insertions, 8 deletions
diff --git a/sys/netsmb/smb_iod.c b/sys/netsmb/smb_iod.c
index 29407b7a0567..e93787c3bb1d 100644
--- a/sys/netsmb/smb_iod.c
+++ b/sys/netsmb/smb_iod.c
@@ -557,9 +557,9 @@ smb_iod_sendall(struct smbiod *iod)
break;
case SMBRQ_SENT:
SMB_TRAN_GETPARAM(vcp, SMBTP_TIMEOUT, &tstimeout);
- timespecadd(&tstimeout, &tstimeout);
+ timespecadd(&tstimeout, &tstimeout, &tstimeout);
getnanotime(&ts);
- timespecsub(&ts, &tstimeout);
+ timespecsub(&ts, &tstimeout, &ts);
if (timespeccmp(&ts, &rqp->sr_timesent, >)) {
smb_iod_rqprocessed(rqp, ETIMEDOUT);
}
@@ -630,7 +630,7 @@ smb_iod_main(struct smbiod *iod)
#if 0
if (iod->iod_state == SMBIOD_ST_VCACTIVE) {
getnanotime(&tsnow);
- timespecsub(&tsnow, &iod->iod_pingtimo);
+ timespecsub(&tsnow, &iod->iod_pingtimo, &tsnow);
if (timespeccmp(&tsnow, &iod->iod_lastrqsent, >)) {
smb_smb_echo(vcp, &iod->iod_scred);
}
diff --git a/sys/netsmb/smb_trantcp.c b/sys/netsmb/smb_trantcp.c
index 2c2f7ed19908..8101993277a3 100644
--- a/sys/netsmb/smb_trantcp.c
+++ b/sys/netsmb/smb_trantcp.c
@@ -546,15 +546,14 @@ smb_nbst_connect(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td)
if (error)
return error;
getnanotime(&ts2);
- timespecsub(&ts2, &ts1);
+ timespecsub(&ts2, &ts1, &ts2);
if (ts2.tv_sec == 0) {
ts2.tv_sec = 1;
ts2.tv_nsec = 0;
}
- nbp->nbp_timo = ts2;
- timespecadd(&nbp->nbp_timo, &ts2);
- timespecadd(&nbp->nbp_timo, &ts2);
- timespecadd(&nbp->nbp_timo, &ts2); /* * 4 */
+ timespecadd(&ts2, &ts2, &nbp->nbp_timo);
+ timespecadd(&nbp->nbp_timo, &ts2, &nbp->nbp_timo);
+ timespecadd(&nbp->nbp_timo, &ts2, &nbp->nbp_timo); /* * 4 */
error = nbssn_rq_request(nbp, td);
if (error)
smb_nbst_disconnect(vcp, td);