Print this page
NEX-9808 SMB3 persistent handles
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-9808 SMB3 persistent handles
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-4239 smbtorture create failures re. allocation size
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-2781 SMB2 credit handling needs work
SMB-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libfakekernel/common/clock.c
          +++ new/usr/src/lib/libfakekernel/common/clock.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       13 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  14   14   */
  15   15  
  16   16  
  17   17  #include <sys/types.h>
  18   18  #include <sys/time.h>
  19   19  #include <sys/thread.h>
  20   20  #include <sys/proc.h>
  21   21  
  22   22  #include <sys/poll.h>
  23   23  
↓ open down ↓ 51 lines elided ↑ open up ↑
  75   75  time_t
  76   76  gethrestime_sec(void)
  77   77  {
  78   78          return (time(NULL));
  79   79  }
  80   80  
  81   81  /* ARGSUSED */
  82   82  void
  83   83  scalehrtime(hrtime_t *t)
  84   84  {
       85 +}
       86 +
       87 +/*
       88 + * These functions are blatently stolen from the kernel.
       89 + * See the dissertation in the comments preceding the
       90 + * hrt2ts() and ts2hrt() functions in:
       91 + *      uts/common/os/timers.c
       92 + */
       93 +void
       94 +hrt2ts(hrtime_t hrt, timespec_t *tsp)
       95 +{
       96 +        uint32_t sec, nsec, tmp;
       97 +
       98 +        tmp = (uint32_t)(hrt >> 30);
       99 +        sec = tmp - (tmp >> 2);
      100 +        sec = tmp - (sec >> 5);
      101 +        sec = tmp + (sec >> 1);
      102 +        sec = tmp - (sec >> 6) + 7;
      103 +        sec = tmp - (sec >> 3);
      104 +        sec = tmp + (sec >> 1);
      105 +        sec = tmp + (sec >> 3);
      106 +        sec = tmp + (sec >> 4);
      107 +        tmp = (sec << 7) - sec - sec - sec;
      108 +        tmp = (tmp << 7) - tmp - tmp - tmp;
      109 +        tmp = (tmp << 7) - tmp - tmp - tmp;
      110 +        nsec = (uint32_t)hrt - (tmp << 9);
      111 +        while (nsec >= NANOSEC) {
      112 +                nsec -= NANOSEC;
      113 +                sec++;
      114 +        }
      115 +        tsp->tv_sec = (time_t)sec;
      116 +        tsp->tv_nsec = nsec;
      117 +}
      118 +
      119 +hrtime_t
      120 +ts2hrt(const timestruc_t *tsp)
      121 +{
      122 +        hrtime_t hrt;
      123 +
      124 +        hrt = tsp->tv_sec;
      125 +        hrt = (hrt << 7) - hrt - hrt - hrt;
      126 +        hrt = (hrt << 7) - hrt - hrt - hrt;
      127 +        hrt = (hrt << 7) - hrt - hrt - hrt;
      128 +        hrt = (hrt << 9) + tsp->tv_nsec;
      129 +        return (hrt);
  85  130  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX