]>
Commit | Line | Data |
---|---|---|
93d9f139 | 1 | /* |
da23017d NS |
2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
93d9f139 | 4 | * |
da23017d NS |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License as | |
93d9f139 NS |
7 | * published by the Free Software Foundation. |
8 | * | |
da23017d NS |
9 | * This program is distributed in the hope that it would be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
93d9f139 | 13 | * |
da23017d NS |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
93d9f139 NS |
17 | */ |
18 | ||
6b803e5a | 19 | #include "libxfs.h" |
cb5b3ef4 | 20 | #include <diskinfo.h> |
3b6ac903 | 21 | #include <sys/sysmp.h> |
93d9f139 | 22 | |
e321f629 | 23 | int platform_has_uuid = 0; |
93d9f139 | 24 | extern char *progname; |
14f8b681 | 25 | extern int64_t findsize(char *); |
93d9f139 NS |
26 | |
27 | int | |
f594a0d1 | 28 | platform_check_ismounted(char *name, char *block, struct stat *s, int verbose) |
93d9f139 NS |
29 | { |
30 | return 0; | |
31 | } | |
32 | ||
33 | int | |
f594a0d1 | 34 | platform_check_iswritable(char *name, char *block, struct stat *s) |
93d9f139 NS |
35 | { |
36 | return 1; | |
37 | } | |
38 | ||
edd45774 TS |
39 | int |
40 | platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal) | |
93d9f139 | 41 | { |
edd45774 | 42 | return fatal; |
93d9f139 NS |
43 | } |
44 | ||
45 | void | |
ac419944 | 46 | platform_flush_device(int fd, dev_t device) |
93d9f139 NS |
47 | { |
48 | return; | |
49 | } | |
50 | ||
f02037ce NS |
51 | void |
52 | platform_findsizes(char *path, int fd, long long *sz, int *bsz) | |
93d9f139 | 53 | { |
f594a0d1 | 54 | struct stat st; |
93d9f139 | 55 | |
f594a0d1 | 56 | if (fstat(fd, &st) < 0) { |
93d9f139 NS |
57 | fprintf(stderr, |
58 | _("%s: cannot stat the device file \"%s\": %s\n"), | |
59 | progname, path, strerror(errno)); | |
60 | exit(1); | |
61 | } | |
f02037ce NS |
62 | if ((st.st_mode & S_IFMT) == S_IFREG) { |
63 | *sz = (long long)(st.st_size >> 9); | |
64 | } else { | |
65 | *sz = findsize(path); | |
66 | } | |
67 | *bsz = BBSIZE; | |
93d9f139 | 68 | } |
cb5b3ef4 | 69 | |
cb5b3ef4 MV |
70 | char * |
71 | platform_findrawpath(char *path) | |
72 | { | |
73 | return findrawpath(path); | |
74 | } | |
1aef52f8 | 75 | |
b74a1f6a NS |
76 | char * |
77 | platform_findblockpath(char *path) | |
78 | { | |
79 | return findblockpath(path); | |
80 | } | |
81 | ||
82 | int | |
83 | platform_direct_blockdev(void) | |
84 | { | |
85 | return 0; | |
86 | } | |
87 | ||
88 | int | |
89 | platform_align_blockdev(void) | |
1aef52f8 | 90 | { |
af43ca9f | 91 | return sizeof(void *); |
1aef52f8 | 92 | } |
3b6ac903 MV |
93 | |
94 | int | |
95 | platform_nproc(void) | |
96 | { | |
97 | return sysmp(MP_NPROCS); | |
98 | } | |
99 | ||
2556c98b BN |
100 | unsigned long |
101 | platform_physmem(void) | |
102 | { | |
103 | struct rminfo ri; | |
104 | ||
105 | if (sysmp(MP_SAGET, MPSA_RMINFO, &ri, sizeof(ri)) < 0) | |
106 | fprintf(stderr, _("%s: can't determine memory size\n"), | |
107 | progname); | |
108 | exit(1); | |
109 | } | |
110 | return (ri.physmem >> 10) * getpagesize(); /* kilobytes */ | |
af43ca9f | 111 | } |