]> git.ipfire.org Git - ipfire-2.x.git/blame - src/install+setup/install/hw.h
installer: Make function to determine the amount of system memory.
[ipfire-2.x.git] / src / install+setup / install / hw.h
CommitLineData
f0fa1795
MT
1/*#############################################################################
2# #
3# IPFire - An Open Source Firewall Distribution #
4# Copyright (C) 2014 IPFire development team #
5# #
6# This program is free software: you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
8# the Free Software Foundation, either version 3 of the License, or #
9# (at your option) any later version. #
10# #
11# This program 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 #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
18# #
19#############################################################################*/
20
21#ifndef HEADER_HW_H
22#define HEADER_HW_H
23
24#include <libudev.h>
25
26#define SOURCE_MOUNT_PATH "/cdrom"
27#define SOURCE_TEST_FILE SOURCE_MOUNT_PATH "/" VERSION ".media"
28
d7dd283b
MT
29#define HW_MAX_DISKS 32
30#define STRING_SIZE 1024
31#define DEV_SIZE 128
32
33#define HW_PART_TYPE_NORMAL 0
34#define HW_PART_TYPE_RAID1 1
35
f0fa1795
MT
36struct hw {
37 struct udev *udev;
38};
39
d7dd283b
MT
40struct hw_disk {
41 char path[DEV_SIZE];
42 unsigned long long size;
43
44 char description[STRING_SIZE];
45 char vendor[STRING_SIZE];
46 char model[STRING_SIZE];
47
48 // Reference counter
49 int ref;
50};
51
52struct hw_destination {
53 char path[DEV_SIZE];
54 unsigned long long size;
55
56 int is_raid;
57
58 const struct hw_disk* disk1;
59 const struct hw_disk* disk2;
60
61 char part_boot[DEV_SIZE];
62 char part_swap[DEV_SIZE];
63 char part_root[DEV_SIZE];
64 char part_data[DEV_SIZE];
65};
66
f0fa1795
MT
67struct hw* hw_init();
68void hw_free(struct hw* hw);
69
70int hw_mount(const char* source, const char* target, int flags);
71int hw_umount(const char* target);
72
73char* hw_find_source_medium(struct hw* hw);
74
d7dd283b
MT
75struct hw_disk** hw_find_disks(struct hw* hw);
76void hw_free_disks(struct hw_disk** disks);
77unsigned int hw_count_disks(struct hw_disk** disks);
78struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection);
79
c4e96674
MT
80unsigned long long hw_memory();
81
f0fa1795 82#endif /* HEADER_HW_H */