]>
Commit | Line | Data |
---|---|---|
55e303ae | 1 | /* |
2d21ac55 | 2 | * Copyright (c) 2003, 2005 Apple Computer, Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
55e303ae | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
55e303ae A |
27 | */ |
28 | #ifndef __HFS_HOTFILES__ | |
29 | #define __HFS_HOTFILES__ | |
30 | ||
31 | #include <sys/appleapiopts.h> | |
32 | ||
33 | #ifdef KERNEL | |
34 | #ifdef __APPLE_API_PRIVATE | |
35 | ||
36 | ||
37 | #define HFC_FILENAME ".hotfiles.btree" | |
38 | ||
39 | ||
40 | /* | |
41 | * Temperature measurement constraints. | |
42 | */ | |
43 | #define HFC_DEFAULT_FILE_COUNT 1000 | |
44 | #define HFC_DEFAULT_DURATION (3600 * 60) | |
2d21ac55 | 45 | #define HFC_CUMULATIVE_CYCLES 3 |
55e303ae A |
46 | #define HFC_MAXIMUM_FILE_COUNT 5000 |
47 | #define HFC_MAXIMUM_FILESIZE (10 * 1024 * 1024) | |
91447636 | 48 | #define HFC_MINIMUM_TEMPERATURE 24 |
55e303ae A |
49 | |
50 | ||
51 | /* | |
52 | * Sync constraints. | |
53 | */ | |
54 | #define HFC_BLKSPERSYNC 300 | |
55 | #define HFC_FILESPERSYNC 50 | |
56 | ||
57 | ||
58 | /* | |
59 | * Hot file clustering stages. | |
60 | */ | |
61 | enum hfc_stage { | |
62 | HFC_DISABLED, | |
63 | HFC_IDLE, | |
64 | HFC_BUSY, | |
65 | HFC_RECORDING, | |
66 | HFC_EVALUATION, | |
67 | HFC_EVICTION, | |
68 | HFC_ADOPTION, | |
69 | }; | |
70 | ||
71 | ||
72 | /* | |
73 | * B-tree file key format (on-disk). | |
74 | */ | |
75 | struct HotFileKey { | |
76 | u_int16_t keyLength; /* length of key, excluding this field */ | |
77 | u_int8_t forkType; /* 0 = data fork, FF = resource fork */ | |
78 | u_int8_t pad; /* make the other fields align on 32-bit boundary */ | |
79 | u_int32_t temperature; /* temperature recorded */ | |
80 | u_int32_t fileID; /* file ID */ | |
81 | }; | |
82 | typedef struct HotFileKey HotFileKey; | |
83 | ||
84 | #define HFC_LOOKUPTAG 0xFFFFFFFF | |
85 | #define HFC_KEYLENGTH (sizeof(HotFileKey) - sizeof(u_int16_t)) | |
86 | ||
87 | /* | |
88 | * B-tree header node user info (on-disk). | |
89 | */ | |
90 | struct HotFilesInfo { | |
91 | u_int32_t magic; | |
92 | u_int32_t version; | |
2d21ac55 A |
93 | u_int32_t duration; /* duration of sample period (secs) */ |
94 | u_int32_t timebase; /* start of recording period (GMT time in secs) */ | |
95 | u_int32_t timeleft; /* time remaining in recording period (secs) */ | |
55e303ae A |
96 | u_int32_t threshold; |
97 | u_int32_t maxfileblks; | |
98 | u_int32_t maxfilecnt; | |
99 | u_int8_t tag[32]; | |
100 | }; | |
101 | typedef struct HotFilesInfo HotFilesInfo; | |
102 | ||
103 | #define HFC_MAGIC 0xFF28FF26 | |
104 | #define HFC_VERSION 1 | |
105 | ||
106 | ||
107 | struct hfsmount; | |
108 | struct proc; | |
109 | struct vnode; | |
110 | ||
111 | /* | |
112 | * Hot File interface functions. | |
113 | */ | |
2d21ac55 | 114 | int hfs_hotfilesync (struct hfsmount *, vfs_context_t ctx); |
55e303ae | 115 | |
91447636 A |
116 | int hfs_recording_init(struct hfsmount *); |
117 | int hfs_recording_suspend (struct hfsmount *); | |
55e303ae A |
118 | |
119 | int hfs_addhotfile (struct vnode *); | |
120 | int hfs_removehotfile (struct vnode *); | |
121 | ||
122 | #endif /* __APPLE_API_PRIVATE */ | |
123 | #endif /* KERNEL */ | |
124 | #endif /* __HFS_HOTFILES__ */ |