Deleted Added
full compact
linux_stats.c (83667) linux_stats.c (89306)
1/*-
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/compat/linux/linux_stats.c 83667 2001-09-19 12:35:51Z sobomax $
28 * $FreeBSD: head/sys/compat/linux/linux_stats.c 89306 2002-01-13 11:58:06Z alfred $
29 */
30
31#include <sys/param.h>
32#include <sys/conf.h>
33#include <sys/dirent.h>
34#include <sys/file.h>
35#include <sys/filedesc.h>
36#include <sys/proc.h>

--- 109 unchanged lines hidden (view full) ---

146 return (error);
147
148 return (newstat_copyout(&sb, args->buf));
149}
150
151int
152linux_newfstat(struct thread *td, struct linux_newfstat_args *args)
153{
29 */
30
31#include <sys/param.h>
32#include <sys/conf.h>
33#include <sys/dirent.h>
34#include <sys/file.h>
35#include <sys/filedesc.h>
36#include <sys/proc.h>

--- 109 unchanged lines hidden (view full) ---

146 return (error);
147
148 return (newstat_copyout(&sb, args->buf));
149}
150
151int
152linux_newfstat(struct thread *td, struct linux_newfstat_args *args)
153{
154 struct filedesc *fdp;
155 struct file *fp;
156 struct stat buf;
157 int error;
158
159#ifdef DEBUG
160 if (ldebug(newfstat))
161 printf(ARGS(newfstat, "%d, *"), args->fd);
162#endif
163
154 struct file *fp;
155 struct stat buf;
156 int error;
157
158#ifdef DEBUG
159 if (ldebug(newfstat))
160 printf(ARGS(newfstat, "%d, *"), args->fd);
161#endif
162
164 fdp = td->td_proc->p_fd;
165 if ((unsigned)args->fd >= fdp->fd_nfiles ||
166 (fp = fdp->fd_ofiles[args->fd]) == NULL)
163 fp = ffind_hold(td, args->fd);
164 if (fp == NULL)
167 return (EBADF);
168
169 error = fo_stat(fp, &buf, td);
165 return (EBADF);
166
167 error = fo_stat(fp, &buf, td);
168 fdrop(fp, td);
170 if (!error)
171 error = newstat_copyout(&buf, args->buf);
172
173 return (error);
174}
175
176/* XXX - All fields of type l_int are defined as l_long on i386 */
177struct l_statfs {

--- 103 unchanged lines hidden (view full) ---

281 printf(ARGS(fstatfs, "%d, *"), args->fd);
282#endif
283 error = getvnode(td->td_proc->p_fd, args->fd, &fp);
284 if (error)
285 return error;
286 mp = ((struct vnode *)fp->f_data)->v_mount;
287 bsd_statfs = &mp->mnt_stat;
288 error = VFS_STATFS(mp, bsd_statfs, td);
169 if (!error)
170 error = newstat_copyout(&buf, args->buf);
171
172 return (error);
173}
174
175/* XXX - All fields of type l_int are defined as l_long on i386 */
176struct l_statfs {

--- 103 unchanged lines hidden (view full) ---

280 printf(ARGS(fstatfs, "%d, *"), args->fd);
281#endif
282 error = getvnode(td->td_proc->p_fd, args->fd, &fp);
283 if (error)
284 return error;
285 mp = ((struct vnode *)fp->f_data)->v_mount;
286 bsd_statfs = &mp->mnt_stat;
287 error = VFS_STATFS(mp, bsd_statfs, td);
289 if (error)
288 if (error) {
289 fdrop(fp, td);
290 return error;
290 return error;
291 }
291 bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
292 linux_statfs.f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
293 linux_statfs.f_bsize = bsd_statfs->f_bsize;
294 linux_statfs.f_blocks = bsd_statfs->f_blocks;
295 linux_statfs.f_bfree = bsd_statfs->f_bfree;
296 linux_statfs.f_bavail = bsd_statfs->f_bavail;
297 linux_statfs.f_ffree = bsd_statfs->f_ffree;
298 linux_statfs.f_files = bsd_statfs->f_files;
299 linux_statfs.f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
300 linux_statfs.f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
301 linux_statfs.f_namelen = MAXNAMLEN;
292 bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
293 linux_statfs.f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
294 linux_statfs.f_bsize = bsd_statfs->f_bsize;
295 linux_statfs.f_blocks = bsd_statfs->f_blocks;
296 linux_statfs.f_bfree = bsd_statfs->f_bfree;
297 linux_statfs.f_bavail = bsd_statfs->f_bavail;
298 linux_statfs.f_ffree = bsd_statfs->f_ffree;
299 linux_statfs.f_files = bsd_statfs->f_files;
300 linux_statfs.f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
301 linux_statfs.f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
302 linux_statfs.f_namelen = MAXNAMLEN;
302 return copyout((caddr_t)&linux_statfs, (caddr_t)args->buf,
303 error = copyout((caddr_t)&linux_statfs, (caddr_t)args->buf,
303 sizeof(linux_statfs));
304 sizeof(linux_statfs));
305 fdrop(fp, td);
306 return error;
304}
305
306struct l_ustat
307{
308 l_daddr_t f_tfree;
309 l_ino_t f_tinode;
310 char f_fname[6];
311 char f_fpack[6];

--- 166 unchanged lines hidden ---
307}
308
309struct l_ustat
310{
311 l_daddr_t f_tfree;
312 l_ino_t f_tinode;
313 char f_fname[6];
314 char f_fpack[6];

--- 166 unchanged lines hidden ---