diff options
| author | haad <haad@NetBSD.org> | 2010-01-04 00:12:22 +0000 |
|---|---|---|
| committer | haad <haad@NetBSD.org> | 2010-01-04 00:12:22 +0000 |
| commit | 293fc00622d830d19d388458bc8774c17cb97ef9 (patch) | |
| tree | d0a8d7a6e9bdb93138f8759d71a314ca04874b36 /sys/dev/dm/dm_target_linear.c | |
| parent | 1ee1eb05c32ccacc20d4b0b1e218fb18ee8b3f4d (diff) | |
Indent files remove unnecessary blank lines, white spaces and KNFize code.
Diffstat (limited to 'sys/dev/dm/dm_target_linear.c')
| -rw-r--r-- | sys/dev/dm/dm_target_linear.c | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/sys/dev/dm/dm_target_linear.c b/sys/dev/dm/dm_target_linear.c index 62429a94843..a6a93611e2d 100644 --- a/sys/dev/dm/dm_target_linear.c +++ b/sys/dev/dm/dm_target_linear.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_target_linear.c,v 1.8 2009/12/01 23:12:10 haad Exp $ */ +/* $NetBSD: dm_target_linear.c,v 1.9 2010/01/04 00:14:41 haad Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -48,56 +48,55 @@ /* * Allocate target specific config data, and link them to table. * This function is called only when, flags is not READONLY and - * therefore we can add things to pdev list. This should not a + * therefore we can add things to pdev list. This should not a * problem because this routine is called only from dm_table_load_ioctl. * @argv[0] is name, * @argv[1] is physical data offset. */ int -dm_target_linear_init(dm_dev_t *dmv, void **target_config, char *params) +dm_target_linear_init(dm_dev_t * dmv, void **target_config, char *params) { dm_target_linear_config_t *tlc; dm_pdev_t *dmp; char **ap, *argv[3]; - if(params == NULL) + if (params == NULL) return EINVAL; - + /* * Parse a string, containing tokens delimited by white space, * into an argument vector */ for (ap = argv; ap < &argv[2] && - (*ap = strsep(¶ms, " \t")) != NULL;) { + (*ap = strsep(¶ms, " \t")) != NULL;) { if (**ap != '\0') ap++; } aprint_debug("Linear target init function called %s--%s!!\n", argv[0], argv[1]); - + /* Insert dmp to global pdev list */ if ((dmp = dm_pdev_insert(argv[0])) == NULL) return ENOENT; - + if ((tlc = kmem_alloc(sizeof(dm_target_linear_config_t), KM_SLEEP)) == NULL) return ENOMEM; tlc->pdev = dmp; - tlc->offset = 0; /* default settings */ - + tlc->offset = 0; /* default settings */ + /* Check user input if it is not leave offset as 0. */ tlc->offset = atoi(argv[1]); - *target_config = tlc; + *target_config = tlc; dmv->dev_type = DM_LINEAR_DEV; - + return 0; } - /* * Status routine is called to get params string, which is target * specific. When dm_table_status_ioctl is called with flag @@ -115,39 +114,37 @@ dm_target_linear_status(void *target_config) if ((params = kmem_alloc(DM_MAX_PARAMS_SIZE, KM_NOSLEEP)) == NULL) return NULL; - aprint_normal("%s %"PRIu64, tlc->pdev->name, tlc->offset); - snprintf(params, DM_MAX_PARAMS_SIZE,"%s %"PRIu64, + aprint_normal("%s %" PRIu64, tlc->pdev->name, tlc->offset); + snprintf(params, DM_MAX_PARAMS_SIZE, "%s %" PRIu64, tlc->pdev->name, tlc->offset); return params; } - /* * Do IO operation, called from dmstrategy routine. */ int -dm_target_linear_strategy(dm_table_entry_t *table_en, struct buf *bp) +dm_target_linear_strategy(dm_table_entry_t * table_en, struct buf * bp) { dm_target_linear_config_t *tlc; tlc = table_en->target_config; - + /* printf("Linear target read function called %" PRIu64 "!!\n", tlc->offset);*/ bp->b_blkno += tlc->offset; - + VOP_STRATEGY(tlc->pdev->pdev_vnode, bp); - + return 0; } - /* * Destroy target specific data. Decrement table pdevs. */ int -dm_target_linear_destroy(dm_table_entry_t *table_en) +dm_target_linear_destroy(dm_table_entry_t * table_en) { dm_target_linear_config_t *tlc; @@ -155,58 +152,55 @@ dm_target_linear_destroy(dm_table_entry_t *table_en) * Destroy function is called for every target even if it * doesn't have target_config. */ - + if (table_en->target_config == NULL) return 0; - + tlc = table_en->target_config; - + /* Decrement pdev ref counter if 0 remove it */ dm_pdev_decr(tlc->pdev); - + /* Unbusy target so we can unload it */ dm_target_unbusy(table_en->target); - + kmem_free(table_en->target_config, sizeof(dm_target_linear_config_t)); table_en->target_config = NULL; - + return 0; } - /* Add this target pdev dependiences to prop_array_t */ int -dm_target_linear_deps(dm_table_entry_t *table_en, prop_array_t prop_array) +dm_target_linear_deps(dm_table_entry_t * table_en, prop_array_t prop_array) { dm_target_linear_config_t *tlc; struct vattr va; - + int error; - + if (table_en->target_config == NULL) return ENOENT; - + tlc = table_en->target_config; - + if ((error = VOP_GETATTR(tlc->pdev->pdev_vnode, &va, curlwp->l_cred)) != 0) return error; - - prop_array_add_uint64(prop_array, (uint64_t)va.va_rdev); - + + prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev); + return 0; } - /* * Register upcall device. * Linear target doesn't need any upcall devices but other targets like * mirror, snapshot, multipath, stripe will use this functionality. */ int -dm_target_linear_upcall(dm_table_entry_t *table_en, struct buf *bp) +dm_target_linear_upcall(dm_table_entry_t * table_en, struct buf * bp) { return 0; } - /* * Transform char s to uint64_t offset number. */ |
