]> git.ipfire.org Git - thirdparty/systemd.git/blame - extras/volume_id/volume_id/volume_id.h
[PATCH] udev_volume_id: new version of volume_id
[thirdparty/systemd.git] / extras / volume_id / volume_id / volume_id.h
CommitLineData
3611d582
KS
1/*
2 * volume_id - reads partition label and uuid
3 *
c033fd9f 4 * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
3611d582 5 *
599b6261
KS
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
3611d582 10 *
599b6261
KS
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3611d582
KS
19 */
20
21#ifndef _VOLUME_ID_H_
22#define _VOLUME_ID_H_
23
c033fd9f 24#define VOLUME_ID_VERSION 31
3611d582 25
b99f344f 26#define VOLUME_ID_LABEL_SIZE 64
3611d582
KS
27#define VOLUME_ID_UUID_SIZE 16
28#define VOLUME_ID_UUID_STRING_SIZE 37
c506c408
KS
29#define VOLUME_ID_FORMAT_SIZE 32
30#define VOLUME_ID_PATH_MAX 256
240ce551 31#define VOLUME_ID_PARTITIONS_MAX 256
3611d582 32
c506c408
KS
33enum volume_id_usage {
34 VOLUME_ID_UNUSED,
35 VOLUME_ID_UNPROBED,
36 VOLUME_ID_OTHER,
37 VOLUME_ID_FILESYSTEM,
38 VOLUME_ID_PARTITIONTABLE,
a5d00f9d 39 VOLUME_ID_RAID,
c033fd9f 40 VOLUME_ID_DISKLABEL,
c506c408 41};
3611d582 42
c506c408
KS
43struct volume_id_partition {
44 enum volume_id_usage usage_id;
c033fd9f 45 char *usage;
c506c408
KS
46 char *type;
47 unsigned long long off;
48 unsigned long long len;
33eae955 49 unsigned int partition_type_raw;
3611d582
KS
50};
51
52struct volume_id {
b99f344f
KS
53 unsigned char label_raw[VOLUME_ID_LABEL_SIZE];
54 unsigned int label_raw_len;
c506c408
KS
55 char label[VOLUME_ID_LABEL_SIZE+1];
56 unsigned char uuid_raw[VOLUME_ID_UUID_SIZE];
57 char uuid[VOLUME_ID_UUID_STRING_SIZE];
58 enum volume_id_usage usage_id;
c033fd9f 59 char *usage;
c506c408
KS
60 char *type;
61 char type_version[VOLUME_ID_FORMAT_SIZE];
c033fd9f 62
c506c408
KS
63 struct volume_id_partition *partitions;
64 unsigned int partition_count;
c033fd9f 65
599b6261 66 int fd;
b99f344f
KS
67 unsigned char *sbbuf;
68 unsigned int sbbuf_len;
69 unsigned char *seekbuf;
c506c408 70 unsigned long long seekbuf_off;
b99f344f 71 unsigned int seekbuf_len;
599b6261 72 int fd_close;
3611d582
KS
73};
74
3611d582 75extern struct volume_id *volume_id_open_fd(int fd);
3611d582 76extern struct volume_id *volume_id_open_node(const char *path);
3611d582 77extern struct volume_id *volume_id_open_dev_t(dev_t devt);
c033fd9f 78extern int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size);
3611d582
KS
79extern void volume_id_close(struct volume_id *id);
80
81#endif