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.2 2003/10/15 01:31:39 grog Exp $
   37  */
   38 
   39 /* vinumext.h: external definitions */
   40 
   41 /* *sigh* We still need this at the moment. */
   42 #ifdef _KERNEL
   43 extern struct _vinum_conf vinum_conf;                       /* configuration information */
   44 #else
   45 extern struct __vinum_conf vinum_conf;                      /* configuration information */
   46 #endif
   47 
   48 #ifdef VINUMDEBUG
   49 extern int debug;                                           /* debug flags */
   50 #endif
   51 
   52 /* Physical read and write drive */
   53 #define read_drive(a, b, c, d) driveio (a, b, c, d, B_READ)
   54 #define write_drive(a, b, c, d) driveio (a, b, c, d, B_WRITE)
   55 
   56 #define CHECKALLOC(ptr, msg) \
   57   if (ptr == NULL) \
   58     { \
   59     printf (msg); \
   60     longjmp (&command_fail); \
   61     }
   62 #ifndef _KERNEL
   63 struct vnode;
   64 struct proc;
   65 #endif
   66 
   67 #ifdef _KERNEL
   68 int vinum_inactive(int);
   69 void free_vinum(int);
   70 int give_sd_to_plex(int plexno, int sdno);
   71 void give_sd_to_drive(int sdno);
   72 int give_plex_to_volume(int volno, int plexno);
   73 struct drive *check_drive(char *);
   74 enum drive_label_info read_drive_label(struct drive *, int);
   75 int parse_config(char *, struct keywordset *, int);
   76 int parse_user_config(char *cptr, struct keywordset *keyset);
   77 u_int64_t sizespec(char *spec);
   78 int volume_index(struct volume *volume);
   79 int plex_index(struct plex *plex);
   80 int sd_index(struct sd *sd);
   81 int drive_index(struct drive *drive);
   82 int my_plex(int volno, int plexno);
   83 int my_sd(int plexno, int sdno);
   84 int get_empty_drive(void);
   85 int find_drive(const char *name, int create);
   86 int find_drive_by_name(const char *devname, int create);
   87 int get_empty_sd(void);
   88 int find_subdisk(const char *name, int create);
   89 void return_drive_space(int driveno, int64_t offset, int length);
   90 void free_sd(int sdno);
   91 void free_volume(int volno);
   92 int get_empty_plex(void);
   93 int find_plex(const char *name, int create);
   94 void free_plex(int plexno);
   95 int get_empty_volume(void);
   96 int find_volume(const char *name, int create);
   97 void config_subdisk(int);
   98 void config_plex(int);
   99 void config_volume(int);
  100 void config_drive(int);
  101 void updateconfig(int);
  102 void update_sd_config(int sdno, int kernelstate);
  103 void update_plex_config(int plexno, int kernelstate);
  104 void update_volume_config(int volno, int kernelstate);
  105 void update_config(void);
  106 void drive_io_done(struct buf *);
  107 void save_config(void);
  108 void daemon_save_config(void);
  109 void write_config(char *, int);
  110 int start_config(int);
  111 void finish_config(int);
  112 void remove(struct vinum_ioctl_msg *msg);
  113 void remove_drive_entry(int driveno, int force);
  114 void remove_sd_entry(int sdno, int force, int recurse);
  115 void remove_plex_entry(int plexno, int force, int recurse);
  116 void remove_volume_entry(int volno, int force, int recurse);
  117 
  118 void checkdiskconfig(char *);
  119 int open_drive(struct drive *, struct proc *, int);
  120 void close_drive(struct drive *drive);
  121 void close_locked_drive(struct drive *drive);
  122 int driveio(struct drive *, char *, size_t, off_t, int);
  123 int set_drive_parms(struct drive *drive);
  124 int init_drive(struct drive *, int);
  125 /* void throw_rude_remark (int, struct _ioctl_reply *, char *, ...); XXX */
  126 void throw_rude_remark(int, char *,...);
  127 
  128 void format_config(char *config, int len);
  129 void checkkernel(char *op);
  130 void free_drive(struct drive *drive);
  131 void down_drive(struct drive *drive);
  132 void remove_drive(int driveno);
  133 
  134 int vinum_scandisk(char *drivename[], int drives);
  135 
  136 /* I/O */
  137 dev_type_open (vinumopen);
  138 dev_type_close (vinumclose);
  139 dev_type_strategy (vinumstrategy);
  140 dev_type_ioctl (vinumioctl);
  141 dev_type_size(vinumsize);
  142 dev_type_dump(vinumdump);
  143 dev_type_read (vinumread);
  144 dev_type_write (vinumwrite);
  145 
  146 int vinum_super_ioctl(dev_t, u_long, caddr_t);
  147 int vinumstart(struct buf *bp, int reviveok);
  148 int launch_requests(struct request *rq, int reviveok);
  149 void sdio(struct buf *bp);
  150 
  151 /* XXX Do we need this? */
  152 int vinumpart(dev_t);
  153 
  154 extern label_t command_fail;                                /* return here if config fails */
  155 
  156 #ifdef VINUMDEBUG
  157 /* Memory allocation and request tracing */
  158 void vinum_meminfo(caddr_t data);
  159 int vinum_mallocinfo(caddr_t data);
  160 int vinum_rqinfo(caddr_t data);
  161 void LongJmp(label_t *);
  162 #else
  163 void longjmp(label_t *);                                    /* the kernel doesn't define this */
  164 #endif
  165 
  166 char *basename(char *);
  167 typedef int cmp_t __P((const void *, const void *));
  168 void qsort(void *a, size_t n, size_t es, cmp_t * cmp);
  169 void expand_table(void **, int, int);
  170 
  171 struct request;
  172 struct rqgroup *allocrqg(struct request *rq, int elements);
  173 void deallocrqg(struct rqgroup *rqg);
  174 
  175 /* Device number decoding */
  176 int Volno(dev_t x);
  177 int Plexno(dev_t x);
  178 int Sdno(dev_t x);
  179 
  180 /* State transitions */
  181 int set_drive_state(int driveno, enum drivestate state, enum setstateflags flags);
  182 int set_sd_state(int sdno, enum sdstate state, enum setstateflags flags);
  183 enum requeststatus checksdstate(struct sd *sd, struct request *rq, daddr_t diskaddr, daddr_t diskend);
  184 int set_plex_state(int plexno, enum plexstate state, enum setstateflags flags);
  185 int set_volume_state(int volumeno, enum volumestate state, enum setstateflags flags);
  186 void update_sd_state(int sdno);
  187 void forceup(int plexno);
  188 void update_plex_state(int plexno);
  189 void update_volume_state(int volno);
  190 void invalidate_subdisks(struct plex *, enum sdstate);
  191 void get_volume_label(char *name, int plexes, u_int64_t size, struct disklabel *lp);
  192 int write_volume_label(int);
  193 void start_object(struct vinum_ioctl_msg *);
  194 void stop_object(struct vinum_ioctl_msg *);
  195 void setstate(struct vinum_ioctl_msg *msg);
  196 void setstate_by_force(struct vinum_ioctl_msg *msg);
  197 void vinum_label(int);
  198 int vinum_writedisklabel(struct volume *, struct disklabel *);
  199 int initsd(int, int);
  200 struct buf *parityrebuild(struct plex *, u_int64_t, int, enum parityop, struct rangelock **, off_t *);
  201 enum requeststatus sddownstate(struct request *rq);
  202 
  203 int restart_plex(int plexno);
  204 int revive_read(struct sd *sd);
  205 int revive_block(int sdno);
  206 void parityops(struct vinum_ioctl_msg *);
  207 
  208 /* Auxiliary functions */
  209 enum sdstates sdstatemap(struct plex *plex);
  210 enum volplexstate vpstate(struct plex *plex);
  211 #endif
  212 
  213 struct drive *validdrive(int driveno, struct _ioctl_reply *);
  214 struct sd *validsd(int sdno, struct _ioctl_reply *);
  215 struct plex *validplex(int plexno, struct _ioctl_reply *);
  216 struct volume *validvol(int volno, struct _ioctl_reply *);
  217 void resetstats(struct vinum_ioctl_msg *msg);
  218 
  219 /* Locking */
  220 #ifdef VINUMDEBUG
  221 int lockdrive(struct drive *drive, char *, int);
  222 #else
  223 int lockdrive(struct drive *drive);
  224 #endif
  225 void unlockdrive(struct drive *drive);
  226 int lockvol(struct volume *vol);
  227 void unlockvol(struct volume *vol);
  228 int lockplex(struct plex *plex);
  229 void unlockplex(struct plex *plex);
  230 struct rangelock *lockrange(daddr_t stripe, struct buf *bp, struct plex *plex);
  231 int lock_config(void);
  232 void unlock_config(void);
  233 
  234 /* Dæmon */
  235 
  236 void vinum_daemon(void);
  237 int vinum_finddaemon(void);
  238 int vinum_setdaemonopts(int);
  239 extern struct daemonq *daemonq;                             /* daemon's work queue */
  240 extern struct daemonq *dqend;                               /* and the end of the queue */
  241 
  242 #undef Free                                                 /* defined in some funny net stuff */
  243 #ifdef _KERNEL
  244 #ifdef VINUMDEBUG
  245 #define Malloc(x)  MMalloc ((x), __FILE__, __LINE__)        /* show where we came from */
  246 #define Free(x)    FFree ((x), __FILE__, __LINE__)          /* show where we came from */
  247 caddr_t MMalloc(int size, char *, int);
  248 void FFree(void *mem, char *, int);
  249 #define LOCKDRIVE(d) lockdrive (d, __FILE__, __LINE__)
  250 #else
  251 /* kernel, no debug */
  252 #define Malloc(x)  malloc ((x), M_DEVBUF, M_NOWAIT)
  253 #define Free(x)    free((x), M_DEVBUF)
  254 #define LOCKDRIVE(d) lockdrive (d)
  255 #endif
  256 #else
  257 /* not kernel */
  258 #define Malloc(x)  malloc ((x))                             /* just the size */
  259 #define Free(x)    free ((x))                               /* just the address */
  260 #endif
  261 
  262 /* Local Variables: */
  263 /* fill-column: 50 */
  264 /* End: */

Cache object: 6d70b98f7275e6afc7f64b98849fc6b8


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