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/dev/vinum/vinumext.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) 1997, 1998
    3  *      Nan Yang Computer Services Limited.  All rights reserved.
    4  *
    5  *  This software is distributed under the so-called ``Berkeley
    6  *  License'':
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   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 the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by Nan Yang Computer
   19  *      Services Limited.
   20  * 4. Neither the name of the Company 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 ``as is'', and any express or implied
   25  * warranties, including, but not limited to, the implied warranties of
   26  * merchantability and fitness for a particular purpose are disclaimed.
   27  * In no event shall the company or contributors be liable for any
   28  * direct, indirect, incidental, special, exemplary, or consequential
   29  * damages (including, but not limited to, procurement of substitute
   30  * goods or services; loss of use, data, or profits; or business
   31  * interruption) however caused and on any theory of liability, whether
   32  * in contract, strict liability, or tort (including negligence or
   33  * otherwise) arising in any way out of the use of this software, even if
   34  * advised of the possibility of such damage.
   35  *
   36  * $Id: vinumext.h,v 1.27 2001/05/22 04:07:22 grog Exp grog $
   37  * $FreeBSD: releng/5.0/sys/dev/vinum/vinumext.h 103698 2002-09-20 17:14:48Z phk $
   38  */
   39 
   40 /* vinumext.h: external definitions */
   41 
   42 /* *sigh* We still need this at the moment. */
   43 #ifdef _KERNEL
   44 extern struct _vinum_conf vinum_conf;                       /* configuration information */
   45 #else
   46 extern struct __vinum_conf vinum_conf;                      /* configuration information */
   47 #endif
   48 
   49 #ifdef VINUMDEBUG
   50 extern int debug;                                           /* debug flags */
   51 #endif
   52 
   53 /* Physical read and write drive */
   54 #define read_drive(a, b, c, d) driveio (a, b, c, d, BIO_READ)
   55 #define write_drive(a, b, c, d) driveio (a, b, c, d, BIO_WRITE)
   56 
   57 #define CHECKALLOC(ptr, msg) \
   58   if (ptr == NULL) \
   59     { \
   60     printf (msg); \
   61     longjmp (command_fail, -1); \
   62     }
   63 #ifndef _KERNEL
   64 struct vnode;
   65 struct thread;
   66 #endif
   67 
   68 #ifdef _KERNEL
   69 int vinum_inactive(int);
   70 void free_vinum(int);
   71 int give_sd_to_plex(int plexno, int sdno);
   72 void give_sd_to_drive(int sdno);
   73 int give_plex_to_volume(int volno, int plexno);
   74 struct drive *check_drive(char *);
   75 enum drive_label_info read_drive_label(struct drive *, int);
   76 int parse_config(char *, struct keywordset *, int);
   77 int parse_user_config(char *cptr, struct keywordset *keyset);
   78 u_int64_t sizespec(char *spec);
   79 int volume_index(struct volume *volume);
   80 int plex_index(struct plex *plex);
   81 int sd_index(struct sd *sd);
   82 int drive_index(struct drive *drive);
   83 int my_plex(int volno, int plexno);
   84 int my_sd(int plexno, int sdno);
   85 int get_empty_drive(void);
   86 int find_drive(const char *name, int create);
   87 int find_drive_by_dev(const char *devname, int create);
   88 int get_empty_sd(void);
   89 int find_subdisk(const char *name, int create);
   90 void return_drive_space(int driveno, int64_t offset, int length);
   91 void free_sd(int sdno);
   92 void free_volume(int volno);
   93 int get_empty_plex(void);
   94 int find_plex(const char *name, int create);
   95 void free_plex(int plexno);
   96 int get_empty_volume(void);
   97 int find_volume(const char *name, int create);
   98 void config_subdisk(int);
   99 void config_plex(int);
  100 void config_volume(int);
  101 void config_drive(int);
  102 void updateconfig(int);
  103 void update_sd_config(int sdno, int kernelstate);
  104 void update_plex_config(int plexno, int kernelstate);
  105 void update_volume_config(int volno, int kernelstate);
  106 void update_config(void);
  107 void drive_io_done(struct buf *);
  108 void save_config(void);
  109 void daemon_save_config(void);
  110 void write_config(char *, int);
  111 int start_config(int);
  112 void finish_config(int);
  113 void remove(struct vinum_ioctl_msg *msg);
  114 void remove_drive_entry(int driveno, int force);
  115 void remove_sd_entry(int sdno, int force, int recurse);
  116 void remove_plex_entry(int plexno, int force, int recurse);
  117 void remove_volume_entry(int volno, int force, int recurse);
  118 
  119 void checkdiskconfig(char *);
  120 int open_drive(struct drive *, struct thread *, int);
  121 void close_drive(struct drive *drive);
  122 void close_locked_drive(struct drive *drive);
  123 int driveio(struct drive *, char *, size_t, off_t, int);
  124 int set_drive_parms(struct drive *drive);
  125 int init_drive(struct drive *, int);
  126 /* void throw_rude_remark (int, struct _ioctl_reply *, char *, ...); XXX */
  127 void throw_rude_remark(int, char *,...);
  128 
  129 /* XXX die die */
  130 void format_config(char *config, int len);
  131 void checkkernel(char *op);
  132 void free_drive(struct drive *drive);
  133 void down_drive(struct drive *drive);
  134 void remove_drive(int driveno);
  135 
  136 int vinum_scandisk(char *drivename[], int drives);
  137 
  138 /* I/O */
  139 d_open_t vinumopen;
  140 d_close_t vinumclose;
  141 d_strategy_t vinumstrategy;
  142 d_ioctl_t vinumioctl;
  143 d_psize_t vinumsize;
  144 
  145 int vinumstart(struct buf *bp, int reviveok);
  146 int launch_requests(struct request *rq, int reviveok);
  147 void sdio(struct buf *bp);
  148 
  149 /* XXX Do we need this? */
  150 int vinumpart(dev_t);
  151 
  152 extern jmp_buf command_fail;                                /* return here if config fails */
  153 
  154 #ifdef VINUMDEBUG
  155 /* Memory allocation and request tracing */
  156 void vinum_meminfo(caddr_t data);
  157 int vinum_mallocinfo(caddr_t data);
  158 int vinum_rqinfo(caddr_t data);
  159 void LongJmp(jmp_buf, int);
  160 char *basename(char *);
  161 #endif
  162 
  163 void expand_table(void **, int, int);
  164 
  165 struct disklabel;
  166 struct request;
  167 struct rqgroup *allocrqg(struct request *rq, int elements);
  168 void deallocrqg(struct rqgroup *rqg);
  169 
  170 /* Device number decoding */
  171 int Volno(dev_t x);
  172 int Plexno(dev_t x);
  173 int Sdno(dev_t x);
  174 
  175 /* State transitions */
  176 int set_drive_state(int driveno, enum drivestate state, enum setstateflags flags);
  177 int set_sd_state(int sdno, enum sdstate state, enum setstateflags flags);
  178 enum requeststatus checksdstate(struct sd *sd, struct request *rq, daddr_t diskaddr, daddr_t diskend);
  179 int set_plex_state(int plexno, enum plexstate state, enum setstateflags flags);
  180 int set_volume_state(int volumeno, enum volumestate state, enum setstateflags flags);
  181 void update_sd_state(int sdno);
  182 void forceup(int plexno);
  183 void update_plex_state(int plexno);
  184 void update_volume_state(int volno);
  185 void invalidate_subdisks(struct plex *, enum sdstate);
  186 void get_volume_label(char *name, int plexes, u_int64_t size, struct disklabel *lp);
  187 int write_volume_label(int);
  188 void start_object(struct vinum_ioctl_msg *);
  189 void stop_object(struct vinum_ioctl_msg *);
  190 void setstate(struct vinum_ioctl_msg *msg);
  191 void setstate_by_force(struct vinum_ioctl_msg *msg);
  192 void vinum_label(int);
  193 int vinum_writedisklabel(struct volume *, struct disklabel *);
  194 int initsd(int, int);
  195 struct buf *parityrebuild(struct plex *, u_int64_t, int, enum parityop, struct rangelock **, off_t *);
  196 enum requeststatus sddownstate(struct request *rq);
  197 
  198 int restart_plex(int plexno);
  199 int revive_read(struct sd *sd);
  200 int revive_block(int sdno);
  201 void parityops(struct vinum_ioctl_msg *);
  202 
  203 /* Auxiliary functions */
  204 enum sdstates sdstatemap(struct plex *plex);
  205 enum volplexstate vpstate(struct plex *plex);
  206 #endif
  207 
  208 struct drive *validdrive(int driveno, struct _ioctl_reply *);
  209 struct sd *validsd(int sdno, struct _ioctl_reply *);
  210 struct plex *validplex(int plexno, struct _ioctl_reply *);
  211 struct volume *validvol(int volno, struct _ioctl_reply *);
  212 void resetstats(struct vinum_ioctl_msg *msg);
  213 
  214 /* Locking */
  215 #ifdef VINUMDEBUG
  216 int lockdrive(struct drive *drive, char *, int);
  217 #else
  218 int lockdrive(struct drive *drive);
  219 #endif
  220 void unlockdrive(struct drive *drive);
  221 int lockvol(struct volume *vol);
  222 void unlockvol(struct volume *vol);
  223 int lockplex(struct plex *plex);
  224 void unlockplex(struct plex *plex);
  225 struct rangelock *lockrange(daddr_t stripe, struct buf *bp, struct plex *plex);
  226 int lock_config(void);
  227 void unlock_config(void);
  228 
  229 /* Dæmon */
  230 
  231 void vinum_daemon(void);
  232 int vinum_finddaemon(void);
  233 int vinum_setdaemonopts(int);
  234 extern struct daemonq *daemonq;                             /* daemon's work queue */
  235 extern struct daemonq *dqend;                               /* and the end of the queue */
  236 extern struct cdevsw vinum_cdevsw;
  237 
  238 #undef Free                                                 /* defined in some funny net stuff */
  239 #ifdef _KERNEL
  240 #ifdef VINUMDEBUG
  241 #define Malloc(x)  MMalloc ((x), __FILE__, __LINE__)        /* show where we came from */
  242 #define Free(x)    FFree ((x), __FILE__, __LINE__)          /* show where we came from */
  243 caddr_t MMalloc(int size, char *, int);
  244 void FFree(void *mem, char *, int);
  245 #define LOCKDRIVE(d) lockdrive (d, __FILE__, __LINE__)
  246 #else
  247 #define Malloc(x)  malloc((x), M_DEVBUF, \
  248         curthread->td_proc->p_intr_nesting_level == 0? M_WAITOK: M_NOWAIT)
  249 #define Free(x)    free((x), M_DEVBUF)
  250 #define LOCKDRIVE(d) lockdrive (d)
  251 #endif
  252 #else
  253 #define Malloc(x)  malloc ((x))                             /* just the size */
  254 #define Free(x)    free ((x))                               /* just the address */
  255 #endif
  256 
  257 /* Local Variables: */
  258 /* fill-column: 50 */
  259 /* End: */

Cache object: 9959f00ac3f3aaea181869ff7ba65f80


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