diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2011-12-25 15:28:18 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2011-12-25 15:28:18 +0000 |
commit | 9674dd425bfedd2db84f9d6c0e261ce4498dcf26 (patch) | |
tree | db1f3ffc4e5bdfb780a011c285c39709c06a9a1c | |
parent | 3db23b0e1d09208e37bae5a5b985ffb56823c771 (diff) |
Initialise discipline function pointers with defaults and only override
those that are needed by a specific discipline.
-rw-r--r-- | sys/dev/softraid.c | 21 | ||||
-rw-r--r-- | sys/dev/softraid_aoe.c | 15 | ||||
-rw-r--r-- | sys/dev/softraid_crypto.c | 15 | ||||
-rw-r--r-- | sys/dev/softraid_raid0.c | 15 | ||||
-rw-r--r-- | sys/dev/softraid_raid1.c | 15 | ||||
-rw-r--r-- | sys/dev/softraid_raid6.c | 21 | ||||
-rw-r--r-- | sys/dev/softraid_raidp.c | 19 |
7 files changed, 49 insertions, 72 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index e0549dc4bf8..9fdccfdb417 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.258 2011/11/13 14:07:17 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.259 2011/12/25 15:28:17 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -3635,6 +3635,25 @@ sr_discipline_init(struct sr_discipline *sd, int level) { int rv = 1; + /* Initialise discipline function pointers with defaults. */ + sd->sd_alloc_resources = NULL; + sd->sd_assemble = NULL; + sd->sd_create = NULL; + sd->sd_free_resources = NULL; + sd->sd_ioctl_handler = NULL; + sd->sd_openings = NULL; + sd->sd_meta_opt_handler = NULL; + sd->sd_scsi_inquiry = sr_raid_inquiry; + sd->sd_scsi_read_cap = sr_raid_read_cap; + sd->sd_scsi_tur = sr_raid_tur; + sd->sd_scsi_req_sense = sr_raid_request_sense; + sd->sd_scsi_start_stop = sr_raid_start_stop; + sd->sd_scsi_sync = sr_raid_sync; + sd->sd_scsi_rw = NULL; + sd->sd_set_chunk_state = NULL; + sd->sd_set_vol_state = NULL; + sd->sd_start_discipline = NULL; + switch (level) { case 0: sr_raid0_discipline_init(sd); diff --git a/sys/dev/softraid_aoe.c b/sys/dev/softraid_aoe.c index 9705597b47f..d067b9d1f43 100644 --- a/sys/dev/softraid_aoe.c +++ b/sys/dev/softraid_aoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_aoe.c,v 1.23 2011/07/07 00:18:06 tedu Exp $ */ +/* $OpenBSD: softraid_aoe.c,v 1.24 2011/12/25 15:28:17 jsing Exp $ */ /* * Copyright (c) 2008 Ted Unangst <tedu@openbsd.org> * Copyright (c) 2008 Marco Peereboom <marco@openbsd.org> @@ -87,18 +87,11 @@ sr_aoe_discipline_init(struct sr_discipline *sd) sd->sd_capabilities = SR_CAP_SYSTEM_DISK; sd->sd_max_wu = SR_RAIDAOE_NOWU; - /* Setup discipline pointers. */ - sd->sd_create = sr_aoe_create; - sd->sd_assemble = sr_aoe_assemble; + /* Setup discipline specific function pointers. */ sd->sd_alloc_resources = sr_aoe_alloc_resources; + sd->sd_assemble = sr_aoe_assemble; + sd->sd_create = sr_aoe_create; sd->sd_free_resources = sr_aoe_free_resources; - sd->sd_start_discipline = NULL; - sd->sd_scsi_inquiry = sr_raid_inquiry; - sd->sd_scsi_read_cap = sr_raid_read_cap; - sd->sd_scsi_tur = sr_raid_tur; - sd->sd_scsi_req_sense = sr_raid_request_sense; - sd->sd_scsi_start_stop = sr_raid_start_stop; - sd->sd_scsi_sync = sr_raid_sync; sd->sd_scsi_rw = sr_aoe_rw; /* XXX reuse raid 1 functions for now FIXME */ sd->sd_set_chunk_state = sr_raid1_set_chunk_state; diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c index 270b6ba855a..2c85ce93227 100644 --- a/sys/dev/softraid_crypto.c +++ b/sys/dev/softraid_crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_crypto.c,v 1.75 2011/09/20 12:20:44 jsing Exp $ */ +/* $OpenBSD: softraid_crypto.c,v 1.76 2011/12/25 15:28:17 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org> @@ -120,20 +120,13 @@ sr_crypto_discipline_init(struct sr_discipline *sd) for (i = 0; i < SR_CRYPTO_MAXKEYS; i++) sd->mds.mdd_crypto.scr_sid[i] = (u_int64_t)-1; - /* Setup discipline pointers. */ - sd->sd_create = sr_crypto_create; - sd->sd_assemble = sr_crypto_assemble; + /* Setup discipline specific function pointers. */ sd->sd_alloc_resources = sr_crypto_alloc_resources; + sd->sd_assemble = sr_crypto_assemble; + sd->sd_create = sr_crypto_create; sd->sd_free_resources = sr_crypto_free_resources; - sd->sd_start_discipline = NULL; sd->sd_ioctl_handler = sr_crypto_ioctl; sd->sd_meta_opt_handler = sr_crypto_meta_opt_handler; - sd->sd_scsi_inquiry = sr_raid_inquiry; - sd->sd_scsi_read_cap = sr_raid_read_cap; - sd->sd_scsi_tur = sr_raid_tur; - sd->sd_scsi_req_sense = sr_raid_request_sense; - sd->sd_scsi_start_stop = sr_raid_start_stop; - sd->sd_scsi_sync = sr_raid_sync; sd->sd_scsi_rw = sr_crypto_rw; /* XXX reuse raid 1 functions for now FIXME */ sd->sd_set_chunk_state = sr_raid1_set_chunk_state; diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c index 5f2bcc0c35e..b36303eb73e 100644 --- a/sys/dev/softraid_raid0.c +++ b/sys/dev/softraid_raid0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid0.c,v 1.23 2011/04/05 19:52:02 krw Exp $ */ +/* $OpenBSD: softraid_raid0.c,v 1.24 2011/12/25 15:28:17 jsing Exp $ */ /* * Copyright (c) 2008 Marco Peereboom <marco@peereboom.us> * @@ -65,18 +65,11 @@ sr_raid0_discipline_init(struct sr_discipline *sd) sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE; sd->sd_max_wu = SR_RAID0_NOWU; - /* Setup discipline pointers. */ - sd->sd_create = sr_raid0_create; - sd->sd_assemble = sr_raid0_assemble; + /* Setup discipline specific function pointers. */ sd->sd_alloc_resources = sr_raid0_alloc_resources; + sd->sd_assemble = sr_raid0_assemble; + sd->sd_create = sr_raid0_create; sd->sd_free_resources = sr_raid0_free_resources; - sd->sd_start_discipline = NULL; - sd->sd_scsi_inquiry = sr_raid_inquiry; - sd->sd_scsi_read_cap = sr_raid_read_cap; - sd->sd_scsi_tur = sr_raid_tur; - sd->sd_scsi_req_sense = sr_raid_request_sense; - sd->sd_scsi_start_stop = sr_raid_start_stop; - sd->sd_scsi_sync = sr_raid_sync; sd->sd_scsi_rw = sr_raid0_rw; sd->sd_set_chunk_state = sr_raid0_set_chunk_state; sd->sd_set_vol_state = sr_raid0_set_vol_state; diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c index f7a2eef8b7b..8647885e57d 100644 --- a/sys/dev/softraid_raid1.c +++ b/sys/dev/softraid_raid1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid1.c,v 1.28 2011/12/25 15:16:21 jsing Exp $ */ +/* $OpenBSD: softraid_raid1.c,v 1.29 2011/12/25 15:28:17 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -65,18 +65,11 @@ sr_raid1_discipline_init(struct sr_discipline *sd) SR_CAP_REBUILD; sd->sd_max_wu = SR_RAID1_NOWU; - /* Setup discipline pointers. */ - sd->sd_create = sr_raid1_create; - sd->sd_assemble = sr_raid1_assemble; + /* Setup discipline specific function pointers. */ sd->sd_alloc_resources = sr_raid1_alloc_resources; + sd->sd_assemble = sr_raid1_assemble; + sd->sd_create = sr_raid1_create; sd->sd_free_resources = sr_raid1_free_resources; - sd->sd_start_discipline = NULL; - sd->sd_scsi_inquiry = sr_raid_inquiry; - sd->sd_scsi_read_cap = sr_raid_read_cap; - sd->sd_scsi_tur = sr_raid_tur; - sd->sd_scsi_req_sense = sr_raid_request_sense; - sd->sd_scsi_start_stop = sr_raid_start_stop; - sd->sd_scsi_sync = sr_raid_sync; sd->sd_scsi_rw = sr_raid1_rw; sd->sd_set_chunk_state = sr_raid1_set_chunk_state; sd->sd_set_vol_state = sr_raid1_set_vol_state; diff --git a/sys/dev/softraid_raid6.c b/sys/dev/softraid_raid6.c index 2f4484f59b6..85e91415a4f 100644 --- a/sys/dev/softraid_raid6.c +++ b/sys/dev/softraid_raid6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid6.c,v 1.24 2011/04/21 20:28:16 jordan Exp $ */ +/* $OpenBSD: softraid_raid6.c,v 1.25 2011/12/25 15:28:17 jsing Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -95,30 +95,23 @@ void sr_raid6_discipline_init(struct sr_discipline *sd) { - /* Initialize GF256 tables */ + /* Initialize GF256 tables. */ gf_init(); - /* fill out discipline members. */ + /* Fill out discipline members. */ sd->sd_type = SR_MD_RAID6; sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE; sd->sd_max_wu = SR_RAID6_NOWU; - /* setup discipline pointers. */ - sd->sd_create = sr_raid6_create; - sd->sd_assemble = sr_raid6_assemble; + /* Setup discipline specific function pointers. */ sd->sd_alloc_resources = sr_raid6_alloc_resources; + sd->sd_assemble = sr_raid6_assemble; + sd->sd_create = sr_raid6_create; sd->sd_free_resources = sr_raid6_free_resources; - sd->sd_start_discipline = NULL; - sd->sd_scsi_inquiry = sr_raid_inquiry; - sd->sd_scsi_read_cap = sr_raid_read_cap; - sd->sd_scsi_tur = sr_raid_tur; - sd->sd_scsi_req_sense = sr_raid_request_sense; - sd->sd_scsi_start_stop = sr_raid_start_stop; - sd->sd_scsi_sync = sr_raid_sync; + sd->sd_openings = sr_raid6_openings; sd->sd_scsi_rw = sr_raid6_rw; sd->sd_set_chunk_state = sr_raid6_set_chunk_state; sd->sd_set_vol_state = sr_raid6_set_vol_state; - sd->sd_openings = sr_raid6_openings; } int diff --git a/sys/dev/softraid_raidp.c b/sys/dev/softraid_raidp.c index f7fe59c7ef6..f121cc0c404 100644 --- a/sys/dev/softraid_raidp.c +++ b/sys/dev/softraid_raidp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raidp.c,v 1.22 2011/04/08 00:12:54 jordan Exp $ */ +/* $OpenBSD: softraid_raidp.c,v 1.23 2011/12/25 15:28:17 jsing Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -72,28 +72,21 @@ void sr_raidp_discipline_init(struct sr_discipline *sd, u_int8_t type) { - /* fill out discipline members. */ + /* Fill out discipline members. */ sd->sd_type = type; sd->sd_capabilities = SR_CAP_SYSTEM_DISK | SR_CAP_AUTO_ASSEMBLE; sd->sd_max_ccb_per_wu = 4; /* only if stripsize <= MAXPHYS */ sd->sd_max_wu = SR_RAIDP_NOWU; - /* setup discipline pointers. */ - sd->sd_create = sr_raidp_create; - sd->sd_assemble = sr_raidp_assemble; + /* Setup discipline specific function pointers. */ sd->sd_alloc_resources = sr_raidp_alloc_resources; + sd->sd_assemble = sr_raidp_assemble; + sd->sd_create = sr_raidp_create; sd->sd_free_resources = sr_raidp_free_resources; - sd->sd_start_discipline = NULL; - sd->sd_scsi_inquiry = sr_raid_inquiry; - sd->sd_scsi_read_cap = sr_raid_read_cap; - sd->sd_scsi_tur = sr_raid_tur; - sd->sd_scsi_req_sense = sr_raid_request_sense; - sd->sd_scsi_start_stop = sr_raid_start_stop; - sd->sd_scsi_sync = sr_raid_sync; + sd->sd_openings = sr_raidp_openings; sd->sd_scsi_rw = sr_raidp_rw; sd->sd_set_chunk_state = sr_raidp_set_chunk_state; sd->sd_set_vol_state = sr_raidp_set_vol_state; - sd->sd_openings = sr_raidp_openings; } int |