Print this page
8115 parallel zfs mount
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.

  14  */
  15 
  16 #include <sys/types.h>
  17 #include <sys/time.h>
  18 #include <sys/thread.h>
  19 #include <sys/proc.h>
  20 #include <sys/zone.h>

  21 
  22 #include <sys/poll.h>
  23 
  24 #include <time.h>
  25 #include <stdlib.h>
  26 #include <unistd.h>

  27 
  28 #include <fakekernel.h>
  29 
  30 pri_t minclsyspri = 60;
  31 
  32 /* Some kernel code takes the address of this. */
  33 proc_t p0;
  34 
  35 proc_t *
  36 _curproc(void)
  37 {
  38         return (&p0);
  39 }
  40 
  41 zone_t zone0 = {
  42         .zone_name = "global",
  43         .zone_zsched = &p0, 0
  44 };
  45 
  46 zone_t *
  47 _curzone(void)
  48 {
  49         return (&zone0);
  50 }
  51 
  52 pid_t
  53 ddi_get_pid(void)
  54 {
  55         return ((pid_t)getpid());
  56 }
  57 




  58 int




























  59 ddi_strtoul(const char *str, char **endp, int base, unsigned long *res)
  60 {
  61         *res = strtoul(str, endp, base);


  62         return (0);
  63 }
  64 











  65 void
  66 delay(clock_t ticks)
  67 {
  68         int msec = ticks;  /* NB: hz==1000 */
  69         (void) poll(0, 0, msec);
  70 }
  71 


























  72 /*
  73  * This library does not really need an "init" function, but
  74  * providing one the main program can call is an easy way to
  75  * make sure this library is loaded into the debugger, and
  76  * gives us a way to avoid elfcheck complaints in the build.
  77  */
  78 void
  79 fakekernel_init(void)
  80 {
  81 }
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  14  * Copyright 2017 RackTop Systems.
  15  */
  16 
  17 #include <sys/types.h>
  18 #include <sys/time.h>
  19 #include <sys/thread.h>
  20 #include <sys/proc.h>
  21 #include <sys/zone.h>
  22 #include <sys/cyclic.h>
  23 
  24 #include <sys/poll.h>
  25 
  26 #include <time.h>
  27 #include <stdlib.h>
  28 #include <unistd.h>
  29 #include <errno.h>
  30 
  31 #include <fakekernel.h>
  32 
  33 pri_t minclsyspri = 60;
  34 
  35 /* Some kernel code takes the address of this. */
  36 proc_t p0;
  37 
  38 proc_t *
  39 _curproc(void)
  40 {
  41         return (&p0);
  42 }
  43 
  44 zone_t zone0 = {
  45         .zone_name = "global",
  46         .zone_zsched = &p0, 0
  47 };
  48 
  49 zone_t *
  50 _curzone(void)
  51 {
  52         return (&zone0);
  53 }
  54 
  55 pid_t
  56 ddi_get_pid(void)
  57 {
  58         return ((pid_t)getpid());
  59 }
  60 
  61 /*
  62  * Find highest one bit set.
  63  *      Returns bit number + 1 of highest bit that is set, otherwise returns 0.
  64  */
  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
  94 ddi_strtoul(const char *str, char **endp, int base, unsigned long *res)
  95 {
  96         *res = strtoul(str, endp, base);
  97         if (*res == 0)
  98                 return (errno);
  99         return (0);
 100 }
 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 
 113 void
 114 delay(clock_t ticks)
 115 {
 116         int msec = ticks;  /* NB: hz==1000 */
 117         (void) poll(0, 0, msec);
 118 }
 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 
 146 /*
 147  * This library does not really need an "init" function, but
 148  * providing one the main program can call is an easy way to
 149  * make sure this library is loaded into the debugger, and
 150  * gives us a way to avoid elfcheck complaints in the build.
 151  */
 152 void
 153 fakekernel_init(void)
 154 {
 155 }