1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom_dev.c 104602 2002-10-07 06:25:26Z phk $ |
36 */ 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/malloc.h> 41#include <sys/kernel.h> 42#include <sys/conf.h> 43#include <sys/bio.h> --- 182 unchanged lines hidden (view full) --- 226{ 227 struct g_geom *gp, *gp2; 228 struct g_consumer *cp; 229 struct g_provider *pp2; 230 struct g_kerneldump kd; 231 int i, error; 232 u_int u; 233 struct g_ioctl *gio; |
234 235 gp = dev->si_drv1; 236 cp = dev->si_drv2; 237 pp2 = cp->provider; 238 gp2 = pp2->geom; |
239 gio = NULL; |
240 241 error = 0; 242 DROP_GIANT(); 243 244 i = IOCPARM_LEN(cmd); 245 switch (cmd) { 246 case DIOCGSECTORSIZE: 247 error = g_io_getattr("GEOM::sectorsize", cp, &i, data); --- 19 unchanged lines hidden (view full) --- 267 } 268 kd.offset = 0; 269 kd.length = OFF_MAX; 270 i = sizeof kd; 271 error = g_io_getattr("GEOM::kerneldump", cp, &i, &kd); 272 if (!error) 273 dev->si_flags |= SI_DUMPDEV; 274 break; |
275 |
276 default: |
277 gio = g_malloc(sizeof *gio, M_WAITOK | M_ZERO); |
278 gio->cmd = cmd; 279 gio->data = data; 280 gio->fflag = fflag; 281 gio->td = td; 282 i = sizeof *gio; 283 if (cmd & IOC_IN) 284 error = g_io_setattr("GEOM::ioctl", cp, i, gio); 285 else 286 error = g_io_getattr("GEOM::ioctl", cp, &i, gio); |
287 break; 288 } 289 290 PICKUP_GIANT(); |
291 if (error == EDIRIOCTL) { 292 KASSERT(gio != NULL, ("NULL gio but EDIRIOCTL")); 293 KASSERT(gio->func != NULL, ("NULL function but EDIRIOCTL")); 294 error = (gio->func)(gio->dev, cmd, data, fflag, td); 295 } 296 if (gio != NULL) 297 g_free(gio); |
298 g_waitidle(); 299 if (error == ENOIOCTL) { 300 if (g_debugflags & G_T_TOPOLOGY) { 301 i = IOCGROUP(cmd); 302 printf("IOCTL(0x%lx) \"%s\"", cmd, gp->name); 303 if (i > ' ' && i <= '~') 304 printf(" '%c'", (int)IOCGROUP(cmd)); 305 else --- 108 unchanged lines hidden --- |