xref: /haiku/headers/private/package/packagefs.h (revision a30a4a41f948ebb03b95dab065a27a584ac0c97a)
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 
15 enum 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 
24 enum {
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 
33 struct PackageFSDirectoryInfo {
34 	// node_ref of the directory
35 	dev_t					deviceID;
36 	ino_t					nodeID;
37 };
38 
39 struct 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 
59 struct PackageFSPackageInfo {
60 	// node_ref and entry_ref of the package file
61 	dev_t							packageDeviceID;
62 	dev_t							directoryDeviceID;
63 	ino_t							packageNodeID;
64 	ino_t							directoryNodeID;
65 	const char*						name;
66 };
67 
68 struct PackageFSGetPackageInfosRequest {
69 	// Filled in by the FS. bufferSize is set to the required buffer size, even
70 	// even if the provided buffer is smaller.
71 	uint32							bufferSize;
72 	uint32							packageCount;
73 	PackageFSPackageInfo			infos[1];
74 };
75 
76 
77 // PACKAGE_FS_OPERATION_CHANGE_ACTIVATION
78 
79 enum PackageFSActivationChangeType {
80 	PACKAGE_FS_ACTIVATE_PACKAGE,
81 	PACKAGE_FS_DEACTIVATE_PACKAGE,
82 	PACKAGE_FS_REACTIVATE_PACKAGE
83 };
84 
85 struct PackageFSActivationChangeItem {
86 	PackageFSActivationChangeType	type;
87 
88 	// node_ref of the package file
89 	dev_t							packageDeviceID;
90 	ino_t							packageNodeID;
91 
92 	// entry_ref of the package file
93 	uint32							nameLength;
94 	dev_t							parentDeviceID;
95 	ino_t							parentDirectoryID;
96 	char*							name;
97 										// must point to a location within the
98 										// request
99 };
100 
101 struct PackageFSActivationChangeRequest {
102 	uint32							itemCount;
103 	PackageFSActivationChangeItem	items[0];
104 };
105 
106 
107 #endif	// _PACKAGE__PRIVATE__PACKAGE_FS_H_
108