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.33 2003/05/23 00:57:48 grog Exp $
   37  * $FreeBSD$
   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 extern struct mtx plexmutex[];                              /* mutexes for plexes to use */
   46 #else
   47 extern struct __vinum_conf vinum_conf;                      /* configuration information */
   48 #endif
   49 
   50 #ifdef VINUMDEBUG
   51 extern int debug;                                           /* debug flags */
   52 #endif
   53 
   54 /* Physical read and write drive */
   55 #define read_drive(a, b, c, d) driveio (a, b, c, d, BIO_READ)
   56 #define write_drive(a, b, c, d) driveio (a, b, c, d, BIO_WRITE)
   57 
   58 #define CHECKALLOC(ptr, msg) \
   59   if (ptr == NULL) \
   60     { \
   61     printf (msg); \
   62     longjmp (command_fail, -1); \
   63     }
   64 #ifndef _KERNEL
   65 struct vnode;
   66 struct thread;
   67 #endif
   68 
   69 #ifdef _KERNEL
   70 int vinum_inactive(int);
   71 void free_vinum(int);
   72 int give_sd_to_plex(int plexno, int sdno);
   73 void give_sd_to_drive(int sdno);
   74 int give_plex_to_volume(int, int, int);
   75 struct drive *check_drive(char *);
   76 enum drive_label_info read_drive_label(struct drive *, int);
   77 int parse_config(char *, struct keywordset *, int);
   78 int parse_user_config(char *cptr, struct keywordset *keyset);
   79 u_int64_t sizespec(char *spec);
   80 int volume_index(struct volume *volume);
   81 int plex_index(struct plex *plex);
   82 int sd_index(struct sd *sd);
   83 int drive_index(struct drive *drive);
   84 int my_plex(int volno, int plexno);
   85 int my_sd(int plexno, int sdno);
   86 int get_empty_drive(void);
   87 int find_drive(const char *name, int create);
   88 int find_drive_by_name(const char *devname, int create);
   89 int get_empty_sd(void);
   90 int find_subdisk(const char *name, int create);
   91 void return_drive_space(int driveno, int64_t offset, int length);
   92 void free_sd(int sdno);
   93 void free_volume(int volno);
   94 int get_empty_plex(void);
   95 int find_plex(const char *name, int create);
   96 void free_plex(int plexno);
   97 int get_empty_volume(void);
   98 int find_volume(const char *name, int create);
   99 void config_subdisk(int);
  100 void config_plex(int);
  101 void config_volume(int);
  102 void config_drive(int);
  103 void updateconfig(int);
  104 void update_sd_config(int sdno, int kernelstate);
  105 void update_plex_config(int plexno, int kernelstate);
  106 void update_volume_config(int volno);
  107 void update_config(void);
  108 void drive_io_done(struct buf *);
  109 void save_config(void);
  110 void daemon_save_config(void);
  111 void write_config(char *, int);
  112 int start_config(int);
  113 void finish_config(int);
  114 void remove(struct vinum_ioctl_msg *msg);
  115 void remove_drive_entry(int driveno, int force);
  116 void remove_sd_entry(int sdno, int force, int recurse);
  117 void remove_plex_entry(int plexno, int force, int recurse);
  118 void remove_volume_entry(int volno, int force, int recurse);
  119 
  120 void checkdiskconfig(char *);
  121 int open_drive(struct drive *, struct thread *, int);
  122 void close_drive(struct drive *drive);
  123 void close_locked_drive(struct drive *drive);
  124 int driveio(struct drive *, char *, size_t, off_t, int);
  125 int set_drive_parms(struct drive *drive);
  126 int init_drive(struct drive *, int);
  127 /* void throw_rude_remark (int, struct _ioctl_reply *, char *, ...); XXX */
  128 void throw_rude_remark(int, char *,...);
  129 
  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);
  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 
  144 int vinum_super_ioctl(struct cdev *, u_long, caddr_t);
  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(struct cdev *);
  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 #ifdef VINUMDEBUG
  164 void expand_table(void **, int, int, char *, int);
  165 #else
  166 void expand_table(void **, int, int);
  167 #endif
  168 
  169 struct disklabel;
  170 struct request;
  171 struct rqgroup *allocrqg(struct request *rq, int elements);
  172 void deallocrqg(struct rqgroup *rqg);
  173 
  174 /* Device number decoding */
  175 int Volno(struct cdev *x);
  176 int Plexno(struct cdev *x);
  177 int Sdno(struct cdev *x);
  178 
  179 /* State transitions */
  180 int set_drive_state(int driveno, enum drivestate state, enum setstateflags flags);
  181 int set_sd_state(int sdno, enum sdstate state, enum setstateflags flags);
  182 enum requeststatus checksdstate(struct sd *sd, struct request *rq, daddr_t diskaddr, daddr_t diskend);
  183 int set_plex_state(int plexno, enum plexstate state, enum setstateflags flags);
  184 int set_volume_state(int volumeno, enum volumestate state, enum setstateflags flags);
  185 void update_sd_state(int sdno);
  186 void forceup(int plexno);
  187 void update_plex_state(int plexno);
  188 void update_volume_state(int volno);
  189 void invalidate_subdisks(struct plex *, enum sdstate);
  190 void start_object(struct vinum_ioctl_msg *);
  191 void stop_object(struct vinum_ioctl_msg *);
  192 void setstate(struct vinum_ioctl_msg *msg);
  193 void setstate_by_force(struct vinum_ioctl_msg *msg);
  194 void vinum_label(int);
  195 int vinum_writedisklabel(struct volume *, struct disklabel *);
  196 int initsd(int, int);
  197 struct buf *parityrebuild(struct plex *, u_int64_t, int, enum parityop, struct rangelock **, off_t *);
  198 enum requeststatus sddownstate(struct request *rq);
  199 
  200 int restart_plex(int plexno);
  201 int revive_read(struct sd *sd);
  202 int revive_block(int sdno);
  203 void parityops(struct vinum_ioctl_msg *);
  204 
  205 /* Auxiliary functions */
  206 enum sdstates sdstatemap(struct plex *plex);
  207 enum volplexstate vpstate(struct plex *plex);
  208 #endif
  209 
  210 struct drive *validdrive(int driveno, struct _ioctl_reply *);
  211 struct sd *validsd(int sdno, struct _ioctl_reply *);
  212 struct plex *validplex(int plexno, struct _ioctl_reply *);
  213 struct volume *validvol(int volno, struct _ioctl_reply *);
  214 void resetstats(struct vinum_ioctl_msg *msg);
  215 
  216 /* Locking */
  217 #ifdef VINUMDEBUG
  218 int lockdrive(struct drive *drive, char *, int);
  219 #else
  220 int lockdrive(struct drive *drive);
  221 #endif
  222 void unlockdrive(struct drive *drive);
  223 int lockvol(struct volume *vol);
  224 void unlockvol(struct volume *vol);
  225 int lockplex(struct plex *plex);
  226 void unlockplex(struct plex *plex);
  227 struct rangelock *lockrange(daddr_t stripe, struct buf *bp, struct plex *plex);
  228 int lock_config(void);
  229 void unlock_config(void);
  230 
  231 /* Dæmon */
  232 
  233 void vinum_daemon(void);
  234 int vinum_finddaemon(void);
  235 int vinum_setdaemonopts(int);
  236 extern struct daemonq *daemonq;                             /* daemon's work queue */
  237 extern struct daemonq *dqend;                               /* and the end of the queue */
  238 extern struct cdevsw vinum_cdevsw;
  239 
  240 #undef Free                                                 /* defined in some funny net stuff */
  241 #ifdef _KERNEL
  242 #ifdef VINUMDEBUG
  243 #define Malloc(x)  MMalloc ((x), __FILE__, __LINE__)        /* show where we came from */
  244 #define Free(x)    FFree ((x), __FILE__, __LINE__)          /* show where we came from */
  245 caddr_t MMalloc(int size, char *, int);
  246 void FFree(void *mem, char *, int);
  247 #define LOCKDRIVE(d) lockdrive (d, __FILE__, __LINE__)
  248 #else
  249 #define Malloc(x)  malloc((x), M_DEVBUF, \
  250         curthread->td_intr_nesting_level == 0? M_WAITOK: M_NOWAIT)
  251 #define Free(x)    free((x), M_DEVBUF)
  252 #define LOCKDRIVE(d) lockdrive (d)
  253 #endif
  254 #else
  255 #define Malloc(x)  malloc ((x))                             /* just the size */
  256 #define Free(x)    free ((x))                               /* just the address */
  257 #endif
  258 
  259 /* Local Variables: */
  260 /* fill-column: 50 */
  261 /* End: */

Cache object: b57d7b4f21b5f5b6587b70cd133488ae


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