Print this page
8115 parallel zfs mount

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libfakekernel/common/kmisc.c
          +++ new/usr/src/lib/libfakekernel/common/kmisc.c
↓ open down ↓ 3 lines elided ↑ open up ↑
   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   13   * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
       14 + * Copyright 2017 RackTop Systems.
  14   15   */
  15   16  
  16   17  #include <sys/types.h>
  17   18  #include <sys/time.h>
  18   19  #include <sys/thread.h>
  19   20  #include <sys/proc.h>
  20   21  #include <sys/zone.h>
       22 +#include <sys/cyclic.h>
  21   23  
  22   24  #include <sys/poll.h>
  23   25  
  24   26  #include <time.h>
  25   27  #include <stdlib.h>
  26   28  #include <unistd.h>
       29 +#include <errno.h>
  27   30  
  28   31  #include <fakekernel.h>
  29   32  
  30   33  pri_t minclsyspri = 60;
  31   34  
  32   35  /* Some kernel code takes the address of this. */
  33   36  proc_t p0;
  34   37  
  35   38  proc_t *
  36   39  _curproc(void)
↓ open down ↓ 11 lines elided ↑ open up ↑
  48   51  {
  49   52          return (&zone0);
  50   53  }
  51   54  
  52   55  pid_t
  53   56  ddi_get_pid(void)
  54   57  {
  55   58          return ((pid_t)getpid());
  56   59  }
  57   60  
       61 +/*
       62 + * Find highest one bit set.
       63 + *      Returns bit number + 1 of highest bit that is set, otherwise returns 0.
       64 + */
  58   65  int
       66 +highbit64(uint64_t i)
       67 +{
       68 +        int h = 1;
       69 +
       70 +        if (i == 0)
       71 +                return (0);
       72 +        if (i & 0xffffffff00000000ULL) {
       73 +                h += 32; i >>= 32;
       74 +        }
       75 +        if (i & 0xffff0000) {
       76 +                h += 16; i >>= 16;
       77 +        }
       78 +        if (i & 0xff00) {
       79 +                h += 8; i >>= 8;
       80 +        }
       81 +        if (i & 0xf0) {
       82 +                h += 4; i >>= 4;
       83 +        }
       84 +        if (i & 0xc) {
       85 +                h += 2; i >>= 2;
       86 +        }
       87 +        if (i & 0x2) {
       88 +                h += 1;
       89 +        }
       90 +        return (h);
       91 +}
       92 +
       93 +int
  59   94  ddi_strtoul(const char *str, char **endp, int base, unsigned long *res)
  60   95  {
  61   96          *res = strtoul(str, endp, base);
       97 +        if (*res == 0)
       98 +                return (errno);
  62   99          return (0);
  63  100  }
  64  101  
      102 +int
      103 +ddi_strtoull(const char *str, char **nptr, int base, u_longlong_t *res)
      104 +{
      105 +        char *end;
      106 +
      107 +        *res = strtoull(str, &end, base);
      108 +        if (*res == 0)
      109 +                return (errno);
      110 +        return (0);
      111 +}
      112 +
  65  113  void
  66  114  delay(clock_t ticks)
  67  115  {
  68  116          int msec = ticks;  /* NB: hz==1000 */
  69  117          (void) poll(0, 0, msec);
  70  118  }
  71  119  
      120 +int
      121 +issig(int why)
      122 +{
      123 +        return (0);
      124 +}
      125 +
      126 +/* ARGSUSED */
      127 +cyclic_id_t
      128 +cyclic_add(cyc_handler_t *hdlr, cyc_time_t *when)
      129 +{
      130 +        return (1);
      131 +}
      132 +
      133 +/* ARGSUSED */
      134 +void
      135 +cyclic_remove(cyclic_id_t id)
      136 +{
      137 +}
      138 +
      139 +/* ARGSUSED */
      140 +int
      141 +cyclic_reprogram(cyclic_id_t id, hrtime_t expiration)
      142 +{
      143 +        return (1);
      144 +}
      145 +
  72  146  /*
  73  147   * This library does not really need an "init" function, but
  74  148   * providing one the main program can call is an easy way to
  75  149   * make sure this library is loaded into the debugger, and
  76  150   * gives us a way to avoid elfcheck complaints in the build.
  77  151   */
  78  152  void
  79  153  fakekernel_init(void)
  80  154  {
  81  155  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX