Deleted Added
full compact
linux_file.c (227693) linux_file.c (228957)
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

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

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
29#include <sys/cdefs.h>
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

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

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
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_file.c 227693 2011-11-19 07:19:37Z ed $");
30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_file.c 228957 2011-12-29 15:34:59Z jhb $");
31
32#include "opt_compat.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/capability.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

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

1525#ifdef DEBUG
1526 if (ldebug(lchown))
1527 printf(ARGS(lchown, "%s, %d, %d"), path, args->uid, args->gid);
1528#endif
1529 error = kern_lchown(td, path, UIO_SYSSPACE, args->uid, args->gid);
1530 LFREEPATH(path);
1531 return (error);
1532}
31
32#include "opt_compat.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/capability.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

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

1525#ifdef DEBUG
1526 if (ldebug(lchown))
1527 printf(ARGS(lchown, "%s, %d, %d"), path, args->uid, args->gid);
1528#endif
1529 error = kern_lchown(td, path, UIO_SYSSPACE, args->uid, args->gid);
1530 LFREEPATH(path);
1531 return (error);
1532}
1533
1534static int
1535convert_fadvice(int advice)
1536{
1537 switch (advice) {
1538 case LINUX_POSIX_FADV_NORMAL:
1539 return (POSIX_FADV_NORMAL);
1540 case LINUX_POSIX_FADV_RANDOM:
1541 return (POSIX_FADV_RANDOM);
1542 case LINUX_POSIX_FADV_SEQUENTIAL:
1543 return (POSIX_FADV_SEQUENTIAL);
1544 case LINUX_POSIX_FADV_WILLNEED:
1545 return (POSIX_FADV_WILLNEED);
1546 case LINUX_POSIX_FADV_DONTNEED:
1547 return (POSIX_FADV_DONTNEED);
1548 case LINUX_POSIX_FADV_NOREUSE:
1549 return (POSIX_FADV_NOREUSE);
1550 default:
1551 return (-1);
1552 }
1553}
1554
1555int
1556linux_fadvise64(struct thread *td, struct linux_fadvise64_args *args)
1557{
1558 int advice;
1559
1560 advice = convert_fadvice(args->advice);
1561 if (advice == -1)
1562 return (EINVAL);
1563 return (kern_posix_fadvise(td, args->fd, args->offset, args->len,
1564 advice));
1565}
1566
1567int
1568linux_fadvise64_64(struct thread *td, struct linux_fadvise64_64_args *args)
1569{
1570 int advice;
1571
1572 advice = convert_fadvice(args->advice);
1573 if (advice == -1)
1574 return (EINVAL);
1575 return (kern_posix_fadvise(td, args->fd, args->offset, args->len,
1576 advice));
1577}