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.131.8.1 2009/06/23 06:56:51 snj 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         0x0000
   59 #define D_TAPE          0x0001
   60 #define D_DISK          0x0002
   61 #define D_TTY           0x0003
   62 #define D_TYPEMASK      0x00ff
   63 #define D_MPSAFE        0x0100
   64 #define D_NEGOFFSAFE    0x0200
   65 
   66 /*
   67  * Block device switch table
   68  */
   69 struct bdevsw {
   70         int             (*d_open)(dev_t, int, int, struct lwp *);
   71         int             (*d_close)(dev_t, int, int, struct lwp *);
   72         void            (*d_strategy)(struct buf *);
   73         int             (*d_ioctl)(dev_t, u_long, void *, int, struct lwp *);
   74         int             (*d_dump)(dev_t, daddr_t, void *, size_t);
   75         int             (*d_psize)(dev_t);
   76         int             d_flag;
   77 };
   78 
   79 /*
   80  * Character device switch table
   81  */
   82 struct cdevsw {
   83         int             (*d_open)(dev_t, int, int, struct lwp *);
   84         int             (*d_close)(dev_t, int, int, struct lwp *);
   85         int             (*d_read)(dev_t, struct uio *, int);
   86         int             (*d_write)(dev_t, struct uio *, int);
   87         int             (*d_ioctl)(dev_t, u_long, void *, int, struct lwp *);
   88         void            (*d_stop)(struct tty *, int);
   89         struct tty *    (*d_tty)(dev_t);
   90         int             (*d_poll)(dev_t, int, struct lwp *);
   91         paddr_t         (*d_mmap)(dev_t, off_t, int);
   92         int             (*d_kqfilter)(dev_t, struct knote *);
   93         int             d_flag;
   94 };
   95 
   96 #ifdef _KERNEL
   97 
   98 int devsw_attach(const char *, const struct bdevsw *, int *,
   99                  const struct cdevsw *, int *);
  100 int devsw_detach(const struct bdevsw *, const struct cdevsw *);
  101 const struct bdevsw *bdevsw_lookup(dev_t);
  102 const struct cdevsw *cdevsw_lookup(dev_t);
  103 int bdevsw_lookup_major(const struct bdevsw *);
  104 int cdevsw_lookup_major(const struct cdevsw *);
  105 
  106 #define dev_type_open(n)        int n (dev_t, int, int, struct lwp *)
  107 #define dev_type_close(n)       int n (dev_t, int, int, struct lwp *)
  108 #define dev_type_read(n)        int n (dev_t, struct uio *, int)
  109 #define dev_type_write(n)       int n (dev_t, struct uio *, int)
  110 #define dev_type_ioctl(n) \
  111                 int n (dev_t, u_long, void *, int, struct lwp *)
  112 #define dev_type_stop(n)        void n (struct tty *, int)
  113 #define dev_type_tty(n)         struct tty * n (dev_t)
  114 #define dev_type_poll(n)        int n (dev_t, int, struct lwp *)
  115 #define dev_type_mmap(n)        paddr_t n (dev_t, off_t, int)
  116 #define dev_type_strategy(n)    void n (struct buf *)
  117 #define dev_type_dump(n)        int n (dev_t, daddr_t, void *, size_t)
  118 #define dev_type_size(n)        int n (dev_t)
  119 #define dev_type_kqfilter(n)    int n (dev_t, struct knote *)
  120 
  121 #define noopen          ((dev_type_open((*)))enodev)
  122 #define noclose         ((dev_type_close((*)))enodev)
  123 #define noread          ((dev_type_read((*)))enodev)
  124 #define nowrite         ((dev_type_write((*)))enodev)
  125 #define noioctl         ((dev_type_ioctl((*)))enodev)
  126 #define nostop          ((dev_type_stop((*)))enodev)
  127 #define notty           NULL
  128 #define nopoll          seltrue
  129 #define nommap          ((dev_type_mmap((*)))enodev)
  130 #define nodump          ((dev_type_dump((*)))enodev)
  131 #define nosize          NULL
  132 #define nokqfilter      seltrue_kqfilter
  133 
  134 #define nullopen        ((dev_type_open((*)))nullop)
  135 #define nullclose       ((dev_type_close((*)))nullop)
  136 #define nullread        ((dev_type_read((*)))nullop)
  137 #define nullwrite       ((dev_type_write((*)))nullop)
  138 #define nullioctl       ((dev_type_ioctl((*)))nullop)
  139 #define nullstop        ((dev_type_stop((*)))nullop)
  140 #define nullpoll        ((dev_type_poll((*)))nullop)
  141 #define nullmmap        ((dev_type_mmap((*)))nullop)
  142 #define nulldump        ((dev_type_dump((*)))nullop)
  143 #define nullkqfilter    ((dev_type_kqfilter((*)))eopnotsupp)
  144 
  145 /* device access wrappers. */
  146 
  147 dev_type_open(bdev_open);
  148 dev_type_close(bdev_close);
  149 dev_type_strategy(bdev_strategy);
  150 dev_type_ioctl(bdev_ioctl);
  151 dev_type_dump(bdev_dump);
  152 
  153 dev_type_open(cdev_open);
  154 dev_type_close(cdev_close);
  155 dev_type_read(cdev_read);
  156 dev_type_write(cdev_write);
  157 dev_type_ioctl(cdev_ioctl);
  158 dev_type_stop(cdev_stop);
  159 dev_type_tty(cdev_tty);
  160 dev_type_poll(cdev_poll);
  161 dev_type_mmap(cdev_mmap);
  162 dev_type_kqfilter(cdev_kqfilter);
  163 
  164 int     cdev_type(dev_t);
  165 int     bdev_type(dev_t);
  166 
  167 /* symbolic sleep message strings */
  168 extern  const char devopn[], devio[], devwait[], devin[], devout[];
  169 extern  const char devioc[], devcls[];
  170 
  171 #endif /* _KERNEL */
  172 
  173 /*
  174  * Line discipline switch table
  175  */
  176 struct linesw {
  177         const char *l_name;     /* Linesw name */
  178 
  179         LIST_ENTRY(linesw) l_list;
  180         u_int   l_refcnt;       /* locked by ttyldisc_list_slock */
  181         int     l_no;           /* legacy discipline number (for TIOCGETD) */
  182 
  183         int     (*l_open)       (dev_t, struct tty *);
  184         int     (*l_close)      (struct tty *, int);
  185         int     (*l_read)       (struct tty *, struct uio *, int);
  186         int     (*l_write)      (struct tty *, struct uio *, int);
  187         int     (*l_ioctl)      (struct tty *, u_long, void *, int,
  188                                     struct lwp *);
  189         int     (*l_rint)       (int, struct tty *);
  190         int     (*l_start)      (struct tty *);
  191         int     (*l_modem)      (struct tty *, int);
  192         int     (*l_poll)       (struct tty *, int, struct lwp *);
  193 };
  194 
  195 #ifdef _KERNEL
  196 void           ttyldisc_init(void);
  197 int            ttyldisc_attach(struct linesw *);
  198 int            ttyldisc_detach(struct linesw *);
  199 struct linesw *ttyldisc_lookup(const char *);
  200 struct linesw *ttyldisc_lookup_bynum(int);
  201 struct linesw *ttyldisc_default(void);
  202 void           ttyldisc_release(struct linesw *);
  203 
  204 /* For those defining their own line disciplines: */
  205 #define ttynodisc ((int (*)(dev_t, struct tty *))enodev)
  206 #define ttyerrclose ((int (*)(struct tty *, int))enodev)
  207 #define ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev)
  208 #define ttyerrinput ((int (*)(int, struct tty *))enodev)
  209 #define ttyerrstart ((int (*)(struct tty *))enodev)
  210 
  211 int     ttyerrpoll (struct tty *, int, struct lwp *);
  212 int     ttynullioctl(struct tty *, u_long, void *, int, struct lwp *);
  213 
  214 int     iskmemdev(dev_t);
  215 int     seltrue_kqfilter(dev_t, struct knote *);
  216 #endif
  217 
  218 #ifdef _KERNEL
  219 
  220 #define DEV_MEM         0       /* minor device 0 is physical memory */
  221 #define DEV_KMEM        1       /* minor device 1 is kernel memory */
  222 #define DEV_NULL        2       /* minor device 2 is EOF/rathole */
  223 #ifdef COMPAT_16
  224 #define _DEV_ZERO_oARM  3       /* reserved: old ARM /dev/zero minor */
  225 #endif
  226 #define DEV_ZERO        12      /* minor device 12 is '\0'/rathole */
  227 
  228 #endif /* _KERNEL */
  229 
  230 struct devsw_conv {
  231         const char *d_name;
  232         int d_bmajor;
  233         int d_cmajor;
  234 };
  235 
  236 #ifdef _KERNEL
  237 void devsw_init(void);
  238 const char *devsw_blk2name(int);
  239 int devsw_name2blk(const char *, char *, size_t);
  240 int devsw_name2chr(const char *, char *, size_t);
  241 dev_t devsw_chr2blk(dev_t);
  242 dev_t devsw_blk2chr(dev_t);
  243 #endif /* _KERNEL */
  244 
  245 #ifdef _KERNEL
  246 struct  device;
  247 void    setroot(struct device *, int);
  248 void    swapconf(void);
  249 #endif /* _KERNEL */
  250 
  251 #endif /* !_SYS_CONF_H_ */

Cache object: f34fa5a590807e2c2b0184c44b570c24


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