]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - libxfs/irix.c
libxfs/linux.c: Replace use of ustat by stat
[thirdparty/xfsprogs-dev.git] / libxfs / irix.c
1 /*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
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.
13 *
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
17 */
18
19 #include "libxfs.h"
20 #include <diskinfo.h>
21 #include <sys/sysmp.h>
22
23 int platform_has_uuid = 0;
24 extern char *progname;
25 extern __int64_t findsize(char *);
26
27 int
28 platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
29 {
30 return 0;
31 }
32
33 int
34 platform_check_iswritable(char *name, char *block, struct stat64 *s, int fatal)
35 {
36 return 1;
37 }
38
39 int
40 platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatal)
41 {
42 return fatal;
43 }
44
45 void
46 platform_flush_device(int fd, dev_t device)
47 {
48 return;
49 }
50
51 void
52 platform_findsizes(char *path, int fd, long long *sz, int *bsz)
53 {
54 struct stat64 st;
55
56 if (fstat64(fd, &st) < 0) {
57 fprintf(stderr,
58 _("%s: cannot stat the device file \"%s\": %s\n"),
59 progname, path, strerror(errno));
60 exit(1);
61 }
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;
68 }
69
70 char *
71 platform_findrawpath(char *path)
72 {
73 return findrawpath(path);
74 }
75
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)
90 {
91 return sizeof(void *);
92 }
93
94 int
95 platform_nproc(void)
96 {
97 return sysmp(MP_NPROCS);
98 }
99
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 */
111 }