1 | /*␊ |
2 | * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * ␊ |
5 | * This file contains Original Code and/or Modifications of Original Code␊ |
6 | * as defined in and that are subject to the Apple Public Source License␊ |
7 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
8 | * compliance with the License. Please obtain a copy of the License at␊ |
9 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
10 | * file.␊ |
11 | * ␊ |
12 | * The Original Code and all software distributed under the License are␊ |
13 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
17 | * Please see the License for the specific language governing rights and␊ |
18 | * limitations under the License.␊ |
19 | * ␊ |
20 | *␊ |
21 | * Copyright (c) 1996 The NetBSD Foundation, Inc.␊ |
22 | * All rights reserved.␊ |
23 | *␊ |
24 | * This code is derived from software contributed to The NetBSD Foundation␊ |
25 | * by Jason R. Thorpe.␊ |
26 | *␊ |
27 | * Redistribution and use in source and binary forms, with or without␊ |
28 | * modification, are permitted provided that the following conditions␊ |
29 | * are met:␊ |
30 | * 1. Redistributions of source code must retain the above copyright␊ |
31 | * notice, this list of conditions and the following disclaimer.␊ |
32 | * 2. Redistributions in binary form must reproduce the above copyright␊ |
33 | * notice, this list of conditions and the following disclaimer in the␊ |
34 | * documentation and/or other materials provided with the distribution.␊ |
35 | * 3. All advertising materials mentioning features or use of this software␊ |
36 | * must display the following acknowledgement:␊ |
37 | * This product includes software developed by the NetBSD␊ |
38 | * Foundation, Inc. and its contributors.␊ |
39 | * 4. Neither the name of The NetBSD Foundation nor the names of its␊ |
40 | * contributors may be used to endorse or promote products derived␊ |
41 | * from this software without specific prior written permission.␊ |
42 | *␊ |
43 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS␊ |
44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED␊ |
45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR␊ |
46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS␊ |
47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR␊ |
48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF␊ |
49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS␊ |
50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN␊ |
51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)␊ |
52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE␊ |
53 | * POSSIBILITY OF SUCH DAMAGE.␊ |
54 | */␊ |
55 | ␊ |
56 | #include <sys/cdefs.h>␊ |
57 | #if defined(LIBC_SCCS) && !defined(lint)␊ |
58 | __RCSID("$NetBSD: getrawpartition.c,v 1.4 1999/07/02 15:49:12 simonb Exp $");␊ |
59 | #endif␊ |
60 | ␊ |
61 | #include <sys/param.h>␊ |
62 | #include <sys/sysctl.h>␊ |
63 | #include <util.h>␊ |
64 | ␊ |
65 | int␊ |
66 | getrawpartition()␊ |
67 | {␊ |
68 | #if 0␊ |
69 | ␉int rawpart, mib[2];␊ |
70 | ␉size_t varlen;␊ |
71 | ␊ |
72 | ␉mib[0] = CTL_KERN;␊ |
73 | ␉mib[1] = KERN_RAWPARTITION;␊ |
74 | ␉varlen = sizeof(rawpart);␊ |
75 | ␉if (sysctl(mib, 2, &rawpart, &varlen, NULL, 0) < 0)␊ |
76 | ␉␉return (-1);␊ |
77 | ␊ |
78 | ␉return (rawpart);␊ |
79 | #else␊ |
80 | ␉return 0 - 'a';␊ |
81 | #endif␊ |
82 | }␊ |
83 | |