aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/hpux
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/hpux')
-rw-r--r--arch/parisc/hpux/sys_hpux.c66
1 files changed, 22 insertions, 44 deletions
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index ba430a03bc7a..6ab9580b0b00 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -28,7 +28,6 @@
28#include <linux/namei.h> 28#include <linux/namei.h>
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/smp_lock.h>
32#include <linux/syscalls.h> 31#include <linux/syscalls.h>
33#include <linux/utsname.h> 32#include <linux/utsname.h>
34#include <linux/vfs.h> 33#include <linux/vfs.h>
@@ -186,26 +185,21 @@ struct hpux_statfs {
186 int16_t f_pad; 185 int16_t f_pad;
187}; 186};
188 187
189static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf) 188static int do_statfs_hpux(struct kstatfs *st, struct hpux_statfs __user *p)
190{ 189{
191 struct kstatfs st; 190 struct hpux_statfs buf;
192 int retval; 191 memset(&buf, 0, sizeof(buf));
193 192 buf.f_type = st->f_type;
194 retval = vfs_statfs(path, &st); 193 buf.f_bsize = st->f_bsize;
195 if (retval) 194 buf.f_blocks = st->f_blocks;
196 return retval; 195 buf.f_bfree = st->f_bfree;
197 196 buf.f_bavail = st->f_bavail;
198 memset(buf, 0, sizeof(*buf)); 197 buf.f_files = st->f_files;
199 buf->f_type = st.f_type; 198 buf.f_ffree = st->f_ffree;
200 buf->f_bsize = st.f_bsize; 199 buf.f_fsid[0] = st->f_fsid.val[0];
201 buf->f_blocks = st.f_blocks; 200 buf.f_fsid[1] = st->f_fsid.val[1];
202 buf->f_bfree = st.f_bfree; 201 if (copy_to_user(p, &buf, sizeof(buf)))
203 buf->f_bavail = st.f_bavail; 202 return -EFAULT;
204 buf->f_files = st.f_files;
205 buf->f_ffree = st.f_ffree;
206 buf->f_fsid[0] = st.f_fsid.val[0];
207 buf->f_fsid[1] = st.f_fsid.val[1];
208
209 return 0; 203 return 0;
210} 204}
211 205
@@ -213,35 +207,19 @@ static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf)
213asmlinkage long hpux_statfs(const char __user *pathname, 207asmlinkage long hpux_statfs(const char __user *pathname,
214 struct hpux_statfs __user *buf) 208 struct hpux_statfs __user *buf)
215{ 209{
216 struct path path; 210 struct kstatfs st;
217 int error; 211 int error = user_statfs(pathname, &st);
218 212 if (!error)
219 error = user_path(pathname, &path); 213 error = do_statfs_hpux(&st, buf);
220 if (!error) {
221 struct hpux_statfs tmp;
222 error = do_statfs_hpux(&path, &tmp);
223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
224 error = -EFAULT;
225 path_put(&path);
226 }
227 return error; 214 return error;
228} 215}
229 216
230asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf) 217asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
231{ 218{
232 struct file *file; 219 struct kstatfs st;
233 struct hpux_statfs tmp; 220 int error = fd_statfs(fd, &st);
234 int error; 221 if (!error)
235 222 error = do_statfs_hpux(&st, buf);
236 error = -EBADF;
237 file = fget(fd);
238 if (!file)
239 goto out;
240 error = do_statfs_hpux(&file->f_path, &tmp);
241 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
242 error = -EFAULT;
243 fput(file);
244 out:
245 return error; 223 return error;
246} 224}
247 225