packagefs.h revision 2d91773d
1/*
2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Ingo Weinhold <ingo_weinhold@gmx.de>
7 */
8#ifndef _PACKAGE__PRIVATE__PACKAGE_FS_H_
9#define _PACKAGE__PRIVATE__PACKAGE_FS_H_
10
11
12#include <Drivers.h>
13
14
15enum PackageFSMountType {
16	PACKAGE_FS_MOUNT_TYPE_SYSTEM,
17	PACKAGE_FS_MOUNT_TYPE_HOME,
18	PACKAGE_FS_MOUNT_TYPE_CUSTOM,
19
20	PACKAGE_FS_MOUNT_TYPE_ENUM_COUNT
21};
22
23
24enum {
25	PACKAGE_FS_OPERATION_GET_VOLUME_INFO		= B_DEVICE_OP_CODES_END + 1,
26	PACKAGE_FS_OPERATION_GET_PACKAGE_INFOS,
27	PACKAGE_FS_OPERATION_CHANGE_ACTIVATION
28};
29
30
31// PACKAGE_FS_OPERATION_GET_VOLUME_INFO
32
33struct PackageFSDirectoryInfo {
34	// node_ref of the directory
35	dev_t					deviceID;
36	ino_t					nodeID;
37};
38
39struct PackageFSVolumeInfo {
40	PackageFSMountType	mountType;
41
42	// device and node id of the respective package FS root scope (e.g. "/boot"
43	// for the three standard volumes)
44	dev_t					rootDeviceID;
45	ino_t					rootDirectoryID;
46
47	// packageCount is set to the actual packages directory count, even if it is
48	// greater than the array, so the caller can determine whether the array was
49	// large enough.
50	// The directories are ordered from the most recent state (the actual
51	// "packages" directory) to the oldest one, the one that is actually active.
52	uint32					packagesDirectoryCount;
53	PackageFSDirectoryInfo	packagesDirectoryInfos[1];
54};
55
56
57// PACKAGE_FS_OPERATION_GET_PACKAGE_INFOS
58
59struct PackageFSPackageInfo {
60	// node_ref of the package file and the containing directory
61	dev_t							packageDeviceID;
62	dev_t							directoryDeviceID;
63	ino_t							packageNodeID;
64	ino_t							directoryNodeID;
65};
66
67struct PackageFSGetPackageInfosRequest {
68	// Filled in by the FS. packageCount is set to the actual package count,
69	// even if it is greater than the array, so the caller can determine whether
70	// the array was large enough.
71	uint32							packageCount;
72	PackageFSPackageInfo			infos[1];
73};
74
75
76// PACKAGE_FS_OPERATION_CHANGE_ACTIVATION
77
78enum PackageFSActivationChangeType {
79	PACKAGE_FS_ACTIVATE_PACKAGE,
80	PACKAGE_FS_DEACTIVATE_PACKAGE,
81	PACKAGE_FS_REACTIVATE_PACKAGE
82};
83
84struct PackageFSActivationChangeItem {
85	PackageFSActivationChangeType	type;
86
87	// node_ref of the package file
88	dev_t							packageDeviceID;
89	ino_t							packageNodeID;
90
91	// entry_ref of the package file
92	uint32							nameLength;
93	dev_t							parentDeviceID;
94	ino_t							parentDirectoryID;
95	char*							name;
96										// must point to a location within the
97										// request
98};
99
100struct PackageFSActivationChangeRequest {
101	uint32							itemCount;
102	PackageFSActivationChangeItem	items[0];
103};
104
105
106#endif	// _PACKAGE__PRIVATE__PACKAGE_FS_H_
107