Print this page
XXXX introduce drv_sectohz

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/ddi.c
          +++ new/usr/src/uts/common/os/ddi.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  22   22  /*        All Rights Reserved   */
  23   23  
  24   24  
  25   25  /*
  26   26   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  27   27   * Use is subject to license terms.
  28   28   */
       29 +/*
       30 + * Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
       31 + */
  29   32  
  30   33  /*
  31   34   * UNIX Device Driver Interface functions
  32   35   *
  33   36   * This file contains functions that are to be added to the kernel
  34   37   * to put the interface presented to drivers in conformance with
  35   38   * the DDI standard. Of the functions added to the kernel, 17 are
  36   39   * function equivalents of existing macros in sysmacros.h,
  37   40   * stream.h, and param.h
  38   41   *
↓ open down ↓ 414 lines elided ↑ open up ↑
 453  456   * If ticks <= 0, return 0.
 454  457   * Otherwise, convert microseconds to ticks, rounding up.
 455  458   */
 456  459  clock_t
 457  460  drv_usectohz(clock_t microsecs)
 458  461  {
 459  462          if (microsecs <= 0)
 460  463                  return (0);
 461  464  
 462  465          return (USEC_TO_TICK_ROUNDUP(microsecs));
      466 +}
      467 +
      468 +/*
      469 + * Convert from seconds to system time units (hz).
      470 + *
      471 + * If secs <= 0, return 0.
      472 + * Otherwise, convert seconds to ticks, rounding up.
      473 + */
      474 +clock_t
      475 +drv_sectohz(clock_t secs)
      476 +{
      477 +        if (secs <= 0)
      478 +                return (0);
      479 +
      480 +        return (SEC_TO_TICK(secs));
 463  481  }
 464  482  
 465  483  #ifdef  sun
 466  484  /*
 467  485   * drv_usecwait implemented in each architecture's machine
 468  486   * specific code somewhere. For sparc, it is the alternate entry
 469  487   * to usec_delay (eventually usec_delay goes away). See
 470  488   * sparc/os/ml/sparc_subr.s
 471  489   */
 472  490  #endif
↓ open down ↓ 750 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX