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