1 | /* $NetBSD: getfstypename.c,v 1.8 2012/04/07 16:28:59 christos Exp $ */ |
2 | |
3 | /*- |
4 | * Copyright (c) 2011 The NetBSD Foundation, Inc. |
5 | * All rights reserved. |
6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Christos Zoulas. |
9 | * |
10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions |
12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. |
15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. |
18 | * 3. All advertising materials mentioning features or use of this software |
19 | * must display the following acknowledgement: |
20 | * This product includes software developed by the NetBSD |
21 | * Foundation, Inc. and its contributors. |
22 | * 4. Neither the name of The NetBSD Foundation nor the names of its |
23 | * contributors may be used to endorse or promote products derived |
24 | * from this software without specific prior written permission. |
25 | * |
26 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
36 | * POSSIBILITY OF SUCH DAMAGE. |
37 | */ |
38 | #ifndef _STANDALONE |
39 | # include <sys/cdefs.h> |
40 | # ifndef _KERNEL |
41 | # if !defined(lint) |
42 | __RCSID("$NetBSD: getfstypename.c,v 1.8 2012/04/07 16:28:59 christos Exp $" ); |
43 | # endif |
44 | # else |
45 | __KERNEL_RCSID(0, "$NetBSD: getfstypename.c,v 1.8 2012/04/07 16:28:59 christos Exp $" ); |
46 | # endif /* _KERNEL */ |
47 | |
48 | # define FSTYPE_ENUMNAME fstype_enum |
49 | # include <sys/types.h> |
50 | # include <sys/disk.h> |
51 | # include <sys/disklabel.h> |
52 | # ifndef _KERNEL |
53 | # include <util.h> |
54 | # endif |
55 | |
56 | const char * |
57 | getfstypename(int fstype) |
58 | { |
59 | /* |
60 | * The cast is so that the compiler can check that we |
61 | * cover all the enum values |
62 | */ |
63 | switch ((enum fstype_enum)fstype) { |
64 | case FS_UNUSED: |
65 | return DKW_PTYPE_UNUSED; |
66 | case FS_SWAP: |
67 | return DKW_PTYPE_SWAP; |
68 | case FS_V6: |
69 | return DKW_PTYPE_V6; |
70 | case FS_V7: |
71 | return DKW_PTYPE_V7; |
72 | case FS_SYSV: |
73 | return DKW_PTYPE_SYSV; |
74 | case FS_V71K: |
75 | return DKW_PTYPE_V71K; |
76 | case FS_V8: |
77 | return DKW_PTYPE_V8; |
78 | case FS_BSDFFS: |
79 | return DKW_PTYPE_FFS; |
80 | case FS_MSDOS: |
81 | return DKW_PTYPE_FAT; |
82 | case FS_BSDLFS: |
83 | return DKW_PTYPE_LFS; |
84 | case FS_OTHER: |
85 | return DKW_PTYPE_OTHER; |
86 | case FS_HPFS: |
87 | return DKW_PTYPE_HPFS; |
88 | case FS_ISO9660: |
89 | return DKW_PTYPE_ISO9660; |
90 | case FS_BOOT: |
91 | return DKW_PTYPE_BOOT; |
92 | case FS_ADOS: |
93 | return DKW_PTYPE_AMIGADOS; |
94 | case FS_HFS: |
95 | return DKW_PTYPE_APPLEHFS; |
96 | case FS_FILECORE: |
97 | return DKW_PTYPE_FILECORE; |
98 | case FS_EX2FS: |
99 | return DKW_PTYPE_EXT2FS; |
100 | case FS_NTFS: |
101 | return DKW_PTYPE_NTFS; |
102 | case FS_RAID: |
103 | return DKW_PTYPE_RAIDFRAME; |
104 | case FS_CCD: |
105 | return DKW_PTYPE_CCD; |
106 | case FS_JFS2: |
107 | return DKW_PTYPE_JFS2; |
108 | case FS_APPLEUFS: |
109 | return DKW_PTYPE_APPLEUFS; |
110 | case FS_VINUM: |
111 | return DKW_PTYPE_VINUM; |
112 | case FS_UDF: |
113 | return DKW_PTYPE_UDF; |
114 | case FS_SYSVBFS: |
115 | return DKW_PTYPE_SYSVBFS; |
116 | case FS_EFS: |
117 | return DKW_PTYPE_EFS; |
118 | case FS_NILFS: |
119 | return DKW_PTYPE_NILFS; |
120 | case FS_CGD: |
121 | return DKW_PTYPE_CGD; |
122 | case FSMAXTYPES: |
123 | return DKW_PTYPE_UNKNOWN; |
124 | case FS_MINIXFS3: |
125 | return DKW_PTYPE_MINIXFS3; |
126 | } |
127 | /* Stupid gcc, should know it is impossible to get here */ |
128 | /*NOTREACHED*/ |
129 | return DKW_PTYPE_UNKNOWN; |
130 | } |
131 | #endif /* !_STANDALONE */ |
132 | |