OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can be | |
4 * found in the LICENSE file. | |
5 */ | |
6 | |
7 #include <stdio.h> | |
8 #include <string.h> | |
9 | |
10 #include "fmap.h" | |
11 | |
12 /* Return NULL if fail */ | |
gauravsh
2011/02/10 20:02:05
remove this comment - since you already document t
Che-Liang Chiou
2011/02/14 02:27:53
Done.
| |
13 const char *FindFmap(const char *ptr, size_t size) | |
gauravsh
2011/02/10 20:02:05
const char*
Che-Liang Chiou
2011/02/14 02:27:53
Done.
| |
14 { | |
15 size_t i; | |
16 for (i=0; i<size; i += FMAP_SEARCH_STRIDE) { | |
17 if (0 == strncmp(ptr, "__FMAP__", 8)) | |
Randall Spangler
2011/02/11 17:26:04
Seems like "__FMAP__" should be a const string or
Che-Liang Chiou
2011/02/14 02:27:53
Done.
| |
18 return ptr; | |
19 ptr += FMAP_SEARCH_STRIDE; | |
20 } | |
21 return NULL; | |
22 } | |
23 | |
24 int FmapAreaIndex(const FmapHeader* fh, const FmapAreaHeader* ah, | |
25 const char* name) { | |
26 int i; | |
27 for (i = 0; i < fh->fmap_nareas; i++) | |
28 if (!strcmp((const char*) ah[i].area_name, name)) | |
29 return i; | |
30 return -1; | |
31 } | |
OLD | NEW |