fs: add openat systemcall

openat system call be used to open a file relative to passed directory
fd.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add dirfd api

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Reviewed-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
test: add openat testcase

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libzfs: define unresolved devid_get function

Reviewed-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libzfs: disable BSD specific geom_gettree call

Reviewed-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zfs: skip character devices for ZFS pool lookup

ZFS zpool would only be created on block devices passed to OSv instance.
This patch removes all character devices being lookedup for a pool. The
change is essential, since reading from console for example would block
indefinitely.

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zpool: fix pool import assert when name starts with number

Reviewed-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zfs: ioctl(TRYIMPORT) must fail if config buf is insufficient

ZFS maintains pool configuration in nvlist inside VDEV label. Block
devices which are part of a pool are called as VDEVs. VDEVs form a
hierarchical tree like structure. A VDEV label contains information
describing this physical VDEV as well as all VDEVs which share common
top level logical VDEV.

When pool is imported, ZFS finds appropriate block device and reads
VDEV label for pool configuration. Since a single VDEV only maintains
information about all VDEVs which share common logical VDEV. It has to
refresh the configuration information to know about other logical VDEVs.

ZFS uses IOCTL(ZFS_IOC_POOL_TRYIMPORT) to try a pool import. The
TRYIMPORT also returns, to caller, complete pool configuration along
with it's health information. However, if the passed buffer from
userland is insufficient to capture all config information, it must
fail with ENOMEM. Instructing the caller, to pass larger buffer. The
expected size of the buffer is also passed to caller. The caller,
refresh_config() then allocates larger buffer and retries ioctl.

Reviewed-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: initial implementation of getauxval

getauxval is a quite arcane function that returns characteristics of the ELF
loader. For the initial support of RPM, only a couple of fields are needed.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tcp_output(): maximize LSO frames size

Maximizing the LSO packet size we reduce the CPU usage both in
the Guest, and in HV.

This improves the netperf TCP_STREAM test performance when it's executed vs
the netserver on the same host where we run an OSv Guest (8GB RAM, 1 vCPU)
by the following margins:

message size    compared to origin
64              30.18%
128             31.86%
256             59.60%
512             97.88%
1024            214.14%
2048            247.84%
4096            208.82%
8192            106.49%
16384           38.51%
32768           12.69%
65536           5.01%

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Add routes API

This patch adds an api for the ip route table.
A call to:
http://localhost:8000/network/route/
returns a list of the available routes.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
bsd: change zfs rwlock implementation to use OSv's rwlock instead of mutex

Gleb explains:

  This is needed for common sense. I do not see improvement with
  Cassandra unfortunately.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>