The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/syslink.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2004-2007 The DragonFly Project.  All rights reserved.
    3  * 
    4  * This code is derived from software contributed to The DragonFly Project
    5  * by Matthew Dillon <dillon@backplane.com>
    6  * 
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in
   15  *    the documentation and/or other materials provided with the
   16  *    distribution.
   17  * 3. Neither the name of The DragonFly Project nor the names of its
   18  *    contributors may be used to endorse or promote products derived
   19  *    from this software without specific, prior written permission.
   20  * 
   21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
   27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  *
   34  * $DragonFly: src/sys/sys/syslink.h,v 1.13 2007/08/13 17:47:20 dillon Exp $
   35  */
   36 
   37 /*
   38  * The syslink infrastructure implements an optimized RPC mechanism across a 
   39  * communications link.  RPC functions are grouped together into larger
   40  * protocols.  Prototypes are typically associated with system structures
   41  * but do not have to be.
   42  *
   43  * syslink      - Implements a communications end-point and protocol.  A
   44  *                syslink is typically directly embedded in a related
   45  *                structure.
   46  */
   47 
   48 #ifndef _SYS_SYSLINK_H_
   49 #define _SYS_SYSLINK_H_
   50 
   51 #ifndef _SYS_TYPES_H_
   52 #include <sys/types.h>
   53 #endif
   54 #ifndef _SYS_SYSID_H_
   55 #include <sys/sysid.h>
   56 #endif
   57 #ifndef _SYS_TREE_H_
   58 #include <sys/tree.h>
   59 #endif
   60 #ifndef _SYS_SYSLINK_MSG_H_
   61 #include <sys/syslink_msg.h>
   62 #endif
   63 
   64 /*
   65  * Additional headers are required to support kernel-only
   66  * data structures.
   67  */
   68 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
   69 #ifndef _SYS_BUF_H_
   70 #include <sys/buf.h>
   71 #endif
   72 #ifndef _SYS_BIO_H_
   73 #include <sys/bio.h>
   74 #endif
   75 #ifndef _SYS_MSGPORT_H_
   76 #include <sys/msgport.h>
   77 #endif
   78 #endif
   79 
   80 /***************************************************************************
   81  *                              PROTOCOL API/ABI                           *
   82  ***************************************************************************
   83  *
   84  * These structures implement the programming interface for end-points and
   85  * RPC calls.
   86  */
   87 
   88 struct syslink;
   89 struct syslink_desc;
   90 struct syslink_generic_args;
   91 
   92 typedef int (*syslink_func_t)(struct syslink_generic_args *);
   93 
   94 #define SYSLINK_CMD_NEW         0x00000001      /* create unassociated desc */
   95 
   96 /*
   97  * Typically an extension of the syslink_info structure is passed
   98  * to the kernel, or NULL for commands that do not need one.
   99  */
  100 struct syslink_info {
  101         int version;
  102         int wbflag;
  103         int reserved[2];
  104 };
  105 
  106 #define SYSLINK_INFO_VERSION    1
  107 
  108 /*
  109  * SYSLINK_CMD_NEW
  110  *
  111  *      Create a pair of syslink descriptors representing a two-way
  112  *      communications channel.
  113  */
  114 struct syslink_info_new {
  115         struct syslink_info head;
  116         int fds[2];
  117 };
  118 
  119 union syslink_info_all {
  120         struct syslink_info             head;
  121         struct syslink_info_new         cmd_new;
  122 };
  123 
  124 /*
  125  * Kernel-only data structures.
  126  */
  127 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
  128 
  129 /*
  130  * slmsg - internal kernel representation of a syslink message, organized
  131  *         as a LWKT message, out of band DMA buffer(s), and related memory.
  132  *         This structure is typically arranged via two object caches,
  133  *         one which maintains buffers for short syslink messages and one
  134  *         for long syslink messages.
  135  */
  136 TAILQ_HEAD(slmsgq,slmsg);
  137 RB_HEAD(slmsg_rb_tree, slmsg);
  138 RB_PROTOTYPE2(slmsg_rb_tree, slmsg, entry.rbnode, rb_slmsg_compare, sysid_t);
  139 
  140 struct slmsg {
  141         TAILQ_ENTRY(slmsg) tqnode;      /* inq */
  142         RB_ENTRY(slmsg) rbnode;         /* held for reply matching */
  143         int msgsize;
  144         int maxsize;
  145         int flags;
  146         caddr_t vmbase;                 /* memory mapped */
  147         size_t vmsize;
  148         struct xio xio;                 /* restricted xio */
  149         struct slmsg *rep;              /* reply (kernel backend) */
  150         struct objcache *oc;
  151         struct syslink_msg *msg;
  152         void (*callback_func)(struct slmsg *, void *, int);
  153         void *callback_data;
  154 };
  155 
  156 #define SLMSGF_ONINQ    0x0001
  157 #define SLMSGF_HASXIO   0x0002
  158 #define SLMSGF_LINMAP   0x0004
  159 
  160 #endif
  161 
  162 #if defined(_KERNEL)
  163 
  164 struct sldesc;
  165 int syslink_ukbackend(int *fdp, struct sldesc **kslp);
  166 struct slmsg *syslink_kallocmsg(void);
  167 int syslink_kdomsg(struct sldesc *ksl, struct slmsg *msg);
  168 int syslink_ksendmsg(struct sldesc *ksl, struct slmsg *msg,
  169                      void (*func)(struct slmsg *, void *, int), void *arg);
  170 int syslink_kwaitmsg(struct sldesc *ksl, struct slmsg *msg);
  171 void syslink_kfreemsg(struct sldesc *ksl, struct slmsg *msg);
  172 void syslink_kshutdown(struct sldesc *ksl, int how);
  173 void syslink_kclose(struct sldesc *ksl);
  174 int syslink_kdmabuf_pages(struct slmsg *slmsg, struct vm_page **mbase, int npages);
  175 int syslink_kdmabuf_data(struct slmsg *slmsg, char *base, int bytes);
  176 
  177 
  178 
  179 #else
  180 
  181 int syslink(int, struct syslink_info *, size_t);
  182 
  183 #endif
  184 
  185 #endif

Cache object: 0a273e14fd1a97f6a0c0d0f19af3c05b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.