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.125 2006/11/04 09:30:00 elad 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 #include <sys/queue.h>
   47 
   48 struct buf;
   49 struct knote;
   50 struct lwp;
   51 struct tty;
   52 struct uio;
   53 struct vnode;
   54 
   55 /*
   56  * Types for d_type
   57  */
   58 #define D_OTHER 0
   59 #define D_TAPE  1
   60 #define D_DISK  2
   61 #define D_TTY   3
   62 
   63 /*
   64  * Block device switch table
   65  */
   66 struct bdevsw {
   67         int             (*d_open)(dev_t, int, int, struct lwp *);
   68         int             (*d_close)(dev_t, int, int, struct lwp *);
   69         void            (*d_strategy)(struct buf *);
   70         int             (*d_ioctl)(dev_t, u_long, caddr_t, int, struct lwp *);
   71         int             (*d_dump)(dev_t, daddr_t, caddr_t, size_t);
   72         int             (*d_psize)(dev_t);
   73         int             d_type;
   74 };
   75 
   76 /*
   77  * Character device switch table
   78  */
   79 struct cdevsw {
   80         int             (*d_open)(dev_t, int, int, struct lwp *);
   81         int             (*d_close)(dev_t, int, int, struct lwp *);
   82         int             (*d_read)(dev_t, struct uio *, int);
   83         int             (*d_write)(dev_t, struct uio *, int);
   84         int             (*d_ioctl)(dev_t, u_long, caddr_t, int, struct lwp *);
   85         void            (*d_stop)(struct tty *, int);
   86         struct tty *    (*d_tty)(dev_t);
   87         int             (*d_poll)(dev_t, int, struct lwp *);
   88         paddr_t         (*d_mmap)(dev_t, off_t, int);
   89         int             (*d_kqfilter)(dev_t, struct knote *);
   90         int             d_type;
   91 };
   92 
   93 #ifdef _KERNEL
   94 
   95 #define DEV_STRATEGY(bp) \
   96         do { \
   97                 const struct bdevsw *bdev = bdevsw_lookup((bp)->b_dev); \
   98                 if (bdev == NULL) \
   99                         panic("DEV_STRATEGY: block device not found"); \
  100                 (*bdev->d_strategy)((bp)); \
  101         } while (/*CONSTCOND*/0)
  102 
  103 int devsw_attach(const char *, const struct bdevsw *, int *,
  104                  const struct cdevsw *, int *);
  105 void devsw_detach(const struct bdevsw *, const struct cdevsw *);
  106 const struct bdevsw *bdevsw_lookup(dev_t);
  107 const struct cdevsw *cdevsw_lookup(dev_t);
  108 int bdevsw_lookup_major(const struct bdevsw *);
  109 int cdevsw_lookup_major(const struct cdevsw *);
  110 
  111 #define dev_type_open(n)        int n (dev_t, int, int, struct lwp *)
  112 #define dev_type_close(n)       int n (dev_t, int, int, struct lwp *)
  113 #define dev_type_read(n)        int n (dev_t, struct uio *, int)
  114 #define dev_type_write(n)       int n (dev_t, struct uio *, int)
  115 #define dev_type_ioctl(n) \
  116                 int n (dev_t, u_long, caddr_t, int, struct lwp *)
  117 #define dev_type_stop(n)        void n (struct tty *, int)
  118 #define dev_type_tty(n)         struct tty * n (dev_t)
  119 #define dev_type_poll(n)        int n (dev_t, int, struct lwp *)
  120 #define dev_type_mmap(n)        paddr_t n (dev_t, off_t, int)
  121 #define dev_type_strategy(n)    void n (struct buf *)
  122 #define dev_type_dump(n)        int n (dev_t, daddr_t, caddr_t, size_t)
  123 #define dev_type_size(n)        int n (dev_t)
  124 #define dev_type_kqfilter(n)    int n (dev_t, struct knote *)
  125 
  126 #define noopen          ((dev_type_open((*)))enodev)
  127 #define noclose         ((dev_type_close((*)))enodev)
  128 #define noread          ((dev_type_read((*)))enodev)
  129 #define nowrite         ((dev_type_write((*)))enodev)
  130 #define noioctl         ((dev_type_ioctl((*)))enodev)
  131 #define nostop          ((dev_type_stop((*)))enodev)
  132 #define notty           NULL
  133 #define nopoll          seltrue
  134 #define nommap          ((dev_type_mmap((*)))enodev)
  135 #define nodump          ((dev_type_dump((*)))enodev)
  136 #define nosize          NULL
  137 #define nokqfilter      seltrue_kqfilter
  138 
  139 #define nullopen        ((dev_type_open((*)))nullop)
  140 #define nullclose       ((dev_type_close((*)))nullop)
  141 #define nullread        ((dev_type_read((*)))nullop)
  142 #define nullwrite       ((dev_type_write((*)))nullop)
  143 #define nullioctl       ((dev_type_ioctl((*)))nullop)
  144 #define nullstop        ((dev_type_stop((*)))nullop)
  145 #define nullpoll        ((dev_type_poll((*)))nullop)
  146 #define nullmmap        ((dev_type_mmap((*)))nullop)
  147 #define nulldump        ((dev_type_dump((*)))nullop)
  148 #define nullkqfilter    ((dev_type_kqfilter((*)))eopnotsupp)
  149 
  150 /* symbolic sleep message strings */
  151 extern  const char devopn[], devio[], devwait[], devin[], devout[];
  152 extern  const char devioc[], devcls[];
  153 
  154 #endif /* _KERNEL */
  155 
  156 /*
  157  * Line discipline switch table
  158  */
  159 struct linesw {
  160         const char *l_name;     /* Linesw name */
  161 
  162         LIST_ENTRY(linesw) l_list;
  163         u_int   l_refcnt;       /* locked by ttyldisc_list_slock */
  164         int     l_no;           /* legacy discipline number (for TIOCGETD) */
  165 
  166         int     (*l_open)       (dev_t, struct tty *);
  167         int     (*l_close)      (struct tty *, int);
  168         int     (*l_read)       (struct tty *, struct uio *, int);
  169         int     (*l_write)      (struct tty *, struct uio *, int);
  170         int     (*l_ioctl)      (struct tty *, u_long, caddr_t, int,
  171                                     struct lwp *);
  172         int     (*l_rint)       (int, struct tty *);
  173         int     (*l_start)      (struct tty *);
  174         int     (*l_modem)      (struct tty *, int);
  175         int     (*l_poll)       (struct tty *, int, struct lwp *);
  176 };
  177 
  178 #ifdef _KERNEL
  179 int            ttyldisc_attach(struct linesw *);
  180 int            ttyldisc_detach(struct linesw *);
  181 struct linesw *ttyldisc_lookup(const char *);
  182 struct linesw *ttyldisc_lookup_bynum(int);
  183 struct linesw *ttyldisc_default(void);
  184 void           ttyldisc_release(struct linesw *);
  185 
  186 /* For those defining their own line disciplines: */
  187 #define ttynodisc ((int (*)(dev_t, struct tty *))enodev)
  188 #define ttyerrclose ((int (*)(struct tty *, int))enodev)
  189 #define ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev)
  190 #define ttyerrinput ((int (*)(int, struct tty *))enodev)
  191 #define ttyerrstart ((int (*)(struct tty *))enodev)
  192 
  193 int     ttyerrpoll (struct tty *, int, struct lwp *);
  194 int     ttynullioctl(struct tty *, u_long, caddr_t, int, struct lwp *);
  195 
  196 int     iskmemdev(dev_t);
  197 #endif
  198 
  199 #ifdef _KERNEL
  200 
  201 #define DEV_MEM         0       /* minor device 0 is physical memory */
  202 #define DEV_KMEM        1       /* minor device 1 is kernel memory */
  203 #define DEV_NULL        2       /* minor device 2 is EOF/rathole */
  204 #ifdef COMPAT_16
  205 #define _DEV_ZERO_oARM  3       /* reserved: old ARM /dev/zero minor */
  206 #endif
  207 #define DEV_ZERO        12      /* minor device 12 is '\0'/rathole */
  208 
  209 #endif /* _KERNEL */
  210 
  211 struct devsw_conv {
  212         const char *d_name;
  213         int d_bmajor;
  214         int d_cmajor;
  215 };
  216 
  217 #ifdef _KERNEL
  218 const char *devsw_blk2name(int);
  219 int devsw_name2blk(const char *, char *, size_t);
  220 dev_t devsw_chr2blk(dev_t);
  221 dev_t devsw_blk2chr(dev_t);
  222 #endif /* _KERNEL */
  223 
  224 #ifdef _KERNEL
  225 struct  device;
  226 void    setroot(struct device *, int);
  227 void    swapconf(void);
  228 #endif /* _KERNEL */
  229 
  230 #endif /* !_SYS_CONF_H_ */

Cache object: f5f44725752ef1f9a77f3bf65ec6ed9a


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