Print this page
    
re #13613 rb4516 Tunables needs volatile keyword
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/avs/ns/contract.h
          +++ new/usr/src/uts/common/avs/ns/contract.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  
    | 
      ↓ open down ↓ | 
    14 lines elided | 
    
      ↑ open up ↑ | 
  
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
       25 +/*
       26 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       27 + */
  25   28  
  26   29  /*
  27   30   * The sole purpose of this file is to document our violations of the DDI
  28   31   * in Solaris and to get ddict to run on the data services stack.
  29   32   * Definitions and declarations contained in this file are never compiled
  30   33   * into the code.  It is only included if we are running ddict on our src.
  31   34   *
  32   35   * IMPORTANT NOTE:
  33   36   * Many of the declarations are not correct. It does not matter.
  34   37   * Structure declarations only define the fields we require.
  35   38   * Structures which we use in an opaque manner are defined as void *
  36   39   */
  37   40  
  38   41  #ifndef _SYS_CONTRACT_H
  39   42  #define _SYS_CONTRACT_H
  40   43  
  41   44  #ifdef  __cplusplus
  42   45  extern "C" {
  43   46  #endif
  44   47  
  45   48  /*
  46   49   * Define our interfaces for nsctl because ddict is stupid
  47   50   * about intermodule dependencies
  48   51   */
  49   52  #include <sys/nsctl/nsctl_inter.h>
  50   53  
  51   54  /*
  52   55   * Define our ncall interfaces
  53   56   */
  54   57  #include <sys/nsctl/ncall_inter.h>
  55   58  
  56   59  /*
  57   60   * The STRUCT_DECL definitions in the ddict headers are fouled up
  58   61   * we include our own model.h here to redefine it to avoid errors.
  59   62   */
  60   63  #if !defined(_SunOS_5_6)
  61   64  #include <sys/nsctl/model.h>
  62   65  #endif
  63   66  
  64   67  /*
  65   68   * General violations
  66   69   * Everybody violates these
  67   70   * Why are they called ddi if it is not part of it?
  68   71   */
  69   72  
  70   73  #define DDI_PROP_NOTPROM 0
  71   74  
  72   75  int ddi_rele_driver(void) { }
  73   76  int ddi_hold_installed_driver(void) { }
  74   77  
  75   78  /*
  76   79   * SV module violations
  77   80   */
  78   81  void *curthread;
  79   82  int devcnt;
  80   83  
  81   84  /*
  82   85   * The following from vnode.h
  83   86   */
  84   87  typedef struct  vode {
  85   88          int v_lock;     /* SDBC uses this too */
  86   89          int v_type;     /* nskern too */
  87   90          int v_rdev;     /* nskern too */
  88   91  } vnode_t;
  89   92  
  90   93  #define FOLLOW 0
  91   94  #define NULLVPP NULL
  92   95  #define AT_RDEV 0
  93   96  #define VOP_GETATTR(vp, vap, f, cr) ((void)0)
  94   97  #define VN_RELE(vp) ((void)0)
  95   98  
  96   99  /*
  97  100   *  The fields we use from vattr_t
  98  101   */
  99  102  typedef struct vattr {
 100  103          uint_t  va_mask;
 101  104          dev_t   va_rdev;
 102  105          int     va_size;        /* nskern */
 103  106  } vattr_t;
 104  107  
 105  108  int lookupname(void, void, void, void, void) { }
 106  109  
 107  110  /*
 108  111   * End of SV module violations
 109  112   */
 110  113  
 111  114  /*
 112  115   * DSW/II module violations
 113  116   */
 114  117  
 115  118  /*
 116  119   * This is really bogus that ddict does not understand sys/inttypes.h
 117  120   */
 118  121  #define INT32_MIN       0
 119  122  #define INT32_MAX       0
 120  123  #define INT64_MAX       0
 121  124  
 122  125  /*
 123  126   * End of DSW/II module violations
 124  127   */
 125  128  
 126  129  /*
 127  130   * UNISTAT module violations
 128  131   */
 129  132  
 130  133  void mod_miscops;
 131  134  typedef enum { B_FALSE, B_TRUE } boolean_t;
 132  135  
 133  136  /*
 134  137   * End of UNISTAT module violations
 135  138   */
 136  139  
 137  140  /*
 138  141   * NSCTL module violations
 139  142   */
 140  143  #define ERESTART 0
 141  144  #define EUSERS 0
 142  145  #define ENAMETOOLONG 0
 143  146  #define ENOSYS  0
 144  147  #define FOPEN   0
 145  148  int ddi_name_to_major() { }
 146  149  /*
 147  150   * End of NSCTL module violations
  
    | 
      ↓ open down ↓ | 
    113 lines elided | 
    
      ↑ open up ↑ | 
  
 148  151   */
 149  152  
 150  153  /*
 151  154   * NSKERN module violations
 152  155   */
 153  156  #define UL_GETFSIZE     0
 154  157  #define USHRT_MAX       0
 155  158  
 156  159  typedef u_longlong_t    rlim64_t;
 157  160  int ulimit() { }
 158      -int maxphys;
      161 +volatile int maxphys;
 159  162  
 160  163  #define AT_SIZE 0
 161  164  #define VBLK    0
 162  165  #define VCHR    0
 163  166  #define VREG    0
 164  167  #define VLNK    0
 165  168  
 166  169  #define VOP_CLOSE(vp, f, c, o, cr)      ((void)0)
 167  170  #define VOP_RWLOCK(vp, w)       ((void)0)
 168  171  #define VOP_RWUNLOCK(vp, w)     ((void)0)
 169  172  #define VOP_READ(vp, uiop, iof, cr)     ((void)0)
 170  173  #define VOP_WRITE(vp, uiop, iof, cr)    ((void)0)
 171  174  
 172  175  int vn_open(char *pnamep, void seg, int filemode, int createmode,
 173  176                  struct vnode **vpp, void crwhy, mode_t umask) { }
 174  177  
 175  178  /*
 176  179   * End of NSKERN module violations
 177  180   */
 178  181  
 179  182  /*
 180  183   * NVRAM module violations
 181  184   */
 182  185  #define MMU_PAGESIZE    0
 183  186  
 184  187  #ifndef MAXNAMELEN
 185  188  #define MAXNAMELEN      1
 186  189  #endif
 187  190  
 188  191  #define DEVMAP_DEFAULTS 0
 189  192  #define PFN_INVALID     -1
 190  193  
 191  194  char hw_serial[1];
 192  195  int mmu_ptob(void arg) { }
 193  196  int roundup(void arg) { }
 194  197  
 195  198  /*
 196  199   * End of NVRAM module violations
 197  200   */
 198  201  
 199  202  /*
 200  203   * RDCSVR (SNDR) module
 201  204   * Contract PSARC 2001/699
 202  205   */
 203  206  #define DUP_DONE        0
 204  207  #define DUP_ERROR       0
 205  208  #define DUP_INPROGRESS  0
 206  209  #define DUP_NEW         0
 207  210  #define DUP_DROP        0
 208  211  
 209  212  #define RPC_MAXDATASIZE 0
 210  213  
 211  214  
 212  215  typedef void * file_t;          /* opaque */
 213  216  typedef void SVCXPRT;           /* opaque */
 214  217  typedef void SVCMASTERXPRT;     /* opaque */
 215  218  typedef void xdrproc_t;         /* opaque */
 216  219  typedef int enum_t;
 217  220  
 218  221  typedef struct svc_req {        /* required fields */
 219  222          int rq_vers;
 220  223          int rq_proc;
 221  224  } svc_req_t;
 222  225  
 223  226  void SVC_FREEARGS(void xprt, void a, void *b) { }
 224  227  void SVC_DUP(void xprt, void req, void i, void j, void *dr) { }
 225  228  void svcerr_systemerr(void xprt) { }
 226  229  void svcerr_noproc(void xprt) { }
 227  230  void SVC_DUPDONE(void xprt, void dr, void a, void b, void c) { }
 228  231  
 229  232  SVCXPRT *svc_tli_kcreate(void *f, void *n, void *b, void **x, void *t,
 230  233          uint_t c, uint_t d) { }
 231  234  
 232  235  /*
 233  236   * non-ddi not under contracts
 234  237   */
 235  238  struct netbuf {
 236  239          int     maxlen;
 237  240          int     len;
 238  241          char    *buf;
 239  242  }
 240  243  
 241  244  /*
 242  245   * End of RDCSRV module Contracts
 243  246   */
 244  247  
 245  248  /*
 246  249   * RDC (SNDR) module
 247  250   * Contract PSARC 2001/699
 248  251   */
 249  252  
 250  253  typedef u_longlong_t    rpcproc_t;
 251  254  typedef u_longlong_t    xdrproc_t;
 252  255  typedef u_longlong_t    rpcvers_t;
 253  256  #define __dontcare__    -1
 254  257  #define RPC_INTR 0
 255  258  #define RPC_SUCCESS     0
 256  259  #define RPC_TLIERROR    0
 257  260  #define RPC_XPRTFAILED  0
 258  261  #define RPC_VERSMISMATCH        0
 259  262  #define RPC_PROGVERSMISMATCH 0
 260  263  #define RPC_INPROGRESS  0
 261  264  
 262  265  #define ENOEXEC 0
 263  266  #define EBADF   0
 264  267  
 265  268  /*
 266  269   * XDR routines
 267  270   * from rpc/xdr.h
 268  271   */
 269  272  typedef void * XDR;     /* opaque */
 270  273  int xdr_void() { }
 271  274  int xdr_int() { }
 272  275  int xdr_union() { }
 273  276  int xdr_enum() { }
 274  277  int xdr_u_int() { }
 275  278  int xdr_u_longlong_t() { }
 276  279  int xdr_opaque() { }
 277  280  int xdr_bytes() { }
 278  281  int xdr_array() { }
 279  282  #define NULL_xdrproc_t ((xdrproc_t)0)
 280  283  
 281  284  /*
 282  285   * The following imported rpc/clnt.h
 283  286   */
 284  287  
 285  288  /* Client is mostly opaque exccept for the following */
 286  289  
 287  290  typedef struct __client {       /* required fields */
 288  291          void *cl_auth;
 289  292          bool_t cl_nosignal;
 290  293  } CLIENT;
 291  294  
 292  295  #define CLSET_PROGRESS  0
 293  296  #define KNC_STRSIZE     128
 294  297  struct knetconfig {
 295  298          unsigned int    knc_semantics;
 296  299          caddr_t         knc_protofmly;
 297  300          caddr_t         knc_proto;
 298  301          dev_t           knc_rdev;
 299  302  };
 300  303  
 301  304  void *clnt_sperrno() { }
 302  305  void IS_UNRECOVERABLE_RPC(a) { }
 303  306  void CLNT_CONTROL(cl, request, info) { }
 304  307  void AUTH_DESTROY(void *a) { }
 305  308  void CLNT_DESTROY(void *a) { }
 306  309  
 307  310  int clnt_tli_kcreate(void *a, void *b, void c, void d, void e, void f,
 308  311          void *g, void **h) { }
 309  312  
 310  313  int clnt_tli_kinit(void *h, void *config, void *addr, uint_t a, int b,
 311  314          void *c) { }
 312  315  
 313  316  void     CLNT_CALL(void, void, void, void, void, void, void) { }
 314  317  
 315  318  /*
 316  319   * The following imported from rpc/svc.h
 317  320   */
 318  321  void svc_sendreply() { }
 319  322  void svcerr_decode() { }
 320  323  void SVC_GETARGS() { }
 321  324  
 322  325  /*
 323  326   * The following imported from sys/file.h
 324  327   */
 325  328  
 326  329  void getf(void) { }
 327  330  void releasef(void) { }
 328  331  
 329  332  /*
 330  333   * Not under contract
 331  334   */
 332  335  void sigintr(void) { }
 333  336  void sigunintr(void) { }
 334  337  dev_t expldev() { }
 335  338  
 336  339  /*
 337  340   * End of RDC module
 338  341   */
 339  342  
 340  343  /*
 341  344   * SDBC module violations
 342  345   */
 343  346  
 344  347  /*
 345  348   *  devid uses internal structure
 346  349   *  from sys/ddi_impldefs.h
 347  350   */
 348  351  typedef struct impl_devid {
 349  352          uchar_t did_type_hi;
 350  353          uchar_t did_type_lo;
 351  354  } impl_devid_t;
 352  355  
 353  356  #define DEVID_GETTYPE(devid)  0
 354  357  #define DEVID_SCSI_SERIAL 0
 355  358  
 356  359  #define ENOLINK 0       /* NCALL too */
 357  360  #define E2BIG   0
 358  361  #define ENOENT 0
 359  362  #define EIDRM 0
 360  363  
 361  364  #define B_KERNBUF 0
 362  365  #define KSTAT_TYPE_RAW 0
 363  366  #define MAXPATHLEN 0
 364  367  
 365  368  #define VN_HOLD(bp) ((void)0)
 366  369  
 367  370  /* Page list IO stuff */
 368  371  typedef struct page {
 369  372          int v_count;    /* sdbc */
 370  373  } page_t;
 371  374  page_t kvp;             /* We use the kernel segment */
 372  375  int page_add(void) { }
 373  376  int page_find(void) { }
 374  377  int page_list_concat(void) { }
 375  378  int pageio_setup(void) { }
 376  379  int pageio_done(void) { }
 377  380  
 378  381  void kobj_getsymvalue(void) { }
 379  382  int ddi_dev_pathname(void) { }
 380  383  
 381  384  /*
 382  385   * HACK ALERT
 383  386   * struct buf hack for ddict.
 384  387   * SDBC currently violates in struct buf
 385  388   *      b_pages
 386  389   *      b_proc
 387  390   * which we will define as the pad fields for ddict since
 388  391   * we can not overload the definition of struct buf with our own stuff.
 389  392   */
 390  393  
 391  394  #define b_pages b_pad7  /* b_pages in struct buf */
 392  395  #define b_proc  b_pad8  /* b_proc in struct buf */
 393  396  #define b_forw  b_pad1  /* b_forw in struct buf */
 394  397  #define b_back  b_pad2  /* b_back in struct buf */
 395  398  
 396  399  /*
 397  400   * End of SDBC moduel violations
 398  401   */
 399  402  
 400  403  /*
 401  404   * SCMTEST module violations
 402  405   */
 403  406  
 404  407  #define ESRCH   0       /* NCALL too */
 405  408  
 406  409  /*
 407  410   * End of SCMTEST module violations
 408  411   */
 409  412  /*
 410  413   * SFTM module violations
 411  414   * Note: XXX This list is currently incomplete
 412  415   */
 413  416  
 414  417  typedef void * cqe_t;                   /* opaque */
 415  418  typedef void * fcal_packet_t;           /* opaque */
 416  419  typedef void * soc_response_t;          /* opaque */
 417  420  typedef void * la_els_logi_t;           /* opaque */
 418  421  typedef void * la_els_adisc_t;          /* opaque */
 419  422  typedef void * fcp_rsp_t;               /* opaque */
 420  423  typedef void * soc_request_t;           /* opaque */
 421  424  typedef void * els_payload_t;           /* opaque */
 422  425  typedef void * la_els_logo_t;           /* opaque */
 423  426  typedef void * fc_frame_header_t;       /* opaque */
 424  427  
 425  428  typedef struct la_els_prli_s {
 426  429          uchar_t         ls_code;
 427  430          uchar_t         page_length;
 428  431          ushort_t        payload_length;
 429  432          uchar_t         service_params[1];
 430  433  } la_els_prli_t;
 431  434  
 432  435  typedef la_els_prli_t la_els_prli_reply_t;
 433  436  typedef la_els_prli_t la_els_prlo_t;
 434  437  typedef la_els_prli_t la_els_prlo_reply_t;
 435  438  
 436  439  /*
 437  440   * The following from /usr/include/sys/fc4/fcp.h
 438  441   */
 439  442  typedef struct fcp_cntl {
 440  443          uchar_t cntl_reserved_1 : 5,
 441  444                  cntl_qtype      : 3;
 442  445          uchar_t cntl_kill_tsk   : 1,
 443  446                  cntl_clr_aca    : 1,
 444  447                  cntl_reset      : 1,
 445  448                  cntl_reserved_2 : 2,
 446  449                  cntl_clr_tsk    : 1,
 447  450                  cntl_abort_tsk  : 1,
 448  451                  cntl_reserved_3 : 1;
 449  452          uchar_t cntl_reserved_4 : 6,
 450  453                  cntl_read_data  : 1,
 451  454                  cntl_write_data : 1;
 452  455  } fcp_cntl_t;
 453  456  
 454  457  typedef struct fcp_ent_addr {
 455  458          ushort_t ent_addr_0;
 456  459          ushort_t ent_addr_1;
 457  460          ushort_t ent_addr_2;
 458  461          ushort_t ent_addr_3;
 459  462  } fcp_ent_addr_t;
 460  463  
 461  464  typedef struct fcp_cmd_s {
 462  465          fcp_ent_addr_t  fcp_ent_addr;
 463  466          fcp_cntl_t      fcp_cntl;
 464  467          uchar_t         fcp_cdb[1];
 465  468          int             fcp_data_len;
 466  469  } fcp_cmd_t;
 467  470  
 468  471  typedef struct fcal_transport {
 469  472          uchar_t dummy1;
 470  473          uchar_t dummy2;
 471  474  } fcal_transport_t;
 472  475  
 473  476  /*
 474  477   * End of SFTM module violations
 475  478   */
 476  479  
 477  480  /*
 478  481   * STE module violations
 479  482   */
 480  483  
 481  484  typedef void  la_wwn_t;         /* opaque */
 482  485  /* WWN formats from sys/fcal/fcal_linkapp.h */
 483  486  typedef union la_wwn {
 484  487          uchar_t         raw_wwn[8];
 485  488          struct {
 486  489                  uint_t  naa_id : 4;
 487  490                  uint_t  nport_id : 12;
 488  491                  uint_t  wwn_hi : 16;
 489  492                  uint_t  wwn_lo;
 490  493          } w;
 491  494  } la_wwn_t;
 492  495  
 493  496  insque(void) { }
 494  497  remque(void) { }
 495  498  snprintf(void) { }
 496  499  
 497  500  /*
 498  501   * STE uses inq_serial and inq_ackqreqq from struct scsi_inquiry
 499  502   */
 500  503  #define inq_serial      inq_pid
 501  504  #define inq_ackqreqq    inq_pid
 502  505  /*
 503  506   * End of STE module violations
 504  507   */
 505  508  
 506  509  /*
 507  510   * NCALL module violations
 508  511   */
 509  512  #define ENONET  0
 510  513  
 511  514  /* NCALLSRV */
 512  515  typedef int bool_t;
 513  516  
 514  517  /* NCALLIP */
 515  518  #ifndef TRUE
 516  519  #define TRUE    1
 517  520  #endif
 518  521  
 519  522  #ifndef FALSE
 520  523  #define FALSE   0
 521  524  #endif
 522  525  
 523  526  #define ERANGE  0
 524  527  #define ENODATA 0
 525  528  
 526  529  #define RPC_TIMEDOUT 0
 527  530  
 528  531  /*
 529  532   * End of NCALL violations
 530  533   */
 531  534  #ifdef  __cplusplus
 532  535  }
 533  536  #endif
 534  537  
 535  538  #endif /* _SYS_CONTRACT_H */
  
    | 
      ↓ open down ↓ | 
    367 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX