Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dm Indent files remove unnecessary blank lines, whit...
details: https://anonhg.NetBSD.org/src/rev/1aef3807290d
branches: trunk
changeset: 750516:1aef3807290d
user: haad <haad%NetBSD.org@localhost>
date: Mon Jan 04 00:12:22 2010 +0000
description:
Indent files remove unnecessary blank lines, white spaces and KNFize code.
diffstat:
sys/dev/dm/dm_dev.c | 215 ++++++++++++-------------
sys/dev/dm/dm_ioctl.c | 332 +++++++++++++++++++--------------------
sys/dev/dm/dm_pdev.c | 71 +++----
sys/dev/dm/dm_table.c | 78 ++++-----
sys/dev/dm/dm_target.c | 103 +++++------
sys/dev/dm/dm_target_error.c | 44 ++---
sys/dev/dm/dm_target_linear.c | 74 ++++----
sys/dev/dm/dm_target_mirror.c | 44 ++---
sys/dev/dm/dm_target_snapshot.c | 222 ++++++++++++--------------
sys/dev/dm/dm_target_stripe.c | 85 ++++-----
sys/dev/dm/dm_target_zero.c | 52 ++---
11 files changed, 608 insertions(+), 712 deletions(-)
diffs (truncated from 3442 to 300 lines):
diff -r cef8af024128 -r 1aef3807290d sys/dev/dm/dm_dev.c
--- a/sys/dev/dm/dm_dev.c Sun Jan 03 23:03:20 2010 +0000
+++ b/sys/dev/dm/dm_dev.c Mon Jan 04 00:12:22 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_dev.c,v 1.7 2009/12/29 23:37:48 haad Exp $ */
+/* $NetBSD: dm_dev.c,v 1.8 2010/01/04 00:19:08 haad Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -41,9 +41,9 @@
#include "netbsd-dm.h"
#include "dm.h"
-static dm_dev_t* dm_dev_lookup_name(const char *);
-static dm_dev_t* dm_dev_lookup_uuid(const char *);
-static dm_dev_t* dm_dev_lookup_minor(int);
+static dm_dev_t *dm_dev_lookup_name(const char *);
+static dm_dev_t *dm_dev_lookup_uuid(const char *);
+static dm_dev_t *dm_dev_lookup_minor(int);
static struct dm_dev_head dm_dev_list =
TAILQ_HEAD_INITIALIZER(dm_dev_list);
@@ -52,90 +52,88 @@
/* dm_dev_mutex must be holdby caller before using disable_dev. */
__inline static void
-disable_dev(dm_dev_t *dmv)
+disable_dev(dm_dev_t * dmv)
{
- TAILQ_REMOVE(&dm_dev_list, dmv, next_devlist);
- mutex_enter(&dmv->dev_mtx);
- mutex_exit(&dm_dev_mutex);
- while(dmv->ref_cnt != 0)
- cv_wait(&dmv->dev_cv, &dmv->dev_mtx);
- mutex_exit(&dmv->dev_mtx);
-}
-
+ TAILQ_REMOVE(&dm_dev_list, dmv, next_devlist);
+ mutex_enter(&dmv->dev_mtx);
+ mutex_exit(&dm_dev_mutex);
+ while (dmv->ref_cnt != 0)
+ cv_wait(&dmv->dev_cv, &dmv->dev_mtx);
+ mutex_exit(&dmv->dev_mtx);
+}
/*
- * Generic function used to lookup dm_dev_t. Calling with dm_dev_name
+ * Generic function used to lookup dm_dev_t. Calling with dm_dev_name
* and dm_dev_uuid NULL is allowed.
*/
-dm_dev_t*
+dm_dev_t *
dm_dev_lookup(const char *dm_dev_name, const char *dm_dev_uuid,
- int dm_dev_minor)
+ int dm_dev_minor)
{
dm_dev_t *dmv;
-
+
dmv = NULL;
mutex_enter(&dm_dev_mutex);
-
- /* KASSERT(dm_dev_name != NULL && dm_dev_uuid != NULL && dm_dev_minor > 0); */
+
+ /* KASSERT(dm_dev_name != NULL && dm_dev_uuid != NULL && dm_dev_minor
+ * > 0); */
if (dm_dev_minor > 0)
- if ((dmv = dm_dev_lookup_minor(dm_dev_minor)) != NULL){
+ if ((dmv = dm_dev_lookup_minor(dm_dev_minor)) != NULL) {
+ dm_dev_busy(dmv);
+ mutex_exit(&dm_dev_mutex);
+ return dmv;
+ }
+ if (dm_dev_name != NULL)
+ if ((dmv = dm_dev_lookup_name(dm_dev_name)) != NULL) {
dm_dev_busy(dmv);
mutex_exit(&dm_dev_mutex);
return dmv;
}
-
- if (dm_dev_name != NULL)
- if ((dmv = dm_dev_lookup_name(dm_dev_name)) != NULL){
- dm_dev_busy(dmv);
- mutex_exit(&dm_dev_mutex);
- return dmv;
- }
-
if (dm_dev_uuid != NULL)
- if ((dmv = dm_dev_lookup_uuid(dm_dev_uuid)) != NULL){
+ if ((dmv = dm_dev_lookup_uuid(dm_dev_uuid)) != NULL) {
dm_dev_busy(dmv);
mutex_exit(&dm_dev_mutex);
return dmv;
}
- mutex_exit(&dm_dev_mutex);
- return NULL;
+ mutex_exit(&dm_dev_mutex);
+ return NULL;
}
-
+
/*
* Lookup device with its minor number.
*/
-static dm_dev_t*
+static dm_dev_t *
dm_dev_lookup_minor(int dm_dev_minor)
{
dm_dev_t *dmv;
-
- TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){
+
+ TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) {
if (dm_dev_minor == dmv->minor)
return dmv;
}
-
+
return NULL;
}
-
/*
* Lookup device with it's device name.
*/
-static dm_dev_t*
+static dm_dev_t *
dm_dev_lookup_name(const char *dm_dev_name)
{
dm_dev_t *dmv;
- int dlen; int slen;
+ int dlen;
+ int slen;
slen = strlen(dm_dev_name);
if (slen == 0)
return NULL;
-
- TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){
+
+ TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) {
dlen = strlen(dmv->name);
-
- if(slen != dlen)
+
+ if (slen != dlen)
continue;
if (strncmp(dm_dev_name, dmv->name, slen) == 0)
@@ -144,62 +142,59 @@
return NULL;
}
-
/*
* Lookup device with it's device uuid. Used mostly by LVM2tools.
*/
-static dm_dev_t*
+static dm_dev_t *
dm_dev_lookup_uuid(const char *dm_dev_uuid)
{
dm_dev_t *dmv;
size_t len;
-
+
len = 0;
len = strlen(dm_dev_uuid);
-
+
if (len == 0)
return NULL;
- TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){
+ TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) {
if (strlen(dmv->uuid) != len)
continue;
-
+
if (strncmp(dm_dev_uuid, dmv->uuid, strlen(dmv->uuid)) == 0)
return dmv;
}
return NULL;
}
-
/*
* Insert new device to the global list of devices.
*/
int
-dm_dev_insert(dm_dev_t *dev)
+dm_dev_insert(dm_dev_t * dev)
{
dm_dev_t *dmv;
int r;
dmv = NULL;
r = 0;
-
+
KASSERT(dev != NULL);
mutex_enter(&dm_dev_mutex);
if (((dmv = dm_dev_lookup_uuid(dev->uuid)) == NULL) &&
((dmv = dm_dev_lookup_name(dev->name)) == NULL) &&
- ((dmv = dm_dev_lookup_minor(dev->minor)) == NULL)){
+ ((dmv = dm_dev_lookup_minor(dev->minor)) == NULL)) {
TAILQ_INSERT_TAIL(&dm_dev_list, dev, next_devlist);
-
+
} else
r = EEXIST;
-
- mutex_exit(&dm_dev_mutex);
+
+ mutex_exit(&dm_dev_mutex);
return r;
}
-
-#ifdef notyet
+#ifdef notyet
/*
* Lookup device with its minor number.
*/
@@ -207,16 +202,16 @@
dm_dev_test_minor(int dm_dev_minor)
{
dm_dev_t *dmv;
-
+
mutex_enter(&dm_dev_mutex);
- TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){
- if (dm_dev_minor == dmv->minor){
+ TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) {
+ if (dm_dev_minor == dmv->minor) {
mutex_exit(&dm_dev_mutex);
return 1;
}
}
mutex_exit(&dm_dev_mutex);
-
+
return 0;
}
#endif
@@ -231,45 +226,42 @@
dm_dev_detach(device_t devt)
{
dm_dev_t *dmv;
-
+
mutex_enter(&dm_dev_mutex);
- TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist){
- if (devt == dmv->devt){
+ TAILQ_FOREACH(dmv, &dm_dev_list, next_devlist) {
+ if (devt == dmv->devt) {
disable_dev(dmv);
return dmv;
}
}
mutex_exit(&dm_dev_mutex);
-
+
return NULL;
}
-
-/*
- * Remove device selected with dm_dev from global list of devices.
+/*
+ * Remove device selected with dm_dev from global list of devices.
*/
-dm_dev_t*
+dm_dev_t *
dm_dev_rem(const char *dm_dev_name, const char *dm_dev_uuid,
- int dm_dev_minor)
-{
+ int dm_dev_minor)
+{
dm_dev_t *dmv;
dmv = NULL;
-
+
mutex_enter(&dm_dev_mutex);
-
+
if (dm_dev_minor > 0)
- if ((dmv = dm_dev_lookup_minor(dm_dev_minor)) != NULL){
+ if ((dmv = dm_dev_lookup_minor(dm_dev_minor)) != NULL) {
disable_dev(dmv);
return dmv;
}
-
- if (dm_dev_name != NULL)
- if ((dmv = dm_dev_lookup_name(dm_dev_name)) != NULL){
+ if (dm_dev_name != NULL)
+ if ((dmv = dm_dev_lookup_name(dm_dev_name)) != NULL) {
disable_dev(dmv);
return dmv;
}
Home |
Main Index |
Thread Index |
Old Index