This source file includes following definitions.
- ACPI_MODULE_NAME
1
2
3
4
5
6
7
8
9
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acapps.h"
13
14 #define _COMPONENT ACPI_TOOLS
15 ACPI_MODULE_NAME("cmfsize")
16
17
18
19
20
21
22
23
24
25
26
27
28
29 u32 cm_get_file_size(ACPI_FILE file)
30 {
31 long file_size;
32 long current_offset;
33 acpi_status status;
34
35
36
37 current_offset = ftell(file);
38 if (current_offset < 0) {
39 goto offset_error;
40 }
41
42 status = fseek(file, 0, SEEK_END);
43 if (ACPI_FAILURE(status)) {
44 goto seek_error;
45 }
46
47 file_size = ftell(file);
48 if (file_size < 0) {
49 goto offset_error;
50 }
51
52
53
54 status = fseek(file, current_offset, SEEK_SET);
55 if (ACPI_FAILURE(status)) {
56 goto seek_error;
57 }
58
59 return ((u32)file_size);
60
61 offset_error:
62 fprintf(stderr, "Could not get file offset\n");
63 return (ACPI_UINT32_MAX);
64
65 seek_error:
66 fprintf(stderr, "Could not set file offset\n");
67 return (ACPI_UINT32_MAX);
68 }