Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Implement DIOC[GS]STRATEGY for sd(4).
details: https://anonhg.NetBSD.org/src/rev/171ff432c8a8
branches: trunk
changeset: 753975:171ff432c8a8
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Wed Apr 14 22:26:33 2010 +0000
description:
Implement DIOC[GS]STRATEGY for sd(4).
diffstat:
sys/dev/scsipi/sd.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 47 insertions(+), 2 deletions(-)
diffs (84 lines):
diff -r 4b6c453c0110 -r 171ff432c8a8 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Wed Apr 14 20:30:28 2010 +0000
+++ b/sys/dev/scsipi/sd.c Wed Apr 14 22:26:33 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.292 2010/02/24 22:38:08 dyoung Exp $ */
+/* $NetBSD: sd.c,v 1.293 2010/04/14 22:26:33 jakllsch Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.292 2010/02/24 22:38:08 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.293 2010/04/14 22:26:33 jakllsch Exp $");
#include "opt_scsi.h"
#include "rnd.h"
@@ -994,6 +994,7 @@
struct scsipi_periph *periph = sd->sc_periph;
int part = SDPART(dev);
int error = 0;
+ int s;
#ifdef __HAVE_OLD_DISKLABEL
struct disklabel *newlabel = NULL;
#endif
@@ -1013,6 +1014,8 @@
case ODIOCEJECT:
case DIOCGCACHE:
case DIOCSCACHE:
+ case DIOCGSTRATEGY:
+ case DIOCSSTRATEGY:
case SCIOCIDENTIFY:
case OSCIOCIDENTIFY:
case SCIOCCOMMAND:
@@ -1231,6 +1234,48 @@
return (dkwedge_list(&sd->sc_dk, dkwl, l));
}
+ case DIOCGSTRATEGY:
+ {
+ struct disk_strategy *dks = addr;
+
+ s = splbio();
+ strlcpy(dks->dks_name, bufq_getstrategyname(sd->buf_queue),
+ sizeof(dks->dks_name));
+ splx(s);
+ dks->dks_paramlen = 0;
+
+ return 0;
+ }
+
+ case DIOCSSTRATEGY:
+ {
+ struct disk_strategy *dks = addr;
+ struct bufq_state *new;
+ struct bufq_state *old;
+
+ if ((flag & FWRITE) == 0) {
+ return EBADF;
+ }
+
+ if (dks->dks_param != NULL) {
+ return EINVAL;
+ }
+ dks->dks_name[sizeof(dks->dks_name) - 1] = 0; /* ensure term */
+ error = bufq_alloc(&new, dks->dks_name,
+ BUFQ_EXACT|BUFQ_SORT_RAWBLOCK);
+ if (error) {
+ return error;
+ }
+ s = splbio();
+ old = sd->buf_queue;
+ bufq_move(new, old);
+ sd->buf_queue = new;
+ splx(s);
+ bufq_free(old);
+
+ return 0;
+ }
+
default:
if (part != RAW_PART)
return (ENOTTY);
Home |
Main Index |
Thread Index |
Old Index