Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/bouyer-quota2]: src Sync with HEAD



details:   https://anonhg.NetBSD.org/src/rev/556cf2db5d6c
branches:  bouyer-quota2
changeset: 761122:556cf2db5d6c
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Feb 08 19:01:36 2011 +0000

description:
Sync with HEAD

diffstat:

 lib/libdm/Makefile                        |   23 +
 lib/libdm/dm.3                            |  398 +++++++++++++
 lib/libdm/dm.h                            |  154 +++++
 lib/libdm/libdm_ioctl.c                   |  895 ++++++++++++++++++++++++++++++
 lib/libdm/shlib_version                   |    4 +
 lib/libnpf/Makefile                       |   20 +
 lib/libnpf/npf.3                          |  296 +++++++++
 lib/libnpf/npf.c                          |  544 ++++++++++++++++++
 lib/libnpf/npf.h                          |   98 +++
 lib/libnpf/shlib_version                  |    5 +
 tests/lib/librumphijack/Atffile           |    6 +
 tests/lib/librumphijack/Makefile          |   16 +
 tests/lib/librumphijack/h_netget.c        |  101 +++
 tests/lib/librumphijack/index.html        |    5 +
 tests/lib/librumphijack/netstat.expout    |    6 +
 tests/lib/librumphijack/t_tcpip.sh        |   70 ++
 tests/net/route/Makefile                  |   10 +
 tests/net/route/t_change.sh               |   65 ++
 tests/usr.bin/Makefile                    |   10 +
 tests/usr.bin/rump_server/Makefile        |   10 +
 tests/usr.bin/rump_server/t_disk.sh       |   96 +++
 usr.bin/rump_dhcpclient/Makefile          |    9 +
 usr.bin/rump_dhcpclient/bpf-filter.h      |  101 +++
 usr.bin/rump_dhcpclient/bpf.c             |  205 ++++++
 usr.bin/rump_dhcpclient/common.c          |  195 ++++++
 usr.bin/rump_dhcpclient/common.h          |   76 ++
 usr.bin/rump_dhcpclient/configure.c       |  467 +++++++++++++++
 usr.bin/rump_dhcpclient/configure.h       |   38 +
 usr.bin/rump_dhcpclient/dhcp.c            |  773 +++++++++++++++++++++++++
 usr.bin/rump_dhcpclient/dhcp.h            |  201 ++++++
 usr.bin/rump_dhcpclient/dhcpcd.h          |  122 ++++
 usr.bin/rump_dhcpclient/if-bsd.c          |  267 ++++++++
 usr.bin/rump_dhcpclient/if-options.h      |  123 ++++
 usr.bin/rump_dhcpclient/main.c            |  272 +++++++++
 usr.bin/rump_dhcpclient/net.c             |  503 ++++++++++++++++
 usr.bin/rump_dhcpclient/net.h             |  156 +++++
 usr.bin/rump_dhcpclient/rump.dhcpclient.1 |   68 ++
 37 files changed, 6408 insertions(+), 0 deletions(-)

diffs (truncated from 6557 to 300 lines):

diff -r 62eb796faca1 -r 556cf2db5d6c lib/libdm/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libdm/Makefile        Tue Feb 08 19:01:36 2011 +0000
@@ -0,0 +1,23 @@
+# $NetBSD: Makefile,v 1.1.2.2 2011/02/08 19:01:36 bouyer Exp $
+USE_FORT?= no  # network protocol library
+
+LIB=    dm
+
+SRCS=   libdm_ioctl.c
+MAN=   dm.3
+
+WARN= 4
+
+CPPFLAGS+= -I${.CURDIR}
+#CFLAGS+= -g -O0
+INCS= dm.h
+INCSDIR= /usr/include
+
+#LDADD+= -lprop
+#DPADD+= ${LIBPROP}
+
+.ifdef RUMP_ACTION
+CPPFLAGS+= -DRUMP_ACTION
+.endif
+
+.include <bsd.lib.mk>
diff -r 62eb796faca1 -r 556cf2db5d6c lib/libdm/dm.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libdm/dm.3    Tue Feb 08 19:01:36 2011 +0000
@@ -0,0 +1,398 @@
+.\"     $NetBSD: dm.3,v 1.2.2.2 2011/02/08 19:01:36 bouyer Exp $
+.\"
+.\" Copyright (c) 2004,2009 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Adam Hamsik.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.Dd January 22, 2011
+.Dt DM 3
+.Os
+.Sh NAME
+.Nm libdm
+.Nd device-mapper access manipulation library
+.Sh LIBRARY
+.Lb libdm
+.Sh SYNOPSIS
+.In libdm.h
+.Ft void
+.Fn libdm_iter_destroy "libdm_iter_t libdm_iter"
+.Ft int
+.Fn libdm_task_run "libdm_task_t *libdm_task"
+.Ft libdm_task_t
+.Fn libdm_task_create "const char *command"
+.Ft void
+.Fn libdm_task_destroy "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_name "const char *name" "libdm_task_t libdm_task"
+.Ft char *
+.Fn libdm_task_get_name "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_uuid "const char *uuid" "libdm_task_t libdm_task"
+.Ft char *
+.Fn libdm_task_get_uuid "libdm_task_t libdm_task"
+.Ft char *
+.Fn libdm_task_get_command "libdm_task_t libdm_task"
+.Ft int32_t
+.Fn libdm_task_get_cmd_version "libdm_task_t libdm_task" "uint32_t *ver" "size_t size"
+.Ft int
+.Fn libdm_task_set_minor "uint32_t minor" "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_minor "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_flags "uint32_t flags" "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_flags "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_target_num "libdm_task_t libdm_task"
+.Ft int32_t
+.Fn libdm_task_get_open_num "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_event_num "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_cmd "libdm_cmd_t libdm_cmd" "libdm_task_t libdm_task"
+.Ft libdm_cmd_t
+.Fn libdm_task_get_cmd "libdm_task_t libdm_task"
+.Ft libdm_cmd_t
+.Fn libdm_cmd_create "void"
+.Ft void
+.Fn libdm_cmd_destroy "libdm_cmd_t libdm_cmd"
+.Ft libdm_iter_t
+.Fn libdm_cmd_iter_create "libdm_cmd_t libdm_cmd"
+.Ft int
+.Fn libdm_cmd_set_table "libdm_table_t libdm_table" "libdm_cmd_t libdm_cmd"
+.Ft libdm_table_t
+.Fn libdm_cmd_get_table "libdm_iter_t iter"
+.Ft libdm_target_t
+.Fn libdm_cmd_get_target "libdm_iter_t iter"
+.Ft libdm_dev_t
+.Fn libdm_cmd_get_dev "libdm_iter_t iter"
+.Ft uint64_t
+.Fn libdm_cmd_get_deps "libdm_iter_t libdm_iter"
+.Ft libdm_table_t
+.Fn libdm_table_create "void"
+.Ft void
+.Fn libdm_table_destroy "libdm_table_t libdm_table"
+.Ft int
+.Fn libdm_table_set_start "uint64_t start" "libdm_table_t libdm_table"
+.Ft uint64_t
+.Fn libdm_table_get_start "libdm_table_t libdm_table"
+.Ft int
+.Fn libdm_table_set_length "uint64_t length" "libdm_table_t libdm_table"
+.Ft uint64_t
+.Fn libdm_table_get_length "libdm_table_t libdm_table"
+.Ft int
+.Fn libdm_table_set_target "const char *name" "libdm_table_t libdm_table"
+.Ft char *
+.Fn libdm_table_get_target "libdm_table_t libdm_table"
+.Ft int
+.Fn libdm_table_set_params "const char *params" "libdm_table_t  libdm_table"
+.Ft char *
+.Fn libdm_table_get_params "libdm_table_t  libdm_table"
+.Ft int32_t
+.Fn libdm_table_get_status "libdm_table_t libdm_table"
+.Ft void
+.Fn libdm_target_destroy "libdm_target_t libdm_target"
+.Ft char *
+.Fn libdm_target_get_name "libdm_target_t libdm_target"
+.Ft int32_t
+.Fn libdm_target_get_version "libdm_target_t libdm_target" "uint32_t *ver" "size_t size"
+.Ft void
+.Fn libdm_dev_destroy "libdm_dev_t libdm_dev"
+.Ft char *
+.Fn libdm_dev_get_name "libdm_dev_t libdm_dev"
+.Ft uint32_t
+.Fn libdm_dev_get_minor "libdm_dev_t libdm_dev"
+.Ft int
+.Fn libdm_dev_set_newname "const char *newname" "libdm_cmd_t libdm_cmd"
+.Sh DESCRIPTION
+Every object in libdm has its own create and destroy routine.
+.Bl -bullet -offset indent -compact
+.It
+libdm_task_t
+.It
+libdm_cmd_t
+.It
+libdm_table_t
+.El
+.Pp
+Except
+.Vt libdm_dev_t
+which is received from kernel as list of physical devices on which
+the logical device depends.
+.Vt libdm_target_t
+which is received from kernel as list of available targets to use.
+.Vt libdm_iter_t
+which is used as iteration counter for array entries in the task structure.
+.Pp
+Every object attribute in libdm can be set and gotten by appropriate routines,
+therefore there always are set and get routines.
+.Ss LIBDM TASK
+The
+.Fn libdm_task_create
+function creates a libdm task dictionary with command string set to
+.Fa command .
+If
+.Fa command
+is
+.Dv NULL ,
+libdm_task_t is not created and the function returns
+.Dv NULL .
+.Pp
+.Fn libdm_task_destroy
+free all memory allocated to
+.Fa libdm_task
+by
+.Fn libdm_task_create .
+.Pp
+.Fn libdm_task_run
+Sends created
+.Fa libdm_task
+to kernel and receives new one as reply.
+.Pp
+List of attributes avaialable in
+.Vt libdm_task_t :
+.Bl -column -offset indent "DM_IOCTL_TARGET_COUNT" "Number of table entries" "XXX"
+.It Sy Attribute Ta Sy Description Ta Sy Mode
+.It Li DM_IOCTL_OPEN Ta Device open-count Ta Read-Only
+.It Li DM_IOCTL_MINOR Ta Device minor number Ta Read-Write
+.It Li DM_IOCTL_NAME Ta Device name Ta Read-Write
+.It Li DM_IOCTL_UUID Ta Device uuid Ta Read-Write
+.It Li DM_IOCTL_TARGET_COUNT Ta Number of table entries Ta Read-Only
+.\".It Li DM_IOCTL_EVENT Ta Not implemented Ta not imp
+.It Li DM_IOCTL_FLAGS Ta Device status flags Ta Read-Write
+.El
+.Pp
+.Fn libdm_task_set_name
+and
+.Fn libdm_task_get_name
+Set name of the device for commands which need to have a dm device
+identifier.
+The device-mapper later uses the device name to look up the device
+from the list of all devices.
+The get routine will fetch the device name from the task dictionary.
+.Pp
+.Fn libdm_task_set_uuid
+and
+.Fn libdm_task_get_uuid
+Set uuid of device for commands which need to have a dm device
+identifier.
+The device-mapper later uses the device uuid to look up the device
+from the list of all devices.
+The get routine will fetch the device uuid from the task dictionary.
+.Pp
+.Fn libdm_task_set_minor
+and
+.Fn libdm_task_get_minor
+Set minor device number of device for commands which need to have
+a dm device identifier.
+The device-mapper later uses the device minor number to look up
+the device from the list of all devices.
+The get routine will fetch the device minor number from the task
+dictionary.
+.Pp
+.Fn libdm_task_set_flags
+and
+.Fn libdm_task_get_flags
+Set/fetch device status flags from the task dictionary.
+.Pp
+.Fn libdm_task_get_open_num
+Fetch number of opened devices from the kernel and return them as
+.Rt count .
+.Pp
+.Fn libdm_task_get_target_num
+Fetch number of opened devices from the kernel and return them as
+.Rt count .
+.Pp
+.Fn libdm_task_get_cmd_version
+Get the version of the dm driver in the kernel as array
+.Fa uint32_t *ver
+of size
+.Fa size .
+.Fn libdm_task_set_cmd
+and
+.Fn libdm_task_get_cmd
+Add and fetch cmd structure from
+.Vt libdm_task_t .
+.Vt libdm_cmd_t
+is the container used to carry information specific for the particular
+command.
+cmd is usually set before libdm_task_run is used and is taken from
+the task structure after the task run was called.
+.Ss LIBDM TASK CMD
+The
+.Fn libdm_cmd_create
+function will allocate a cmd structure which can later be put in
+to the task.
+.Pp
+.Fn libdm_cmd_destroy
+will deallocate a previously allocated cmd structure.
+.Pp
+.Fn libdm_cmd_set_table
+Will load and fetch the device mapping table from the dm device.
+The table is usually loaded to the device during initial device
+creation or device resizing.
+.Pp
+Because libdm_cmd is an array of structures, all _get routines need an
+iterator to work.
+For every entry we can have more than one.
+.Fn libdm_cmd_get_table
+When the user creates a task with the "status" command, the kernel
+sends cmd with a table in it.
+.Pp
+.Fn libdm_cmd_get_target
+Get mapping target description from cmd.
+Target contains target_name and target_version.
+.Pp
+.Fn libdm_cmd_get_dev
+When user creates a task with the "info" command, the kernel sends



Home | Main Index | Thread Index | Old Index