source: mainline/uspace/lib/c/include/types/label.h@ 68b5dd11

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 68b5dd11 was 68b5dd11, checked in by Jiri Svoboda <jiri@…>, 10 years ago

Provide some default options.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 * Copyright (c) 2015 Jiri Svoboda
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libc
30 * @{
31 */
32/** @file
33 */
34
35#ifndef LIBC_TYPES_LABEL_H_
36#define LIBC_TYPES_LABEL_H_
37
38#include <types/uuid.h>
39
40/** Partition contents */
41typedef enum {
42 /** Partition is considered empty */
43 ptc_empty = 0,
44 /** Partition contains a recognized filesystem */
45 ptc_fs,
46 /** Partition contains unrecognized data */
47 ptc_unknown
48} label_part_cnt_t;
49
50/** Disk label type */
51typedef enum {
52 /** No label */
53 lt_none,
54 /** BIOS Master Boot Record */
55 lt_mbr,
56 /** UEFI GUID Partition Table */
57 lt_gpt
58} label_type_t;
59
60#define LT_FIRST lt_mbr
61#define LT_LIMIT (lt_gpt + 1)
62
63#define LT_DEFAULT lt_mbr
64
65/** Partition kind */
66typedef enum {
67 /** Primary partition */
68 lpk_primary,
69 /** Extended partition */
70 lpk_extended,
71 /** Logical partition */
72 lpk_logical
73} label_pkind_t;
74
75/** Label flags */
76typedef enum {
77 /** Label supports extended (and logical) partitions */
78 lf_ext_supp = 0x1,
79 /** Partition type is in UUID format (otherwise in small number format) */
80 lf_ptype_uuid = 0x2,
81 /** Currently it is possible to create a primary partition */
82 lf_can_create_pri = 0x4,
83 /** Currently it is possible to create an extended partition */
84 lf_can_create_ext = 0x8,
85 /** Currently it is possible to create a logical partition */
86 lf_can_create_log = 0x10,
87 /** Currently it is possible to delete a partition */
88 lf_can_delete_part = 0x20
89} label_flags_t;
90
91/** Partition type format */
92typedef enum {
93 /** Small number */
94 lptf_num,
95 /** UUID */
96 lptf_uuid
97} label_pt_fmt;
98
99/** Partition type */
100typedef struct {
101 /** Type format */
102 label_pt_fmt fmt;
103 /** Depending on @c fmt */
104 union {
105 /* Small number */
106 uint8_t num;
107 /** UUID */
108 uuid_t uuid;
109 } t;
110} label_ptype_t;
111
112/** Partition content (used to get partition type suggestion) */
113typedef enum {
114 /** ExFAT */
115 lpc_exfat,
116 /** Ext4 */
117 lpc_ext4,
118 /** FAT12 or FAT16 */
119 lpc_fat12_16,
120 /** FAT32 */
121 lpc_fat32,
122 /** Minix file system */
123 lpc_minix
124} label_pcnt_t;
125
126#endif
127
128/** @}
129 */
Note: See TracBrowser for help on using the repository browser.