Annotation of src/sys/dev/dm/dm_target_zero.c, revision 1.1.2.6

1.1.2.6 ! haad        1: /*        $NetBSD$      */
        !             2: 
1.1.2.1   haad        3: /*
                      4:  * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
                      5:  * All rights reserved.
                      6:  *
                      7:  * This code is derived from software contributed to The NetBSD Foundation
                      8:  * by Adam Hamsik.
                      9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     20:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     21:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     22:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     23:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     24:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     25:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     26:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     27:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     28:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     29:  * POSSIBILITY OF SUCH DAMAGE.
                     30:  */
                     31: 
                     32: 
                     33: /*
                     34:  * This file implements initial version of device-mapper zero target.
                     35:  */
                     36: #include <sys/types.h>
                     37: #include <sys/param.h>
                     38: 
                     39: #include <sys/buf.h>
                     40: #include <sys/errno.h>
                     41: #include <sys/ioctl.h>
                     42: #include <sys/ioccom.h>
                     43: #include <sys/kmem.h>
                     44: #include <sys/types.h>
                     45: #include <sys/param.h>
                     46: #include <sys/queue.h>
                     47: 
                     48: #include "dm.h"
                     49: 
                     50: /*
                     51:  * Zero target init function. This target doesn't need
                     52:  * target specific config area.
                     53:  */
                     54: int
1.1.2.4   haad       55: dm_target_zero_init(struct dm_dev *dmv, void **target_config, char *argv)
1.1.2.1   haad       56: {
                     57: 
                     58:        printf("Zero target init function called!!\n");
                     59: 
1.1.2.3   haad       60:        dmv->dev_type = DM_ZERO_DEV;
                     61:        
1.1.2.1   haad       62:        *target_config = NULL;
                     63:        
                     64:        return 0;
                     65: }
                     66: 
1.1.2.5   haad       67: /* Status routine called to get params string. */
                     68: char *
                     69: dm_target_zero_status(void *target_config)
                     70: {
                     71:        return NULL;
                     72: }      
                     73:        
                     74: 
1.1.2.1   haad       75: /*
                     76:  * This routine does IO operations.
                     77:  */
                     78: int
                     79: dm_target_zero_strategy(struct dm_table_entry *table_en, struct buf *bp)
                     80: {
                     81: 
1.1.2.2   haad       82:        printf("Zero target read function called %d!!\n", bp->b_bcount);
1.1.2.1   haad       83: 
                     84:        memset(bp->b_data, 0, bp->b_bcount); 
                     85:        bp->b_resid = 0; /* nestiobuf_done wants b_resid = 0 to be sure
                     86:                            that there is no other io to done  */
                     87:        
                     88:        biodone(bp);
                     89: 
                     90:        return 0;
                     91: }
                     92: 
                     93: /* Doesn't not need to do anything here. */
                     94: int
                     95: dm_target_zero_destroy(struct dm_table_entry *table_en)
                     96: {
1.1.2.5   haad       97:        table_en->target_config = NULL;
                     98:        
1.1.2.1   haad       99:        return 0;
                    100: }
                    101: 
                    102: /* Unsuported for this target. */
                    103: int
                    104: dm_target_zero_upcall(struct dm_table_entry *table_en, struct buf *bp)
                    105: {
                    106:        return 0;
                    107: }
                    108: 

CVSweb <webmaster@jp.NetBSD.org>