Print this page
2976 remove useless offsetof() macros


  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #define _RDC_
  27 #include <sys/types.h>
  28 #include <sys/ksynch.h>
  29 #include <sys/kmem.h>
  30 #include <sys/errno.h>
  31 #include <sys/conf.h>
  32 #include <sys/cmn_err.h>
  33 #include <sys/modctl.h>
  34 #include <sys/cred.h>
  35 #include <sys/ddi.h>

  36 #include <sys/unistat/spcs_s.h>
  37 #include <sys/unistat/spcs_s_k.h>
  38 #include <sys/unistat/spcs_errors.h>
  39 
  40 #include <sys/nsc_thread.h>
  41 #ifdef DS_DDICT
  42 #include "../contract.h"
  43 #endif
  44 #include <sys/nsctl/nsctl.h>
  45 #include <sys/nsctl/nsvers.h>
  46 
  47 #include <sys/sdt.h>              /* dtrace is S10 or later */
  48 
  49 #include "rdc.h"
  50 #include "rdc_io.h"
  51 #include "rdc_bitmap.h"
  52 #include "rdc_ioctl.h"
  53 #include "rdcsrv.h"
  54 #include "rdc_diskq.h"
  55 


 504                 args->arg0 = (uint32_t)args32.arg0; /* char *  */
 505                 args->ustatus = (spcs_s_info_t)args32.ustatus;
 506                 break;
 507         case RDC_POOL_CREATE:
 508                 args->arg0 = (uint32_t)args32.arg0; /* svcpool_args *  */
 509                 break;
 510         case RDC_POOL_WAIT:
 511                 args->arg0 = (uint32_t)args32.arg0; /* int */
 512                 break;
 513         case RDC_POOL_RUN:
 514                 args->arg0 = (uint32_t)args32.arg0; /* int */
 515                 break;
 516 
 517         default:
 518                 return (EINVAL);
 519         }
 520 
 521         return (0);
 522 }
 523 
 524 
 525 /*
 526  * Yet another standard thing that is not standard ...
 527  */
 528 #ifndef offsetof
 529 #define offsetof(s, m)  ((size_t)(&((s *)0)->m))
 530 #endif
 531 
 532 /*
 533  * Build a 32bit rdc_set structure and copyout to the user level.
 534  */
 535 int
 536 rdc_status_copy32(const void *arg, void *usetp, size_t size, int mode)
 537 {
 538         rdc_u_info_t *urdc = (rdc_u_info_t *)arg;
 539         struct rdc_set32 set32;
 540         size_t tailsize;
 541 #ifdef DEBUG
 542         size_t tailsize32;
 543 #endif
 544 
 545         bzero(&set32, sizeof (set32));
 546 
 547         tailsize = sizeof (struct rdc_addr32) -
 548             offsetof(struct rdc_addr32, intf);
 549 
 550         /* primary address structure, avoiding netbuf */
 551         bcopy(&urdc->primary.intf[0], &set32.primary.intf[0], tailsize);




  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #define _RDC_
  27 #include <sys/types.h>
  28 #include <sys/ksynch.h>
  29 #include <sys/kmem.h>
  30 #include <sys/errno.h>
  31 #include <sys/conf.h>
  32 #include <sys/cmn_err.h>
  33 #include <sys/modctl.h>
  34 #include <sys/cred.h>
  35 #include <sys/ddi.h>
  36 #include <sys/sysmacros.h>
  37 #include <sys/unistat/spcs_s.h>
  38 #include <sys/unistat/spcs_s_k.h>
  39 #include <sys/unistat/spcs_errors.h>
  40 
  41 #include <sys/nsc_thread.h>
  42 #ifdef DS_DDICT
  43 #include "../contract.h"
  44 #endif
  45 #include <sys/nsctl/nsctl.h>
  46 #include <sys/nsctl/nsvers.h>
  47 
  48 #include <sys/sdt.h>              /* dtrace is S10 or later */
  49 
  50 #include "rdc.h"
  51 #include "rdc_io.h"
  52 #include "rdc_bitmap.h"
  53 #include "rdc_ioctl.h"
  54 #include "rdcsrv.h"
  55 #include "rdc_diskq.h"
  56 


 505                 args->arg0 = (uint32_t)args32.arg0; /* char *  */
 506                 args->ustatus = (spcs_s_info_t)args32.ustatus;
 507                 break;
 508         case RDC_POOL_CREATE:
 509                 args->arg0 = (uint32_t)args32.arg0; /* svcpool_args *  */
 510                 break;
 511         case RDC_POOL_WAIT:
 512                 args->arg0 = (uint32_t)args32.arg0; /* int */
 513                 break;
 514         case RDC_POOL_RUN:
 515                 args->arg0 = (uint32_t)args32.arg0; /* int */
 516                 break;
 517 
 518         default:
 519                 return (EINVAL);
 520         }
 521 
 522         return (0);
 523 }
 524 








 525 /*
 526  * Build a 32bit rdc_set structure and copyout to the user level.
 527  */
 528 int
 529 rdc_status_copy32(const void *arg, void *usetp, size_t size, int mode)
 530 {
 531         rdc_u_info_t *urdc = (rdc_u_info_t *)arg;
 532         struct rdc_set32 set32;
 533         size_t tailsize;
 534 #ifdef DEBUG
 535         size_t tailsize32;
 536 #endif
 537 
 538         bzero(&set32, sizeof (set32));
 539 
 540         tailsize = sizeof (struct rdc_addr32) -
 541             offsetof(struct rdc_addr32, intf);
 542 
 543         /* primary address structure, avoiding netbuf */
 544         bcopy(&urdc->primary.intf[0], &set32.primary.intf[0], tailsize);