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/conf.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 /*      $NetBSD: conf.h,v 1.115 2004/01/25 18:06:49 hannken Exp $       */
    2 
    3 /*-
    4  * Copyright (c) 1990, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    6  * (c) UNIX System Laboratories, Inc.
    7  * All or some portions of this file are derived from material licensed
    8  * to the University of California by American Telephone and Telegraph
    9  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
   10  * the permission of UNIX System Laboratories, Inc.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  * 1. Redistributions of source code must retain the above copyright
   16  *    notice, this list of conditions and the following disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  * 3. Neither the name of the University nor the names of its contributors
   21  *    may be used to endorse or promote products derived from this software
   22  *    without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  *      @(#)conf.h      8.5 (Berkeley) 1/9/95
   37  */
   38 
   39 #ifndef _SYS_CONF_H_
   40 #define _SYS_CONF_H_
   41 
   42 /*
   43  * Definitions of device driver entry switches
   44  */
   45 
   46 struct buf;
   47 struct knote;
   48 struct proc;
   49 struct tty;
   50 struct uio;
   51 struct vnode;
   52 
   53 /*
   54  * Types for d_type
   55  */
   56 #define D_TAPE  1
   57 #define D_DISK  2
   58 #define D_TTY   3
   59 
   60 /*
   61  * Block device switch table
   62  */
   63 struct bdevsw {
   64         int             (*d_open)(dev_t, int, int, struct proc *);
   65         int             (*d_close)(dev_t, int, int, struct proc *);
   66         void            (*d_strategy)(struct buf *);
   67         int             (*d_ioctl)(dev_t, u_long, caddr_t, int, struct proc *);
   68         int             (*d_dump)(dev_t, daddr_t, caddr_t, size_t);
   69         int             (*d_psize)(dev_t);
   70         int             d_type;
   71 };
   72 
   73 /*
   74  * Character device switch table
   75  */
   76 struct cdevsw {
   77         int             (*d_open)(dev_t, int, int, struct proc *);
   78         int             (*d_close)(dev_t, int, int, struct proc *);
   79         int             (*d_read)(dev_t, struct uio *, int);
   80         int             (*d_write)(dev_t, struct uio *, int);
   81         int             (*d_ioctl)(dev_t, u_long, caddr_t, int, struct proc *);
   82         void            (*d_stop)(struct tty *, int);
   83         struct tty *    (*d_tty)(dev_t);
   84         int             (*d_poll)(dev_t, int, struct proc *);
   85         paddr_t         (*d_mmap)(dev_t, off_t, int);
   86         int             (*d_kqfilter)(dev_t dev, struct knote *kn);
   87         int             d_type;
   88 };
   89 
   90 #ifdef _KERNEL
   91 
   92 #define DEV_STRATEGY(bp) \
   93         do { \
   94                 const struct bdevsw *bdev = bdevsw_lookup((bp)->b_dev); \
   95                 if (bdev == NULL) \
   96                         panic("DEV_STRATEGY: block device not found"); \
   97                 (*bdev->d_strategy)((bp)); \
   98         } while (/*CONSTCOND*/0)
   99 
  100 int devsw_attach(const char *, const struct bdevsw *, int *,
  101                  const struct cdevsw *, int *);
  102 void devsw_detach(const struct bdevsw *, const struct cdevsw *);
  103 const struct bdevsw *bdevsw_lookup(dev_t);
  104 const struct cdevsw *cdevsw_lookup(dev_t);
  105 int bdevsw_lookup_major(const struct bdevsw *);
  106 int cdevsw_lookup_major(const struct cdevsw *);
  107 
  108 #define dev_type_open(n)        int n (dev_t, int, int, struct proc *)
  109 #define dev_type_close(n)       int n (dev_t, int, int, struct proc *)
  110 #define dev_type_read(n)        int n (dev_t, struct uio *, int)
  111 #define dev_type_write(n)       int n (dev_t, struct uio *, int)
  112 #define dev_type_ioctl(n) \
  113                 int n (dev_t, u_long, caddr_t, int, struct proc *)
  114 #define dev_type_stop(n)        void n (struct tty *, int)
  115 #define dev_type_tty(n)         struct tty * n (dev_t)
  116 #define dev_type_poll(n)        int n (dev_t, int, struct proc *)
  117 #define dev_type_mmap(n)        paddr_t n (dev_t, off_t, int)
  118 #define dev_type_strategy(n)    void n (struct buf *)
  119 #define dev_type_dump(n)        int n (dev_t, daddr_t, caddr_t, size_t)
  120 #define dev_type_size(n)        int n (dev_t)
  121 #define dev_type_kqfilter(n)    int n (dev_t, struct knote *)
  122 
  123 #define noopen          ((dev_type_open((*)))enodev)
  124 #define noclose         ((dev_type_close((*)))enodev)
  125 #define noread          ((dev_type_read((*)))enodev)
  126 #define nowrite         ((dev_type_write((*)))enodev)
  127 #define noioctl         ((dev_type_ioctl((*)))enodev)
  128 #define nostop          ((dev_type_stop((*)))enodev)
  129 #define notty           NULL
  130 #define nopoll          seltrue
  131 #define nommap          ((dev_type_mmap((*)))enodev)
  132 #define nodump          ((dev_type_dump((*)))enodev)
  133 #define nosize          NULL
  134 #define nokqfilter      seltrue_kqfilter
  135 
  136 #define nullopen        ((dev_type_open((*)))nullop)
  137 #define nullclose       ((dev_type_close((*)))nullop)
  138 #define nullread        ((dev_type_read((*)))nullop)
  139 #define nullwrite       ((dev_type_write((*)))nullop)
  140 #define nullioctl       ((dev_type_ioctl((*)))nullop)
  141 #define nullstop        ((dev_type_stop((*)))nullop)
  142 #define nullpoll        ((dev_type_poll((*)))nullop)
  143 #define nullmmap        ((dev_type_mmap((*)))nullop)
  144 #define nulldump        ((dev_type_dump((*)))nullop)
  145 #define nullkqfilter    ((dev_type_kqfilter((*)))eopnotsupp)
  146 
  147 /* symbolic sleep message strings */
  148 extern  const char devopn[], devio[], devwait[], devin[], devout[];
  149 extern  const char devioc[], devcls[];
  150 
  151 #endif /* _KERNEL */
  152 
  153 /*
  154  * Line discipline switch table
  155  */
  156 struct linesw {
  157         char    *l_name;        /* Linesw name */
  158         int     l_no;           /* Linesw number (compatibility) */
  159 
  160         int     (*l_open)       __P((dev_t, struct tty *));
  161         int     (*l_close)      __P((struct tty *, int));
  162         int     (*l_read)       __P((struct tty *, struct uio *, int));
  163         int     (*l_write)      __P((struct tty *, struct uio *, int));
  164         int     (*l_ioctl)      __P((struct tty *, u_long, caddr_t, int,
  165                                     struct proc *));
  166         int     (*l_rint)       __P((int, struct tty *));
  167         int     (*l_start)      __P((struct tty *));
  168         int     (*l_modem)      __P((struct tty *, int));
  169         int     (*l_poll)       __P((struct tty *, int, struct proc *));
  170 };
  171 
  172 #ifdef _KERNEL
  173 extern struct linesw **linesw;
  174 extern int nlinesw;
  175 extern void ttyldisc_init __P((void));
  176 int ttyldisc_add __P((struct linesw *, int));
  177 struct linesw *ttyldisc_remove __P((char *));
  178 struct linesw *ttyldisc_lookup __P((char *));
  179 
  180 /* For those defining their own line disciplines: */
  181 #define ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev)
  182 #define ttyerrclose ((int (*) __P((struct tty *, int)))enodev)
  183 #define ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev)
  184 #define ttyerrinput ((int (*) __P((int, struct tty *)))enodev)
  185 #define ttyerrstart ((int (*) __P((struct tty *)))enodev)
  186 #define ttyerrpoll ((int (*) __P((struct tty *, int, struct proc *)))enodev)
  187 
  188 int     ttynullioctl __P((struct tty *, u_long, caddr_t, int, struct proc *));
  189 #endif
  190 
  191 #ifdef _KERNEL
  192 
  193 #define DEV_MEM         0       /* minor device 0 is physical memory */
  194 #define DEV_KMEM        1       /* minor device 1 is kernel memory */
  195 #define DEV_NULL        2       /* minor device 2 is EOF/rathole */
  196 #ifdef COMPAT_16
  197 #define _DEV_ZERO_oARM  3       /* reserved: old ARM /dev/zero minor */
  198 #endif
  199 #define DEV_ZERO        12      /* minor device 12 is '\0'/rathole */
  200 
  201 #endif /* _KERNEL */
  202 
  203 struct devsw_conv {
  204         const char *d_name;
  205         int d_bmajor;
  206         int d_cmajor;
  207 };
  208 
  209 #ifdef _KERNEL
  210 const char *devsw_blk2name(int);
  211 int devsw_name2blk(const char *, char *, size_t);
  212 dev_t devsw_chr2blk(dev_t);
  213 dev_t devsw_blk2chr(dev_t);
  214 #endif /* _KERNEL */
  215 
  216 #ifdef _KERNEL
  217 struct  device;
  218 void    setroot __P((struct device *, int));
  219 void    swapconf __P((void));
  220 #endif /* _KERNEL */
  221 
  222 #endif /* !_SYS_CONF_H_ */

Cache object: d9050f781ec0c7f3291634803843b2b7


[ 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.