Mon Dec 6 09:12:23 2010 UTC ()
I have forgot to fix dm_dev_counter here, too.


(haad)
diff -r1.25 -r1.26 src/sys/dev/dm/device-mapper.c

cvs diff -r1.25 -r1.26 src/sys/dev/dm/device-mapper.c (expand / switch to unified diff)

--- src/sys/dev/dm/device-mapper.c 2010/10/23 21:18:54 1.25
+++ src/sys/dev/dm/device-mapper.c 2010/12/06 09:12:23 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: device-mapper.c,v 1.25 2010/10/23 21:18:54 haad Exp $ */ 1/* $NetBSD: device-mapper.c,v 1.26 2010/12/06 09:12:23 haad Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Adam Hamsik. 8 * by Adam Hamsik.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -100,27 +100,27 @@ const struct cdevsw dm_cdevsw = { @@ -100,27 +100,27 @@ const struct cdevsw dm_cdevsw = {
100 .d_flag = D_DISK | D_MPSAFE 100 .d_flag = D_DISK | D_MPSAFE
101}; 101};
102 102
103const struct dkdriver dmdkdriver = { 103const struct dkdriver dmdkdriver = {
104 .d_strategy = dmstrategy 104 .d_strategy = dmstrategy
105}; 105};
106 106
107CFATTACH_DECL3_NEW(dm, 0, 107CFATTACH_DECL3_NEW(dm, 0,
108 dm_match, dm_attach, dm_detach, NULL, NULL, NULL, 108 dm_match, dm_attach, dm_detach, NULL, NULL, NULL,
109 DVF_DETACH_SHUTDOWN); 109 DVF_DETACH_SHUTDOWN);
110 110
111extern struct cfdriver dm_cd; 111extern struct cfdriver dm_cd;
112 112
113extern uint64_t dm_dev_counter; 113extern uint32_t dm_dev_counter;
114 114
115/* 115/*
116 * This array is used to translate cmd to function pointer. 116 * This array is used to translate cmd to function pointer.
117 * 117 *
118 * Interface between libdevmapper and lvm2tools uses different  118 * Interface between libdevmapper and lvm2tools uses different
119 * names for one IOCTL call because libdevmapper do another thing 119 * names for one IOCTL call because libdevmapper do another thing
120 * then. When I run "info" or "mknodes" libdevmapper will send same 120 * then. When I run "info" or "mknodes" libdevmapper will send same
121 * ioctl to kernel but will do another things in userspace. 121 * ioctl to kernel but will do another things in userspace.
122 * 122 *
123 */ 123 */
124struct cmd_function cmd_fn[] = { 124struct cmd_function cmd_fn[] = {
125 { .cmd = "version", .fn = dm_get_version_ioctl}, 125 { .cmd = "version", .fn = dm_get_version_ioctl},
126 { .cmd = "targets", .fn = dm_list_versions_ioctl}, 126 { .cmd = "targets", .fn = dm_list_versions_ioctl},
@@ -267,27 +267,27 @@ dm_detach(device_t self, int flags) @@ -267,27 +267,27 @@ dm_detach(device_t self, int flags)
267 /* Destroy inactive table if exits, too. */ 267 /* Destroy inactive table if exits, too. */
268 dm_table_destroy(&dmv->table_head, DM_TABLE_INACTIVE); 268 dm_table_destroy(&dmv->table_head, DM_TABLE_INACTIVE);
269  269
270 dm_table_head_destroy(&dmv->table_head); 270 dm_table_head_destroy(&dmv->table_head);
271 271
272 /* Destroy disk device structure */ 272 /* Destroy disk device structure */
273 disk_detach(dmv->diskp); 273 disk_detach(dmv->diskp);
274 disk_destroy(dmv->diskp); 274 disk_destroy(dmv->diskp);
275 275
276 /* Destroy device */ 276 /* Destroy device */
277 (void)dm_dev_free(dmv); 277 (void)dm_dev_free(dmv);
278 278
279 /* Decrement device counter After removing device */ 279 /* Decrement device counter After removing device */
280 atomic_dec_64(&dm_dev_counter); 280 atomic_dec_32(&dm_dev_counter);
281 281
282 return 0; 282 return 0;
283} 283}
284 284
285static void 285static void
286dm_doinit(void) 286dm_doinit(void)
287{ 287{
288 dm_target_init(); 288 dm_target_init();
289 dm_dev_init(); 289 dm_dev_init();
290 dm_pdev_init(); 290 dm_pdev_init();
291} 291}
292 292
293/* attach routine */ 293/* attach routine */