From owner-svn-src-stable-9@FreeBSD.ORG Thu Jul 17 02:22:06 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 46FFECE0; Thu, 17 Jul 2014 02:22:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 312162D85; Thu, 17 Jul 2014 02:22:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6H2M6ji060167; Thu, 17 Jul 2014 02:22:06 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6H2M3D5060147; Thu, 17 Jul 2014 02:22:03 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407170222.s6H2M3D5060147@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 17 Jul 2014 02:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268783 - in stable/9/lib/libedit: . TEST X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2014 02:22:06 -0000 Author: pfg Date: Thu Jul 17 02:22:03 2014 New Revision: 268783 URL: http://svnweb.freebsd.org/changeset/base/268783 Log: MFC r268502: Sync some (mostly cosmetical) changes from NetBSD Makefile,v 1.37 tc1.c v 1.3 Rename TEST/test.c tc1.c common.c,v 1.23 pass lint on _LP64. emacs.c,v 1.22 pass lint on _LP64. filecomplete.h,v 1.8 mv NetBSD ID back from 1.9 as we don't have the widecharacter support. prompt.c,v 1.14 prompt.h,v 1.9 term.h,v 1.20 read.h,v 1.6 Update NetBSD version strings sys.h,v 1.12 Misc sun stuff. tty.c 1.31 handle EINTR in the termios operations Allow a single process to control multiple ttys (for pthreads using _REENTRANT) using multiple EditLine objects. pass lint on _LP64. Don't depend on side effects inside an assert Obtained from: NetBSD Added: stable/9/lib/libedit/TEST/tc1.c - copied unchanged from r268502, head/lib/libedit/TEST/tc1.c Deleted: stable/9/lib/libedit/TEST/test.c Modified: stable/9/lib/libedit/Makefile stable/9/lib/libedit/common.c stable/9/lib/libedit/emacs.c stable/9/lib/libedit/filecomplete.h stable/9/lib/libedit/histedit.h stable/9/lib/libedit/prompt.c stable/9/lib/libedit/prompt.h stable/9/lib/libedit/read.h stable/9/lib/libedit/sys.h stable/9/lib/libedit/term.h stable/9/lib/libedit/tty.c Directory Properties: stable/9/lib/libedit/ (props changed) Modified: stable/9/lib/libedit/Makefile ============================================================================== --- stable/9/lib/libedit/Makefile Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/Makefile Thu Jul 17 02:22:03 2014 (r268783) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.34 2005/05/28 12:02:53 lukem Exp $ +# $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ @@ -70,9 +70,9 @@ editline.c: ${OSRCS} editline.o editline.po editline.So editline.ln: \ common.h emacs.h fcns.c fcns.h help.c help.h vi.h -test.o: ${.CURDIR}/TEST/test.c +tc1.o: ${.CURDIR}/TEST/tc1.c -test: test.o libedit.a ${DPADD} ${LIBTERMCAP} +test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP} ${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} .include Copied: stable/9/lib/libedit/TEST/tc1.c (from r268502, head/lib/libedit/TEST/tc1.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libedit/TEST/tc1.c Thu Jul 17 02:22:03 2014 (r268783, copy of r268502, head/lib/libedit/TEST/tc1.c) @@ -0,0 +1,298 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Christos Zoulas of Cornell University. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#include +#ifndef lint +__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); +#endif /* not lint */ + +#if !defined(lint) && !defined(SCCSID) +static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint && not SCCSID */ +__RCSID("$NetBSD: test.c,v 1.3 2009/07/17 12:25:52 christos Exp $"); +__FBSDID("$FreeBSD$"); + +/* + * test.c: A little test program + */ +#include "sys.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "histedit.h" + +static int continuation = 0; +volatile sig_atomic_t gotsig = 0; + +static unsigned char complete(EditLine *, int); + int main(int, char **); +static char *prompt(EditLine *); +static void sig(int); + +static char * +prompt(EditLine *el) +{ + static char a[] = "\1\e[7m\1Edit$\1\e[0m\1 "; + static char b[] = "Edit> "; + + return (continuation ? b : a); +} + +static void +sig(int i) +{ + gotsig = i; +} + +static unsigned char +complete(EditLine *el, int ch) +{ + DIR *dd = opendir("."); + struct dirent *dp; + const char* ptr; + const LineInfo *lf = el_line(el); + int len; + + /* + * Find the last word + */ + for (ptr = lf->cursor - 1; + !isspace((unsigned char)*ptr) && ptr > lf->buffer; ptr--) + continue; + len = lf->cursor - ++ptr; + + for (dp = readdir(dd); dp != NULL; dp = readdir(dd)) { + if (len > strlen(dp->d_name)) + continue; + if (strncmp(dp->d_name, ptr, len) == 0) { + closedir(dd); + if (el_insertstr(el, &dp->d_name[len]) == -1) + return (CC_ERROR); + else + return (CC_REFRESH); + } + } + + closedir(dd); + return (CC_ERROR); +} + +int +main(int argc, char *argv[]) +{ + EditLine *el = NULL; + int num; + const char *buf; + Tokenizer *tok; +#if 0 + int lastevent = 0; +#endif + int ncontinuation; + History *hist; + HistEvent ev; + + (void) signal(SIGINT, sig); + (void) signal(SIGQUIT, sig); + (void) signal(SIGHUP, sig); + (void) signal(SIGTERM, sig); + + hist = history_init(); /* Init the builtin history */ + /* Remember 100 events */ + history(hist, &ev, H_SETSIZE, 100); + + tok = tok_init(NULL); /* Initialize the tokenizer */ + + /* Initialize editline */ + el = el_init(*argv, stdin, stdout, stderr); + + el_set(el, EL_EDITOR, "vi"); /* Default editor is vi */ + el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */ + el_set(el, EL_PROMPT_ESC, prompt, '\1');/* Set the prompt function */ + + /* Tell editline to use this history interface */ + el_set(el, EL_HIST, history, hist); + + /* Add a user-defined function */ + el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete); + + /* Bind tab to it */ + el_set(el, EL_BIND, "^I", "ed-complete", NULL); + + /* + * Bind j, k in vi command mode to previous and next line, instead + * of previous and next history. + */ + el_set(el, EL_BIND, "-a", "k", "ed-prev-line", NULL); + el_set(el, EL_BIND, "-a", "j", "ed-next-line", NULL); + + /* + * Source the user's defaults file. + */ + el_source(el, NULL); + + while ((buf = el_gets(el, &num)) != NULL && num != 0) { + int ac, cc, co; +#ifdef DEBUG + int i; +#endif + const char **av; + const LineInfo *li; + li = el_line(el); +#ifdef DEBUG + (void) fprintf(stderr, "==> got %d %s", num, buf); + (void) fprintf(stderr, " > li `%.*s_%.*s'\n", + (li->cursor - li->buffer), li->buffer, + (li->lastchar - 1 - li->cursor), + (li->cursor >= li->lastchar) ? "" : li->cursor); + +#endif + if (gotsig) { + (void) fprintf(stderr, "Got signal %d.\n", (int)gotsig); + gotsig = 0; + el_reset(el); + } + + if (!continuation && num == 1) + continue; + + ac = cc = co = 0; + ncontinuation = tok_line(tok, li, &ac, &av, &cc, &co); + if (ncontinuation < 0) { + (void) fprintf(stderr, "Internal error\n"); + continuation = 0; + continue; + } +#ifdef DEBUG + (void) fprintf(stderr, " > nc %d ac %d cc %d co %d\n", + ncontinuation, ac, cc, co); +#endif +#if 0 + if (continuation) { + /* + * Append to the right event in case the user + * moved around in history. + */ + if (history(hist, &ev, H_SET, lastevent) == -1) + err(1, "%d: %s", lastevent, ev.str); + history(hist, &ev, H_ADD , buf); + } else { + history(hist, &ev, H_ENTER, buf); + lastevent = ev.num; + } +#else + /* Simpler */ + history(hist, &ev, continuation ? H_APPEND : H_ENTER, buf); +#endif + + continuation = ncontinuation; + ncontinuation = 0; + if (continuation) + continue; +#ifdef DEBUG + for (i = 0; i < ac; i++) { + (void) fprintf(stderr, " > arg# %2d ", i); + if (i != cc) + (void) fprintf(stderr, "`%s'\n", av[i]); + else + (void) fprintf(stderr, "`%.*s_%s'\n", + co, av[i], av[i] + co); + } +#endif + + if (strcmp(av[0], "history") == 0) { + int rv; + + switch (ac) { + case 1: + for (rv = history(hist, &ev, H_LAST); rv != -1; + rv = history(hist, &ev, H_PREV)) + (void) fprintf(stdout, "%4d %s", + ev.num, ev.str); + break; + + case 2: + if (strcmp(av[1], "clear") == 0) + history(hist, &ev, H_CLEAR); + else + goto badhist; + break; + + case 3: + if (strcmp(av[1], "load") == 0) + history(hist, &ev, H_LOAD, av[2]); + else if (strcmp(av[1], "save") == 0) + history(hist, &ev, H_SAVE, av[2]); + break; + + badhist: + default: + (void) fprintf(stderr, + "Bad history arguments\n"); + break; + } + } else if (el_parse(el, ac, av) == -1) { + switch (fork()) { + case 0: + execvp(av[0], __DECONST(char *const *, av)); + perror(av[0]); + _exit(1); + /*NOTREACHED*/ + break; + + case -1: + perror("fork"); + break; + + default: + if (wait(&num) == -1) + perror("wait"); + (void) fprintf(stderr, "Exit %x\n", num); + break; + } + } + + tok_reset(tok); + } + + el_end(el); + tok_end(tok); + history_end(hist); + + return (0); +} Modified: stable/9/lib/libedit/common.c ============================================================================== --- stable/9/lib/libedit/common.c Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/common.c Thu Jul 17 02:22:03 2014 (r268783) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $ + * $NetBSD: common.c,v 1.23 2009/02/27 04:18:45 msaitoh Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -121,7 +121,7 @@ ed_delete_prev_word(EditLine *el, int c *kp++ = *p; el->el_chared.c_kill.last = kp; - c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */ + c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */ el->el_line.cursor = cp; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; /* bounds check */ @@ -208,9 +208,6 @@ ed_move_to_end(EditLine *el, int c __unu el->el_line.cursor = el->el_line.lastchar; if (el->el_map.type == MAP_VI) { -#ifdef VI_MOVE - el->el_line.cursor--; -#endif if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); Modified: stable/9/lib/libedit/emacs.c ============================================================================== --- stable/9/lib/libedit/emacs.c Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/emacs.c Thu Jul 17 02:22:03 2014 (r268783) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $ + * $NetBSD: emacs.c,v 1.22 2009/02/15 21:55:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -101,7 +101,7 @@ em_delete_next_word(EditLine *el, int c *kp++ = *p; el->el_chared.c_kill.last = kp; - c_delafter(el, cp - el->el_line.cursor); /* delete after dot */ + c_delafter(el, (int)(cp - el->el_line.cursor)); /* delete after dot */ if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; /* bounds check */ @@ -131,7 +131,8 @@ em_yank(EditLine *el, int c __unused) cp = el->el_line.cursor; /* open the space, */ - c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); + c_insert(el, + (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf)); /* copy the chars */ for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) *cp++ = *kp; @@ -185,14 +186,14 @@ em_kill_region(EditLine *el, int c __unu while (cp < el->el_chared.c_kill.mark) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; - c_delafter(el, cp - el->el_line.cursor); + c_delafter(el, (int)(cp - el->el_line.cursor)); } else { /* mark is before cursor */ cp = el->el_chared.c_kill.mark; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.cursor) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; - c_delbefore(el, cp - el->el_chared.c_kill.mark); + c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark)); el->el_line.cursor = el->el_chared.c_kill.mark; } return (CC_REFRESH); @@ -446,7 +447,7 @@ em_copy_prev_word(EditLine *el, int c __ cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); - c_insert(el, oldc - cp); + c_insert(el, (int)(oldc - cp)); for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) *dp++ = *cp; Modified: stable/9/lib/libedit/filecomplete.h ============================================================================== --- stable/9/lib/libedit/filecomplete.h Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/filecomplete.h Thu Jul 17 02:22:03 2014 (r268783) @@ -26,7 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: filecomplete.h,v 1.9 2009/12/30 22:37:40 christos Exp $ + * $NetBSD: filecomplete.h,v 1.8 2009/02/16 00:15:45 christos Exp $ * $FreeBSD$ */ #ifndef _FILECOMPLETE_H_ Modified: stable/9/lib/libedit/histedit.h ============================================================================== --- stable/9/lib/libedit/histedit.h Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/histedit.h Thu Jul 17 02:22:03 2014 (r268783) @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)histedit.h 8.2 (Berkeley) 1/3/94 - * $NetBSD: histedit.h,v 1.32 2007/06/10 20:20:28 christos Exp $ + * $NetBSD: histedit.h,v 1.41 2009/09/07 21:24:33 christos Exp $ * $FreeBSD$ */ Modified: stable/9/lib/libedit/prompt.c ============================================================================== --- stable/9/lib/libedit/prompt.c Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/prompt.c Thu Jul 17 02:22:03 2014 (r268783) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: prompt.c,v 1.11 2003/08/07 16:44:32 agc Exp $ + * $NetBSD: prompt.c,v 1.14 2009/03/31 17:38:27 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) Modified: stable/9/lib/libedit/prompt.h ============================================================================== --- stable/9/lib/libedit/prompt.h Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/prompt.h Thu Jul 17 02:22:03 2014 (r268783) @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)prompt.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: prompt.h,v 1.6 2003/08/07 16:44:32 agc Exp $ + * $NetBSD: prompt.h,v 1.9 2009/03/31 17:38:27 christos Exp $ * $FreeBSD$ */ @@ -45,8 +45,8 @@ typedef char * (*el_pfunc_t)(EditLine*); typedef struct el_prompt_t { - el_pfunc_t p_func; /* Function to return the prompt */ - coord_t p_pos; /* position in the line after prompt */ + el_pfunc_t p_func; /* Function to return the prompt */ + coord_t p_pos; /* position in the line after prompt */ char p_ignore; /* character to start/end literal */ } el_prompt_t; Modified: stable/9/lib/libedit/read.h ============================================================================== --- stable/9/lib/libedit/read.h Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/read.h Thu Jul 17 02:22:03 2014 (r268783) @@ -26,7 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: read.h,v 1.5 2006/08/21 12:45:30 christos Exp $ + * $NetBSD: read.h,v 1.6 2008/04/29 06:53:01 martin Exp $ * $FreeBSD$ */ Modified: stable/9/lib/libedit/sys.h ============================================================================== --- stable/9/lib/libedit/sys.h Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/sys.h Thu Jul 17 02:22:03 2014 (r268783) @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)sys.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: sys.h,v 1.9 2004/01/17 17:57:40 christos Exp $ + * $NetBSD: sys.h,v 1.12 2009/08/31 00:05:43 christos Exp $ * $FreeBSD$ */ @@ -70,6 +70,15 @@ typedef void *ioctl_t; #define REGEX /* Use POSIX.2 regular expression functions */ #undef REGEXP /* Use UNIX V8 regular expression functions */ +#if defined(__sun) +extern int tgetent(char *, const char *); +extern int tgetflag(char *); +extern int tgetnum(char *); +extern int tputs(const char *, int, int (*)(int)); +extern char* tgoto(const char*, int, int); +extern char* tgetstr(char*, char**); +#endif + #ifdef notdef # undef REGEX # undef REGEXP Modified: stable/9/lib/libedit/term.h ============================================================================== --- stable/9/lib/libedit/term.h Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/term.h Thu Jul 17 02:22:03 2014 (r268783) @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)term.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: term.h,v 1.18 2006/11/24 00:01:17 christos Exp $ + * $NetBSD: term.h,v 1.20 2009/03/31 17:38:27 christos Exp $ * $FreeBSD$ */ Modified: stable/9/lib/libedit/tty.c ============================================================================== --- stable/9/lib/libedit/tty.c Thu Jul 17 02:14:25 2014 (r268782) +++ stable/9/lib/libedit/tty.c Thu Jul 17 02:22:03 2014 (r268783) @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $ + * $NetBSD: tty.c,v 1.31 2009/07/22 15:58:09 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -443,13 +443,12 @@ private const ttymodes_t ttymodes[] = { -#define tty_getty(el, td) tcgetattr((el)->el_infd, (td)) -#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) - #define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1) #define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8) #define tty__cooked_mode(td) ((td)->c_lflag & ICANON) +private int tty_getty(EditLine *, struct termios *); +private int tty_setty(EditLine *, int, const struct termios *); private int tty__getcharindex(int); private void tty__getchar(struct termios *, unsigned char *); private void tty__setchar(struct termios *, unsigned char *); @@ -458,6 +457,29 @@ private int tty_setup(EditLine *); #define t_qu t_ts +/* tty_getty(): + * Wrapper for tcgetattr to handle EINTR + */ +private int +tty_getty(EditLine *el, struct termios *t) +{ + int rv; + while ((rv = tcgetattr(el->el_infd, t)) == -1 && errno == EINTR) + continue; + return rv; +} + +/* tty_setty(): + * Wrapper for tcsetattr to handle EINTR + */ +private int +tty_setty(EditLine *el, int action, const struct termios *t) +{ + int rv; + while ((rv = tcsetattr(el->el_infd, action, t)) == -1 && errno == EINTR) + continue; + return rv; +} /* tty_setup(): * Get the tty parameters and initialize the editing state @@ -996,7 +1018,7 @@ tty_rawmode(EditLine *el) if (el->el_tty.t_mode == EX_IO) el->el_tty.t_ex = el->el_tty.t_ts; - if (tty_setty(el, &el->el_tty.t_ed) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", strerror(errno)); @@ -1021,7 +1043,7 @@ tty_cookedmode(EditLine *el) if (el->el_flags & EDIT_DISABLED) return (0); - if (tty_setty(el, &el->el_tty.t_ex) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", @@ -1057,7 +1079,7 @@ tty_quotemode(EditLine *el) el->el_tty.t_qu.c_lflag &= ~el->el_tty.t_t[QU_IO][MD_LIN].t_clrmask; el->el_tty.t_qu.c_lflag |= el->el_tty.t_t[QU_IO][MD_LIN].t_setmask; - if (tty_setty(el, &el->el_tty.t_qu) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_qu) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", strerror(errno)); @@ -1078,7 +1100,7 @@ tty_noquotemode(EditLine *el) if (el->el_tty.t_mode != QU_IO) return (0); - if (tty_setty(el, &el->el_tty.t_ed) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", strerror(errno)); @@ -1139,7 +1161,7 @@ tty_stty(EditLine *el, int argc __unused if (!argv || !*argv) { int i = -1; - int len = 0, st = 0, cu; + size_t len = 0, st = 0, cu; for (m = ttymodes; m->m_name; m++) { if (m->m_type != i) { (void) fprintf(el->el_outfile, "%s%s", @@ -1162,9 +1184,9 @@ tty_stty(EditLine *el, int argc __unused cu = strlen(m->m_name) + (x != '\0') + 1; - if (len + cu >= el->el_term.t_size.h) { + if (len + cu >= (size_t)el->el_term.t_size.h) { (void) fprintf(el->el_outfile, "\n%*s", - st, ""); + (int)st, ""); len = st + cu; } else len += cu; @@ -1208,7 +1230,8 @@ tty_stty(EditLine *el, int argc __unused int c = ffs((int)m->m_value); int v = *++p ? parse__escape((const char **) &p) : el->el_tty.t_vdisable; - assert(c-- != 0); + assert(c != 0); + c--; c = tty__getcharindex(c); assert(c != -1); tios->c_cc[c] = v; @@ -1229,6 +1252,17 @@ tty_stty(EditLine *el, int argc __unused break; } } + + if (el->el_tty.t_mode == z) { + if (tty_setty(el, TCSADRAIN, tios) == -1) { +#ifdef DEBUG_TTY + (void) fprintf(el->el_errfile, + "tty_stty: tty_setty: %s\n", strerror(errno)); +#endif /* DEBUG_TTY */ + return (-1); + } + } + return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Thu Jul 17 02:43:54 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6A831E7; Thu, 17 Jul 2014 02:43:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C29B52F0E; Thu, 17 Jul 2014 02:43:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6H2hsCX069656; Thu, 17 Jul 2014 02:43:54 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6H2hsnj069644; Thu, 17 Jul 2014 02:43:54 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407170243.s6H2hsnj069644@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 17 Jul 2014 02:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268785 - stable/9/sbin/fsck_msdosfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2014 02:43:55 -0000 Author: pfg Date: Thu Jul 17 02:43:53 2014 New Revision: 268785 URL: http://svnweb.freebsd.org/changeset/base/268785 Log: MFC r268628, r268631, r268635: Convert *rootDir from external to static. fsck_msdosfs: be a bit more permissive. The free space value in the FSInfo block is merely unitialized when it is 0xffffffff. This fixes a bug found in NetBSD. Respect FSFIXFAT. Fix some whitespace issues while here. Obtained from: NetBSD (CVS rev. 1.22, rev. 1.9), OpenBSD (misc) Modified: stable/9/sbin/fsck_msdosfs/check.c stable/9/sbin/fsck_msdosfs/dir.c stable/9/sbin/fsck_msdosfs/ext.h stable/9/sbin/fsck_msdosfs/fat.c Directory Properties: stable/9/sbin/fsck_msdosfs/ (props changed) Modified: stable/9/sbin/fsck_msdosfs/check.c ============================================================================== --- stable/9/sbin/fsck_msdosfs/check.c Thu Jul 17 02:33:40 2014 (r268784) +++ stable/9/sbin/fsck_msdosfs/check.c Thu Jul 17 02:43:53 2014 (r268785) @@ -142,7 +142,7 @@ checkfilesys(const char *fname) goto out; /* now write the FATs */ - if (mod & FSFATMOD) { + if (mod & (FSFATMOD|FSFIXFAT)) { if (ask(1, "Update FATs")) { mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT); if (mod & FSFATAL) Modified: stable/9/sbin/fsck_msdosfs/dir.c ============================================================================== --- stable/9/sbin/fsck_msdosfs/dir.c Thu Jul 17 02:33:40 2014 (r268784) +++ stable/9/sbin/fsck_msdosfs/dir.c Thu Jul 17 02:43:53 2014 (r268785) @@ -206,7 +206,7 @@ static char longName[DOSLONGNAMELEN] = " static u_char *buffer = NULL; static u_char *delbuf = NULL; -struct dosDirEntry *rootDir; +static struct dosDirEntry *rootDir; static struct dosDirEntry *lostDir; /* Modified: stable/9/sbin/fsck_msdosfs/ext.h ============================================================================== --- stable/9/sbin/fsck_msdosfs/ext.h Thu Jul 17 02:33:40 2014 (r268784) +++ stable/9/sbin/fsck_msdosfs/ext.h Thu Jul 17 02:43:53 2014 (r268785) @@ -26,7 +26,7 @@ */ #ifndef EXT_H -#define EXT_H +#define EXT_H #include @@ -43,8 +43,6 @@ extern int preen; /* we are preening */ extern int rdonly; /* device is opened read only (supersedes above) */ extern int skipclean; /* skip clean file systems if preening */ -extern struct dosDirEntry *rootDir; - /* * function declarations */ @@ -71,8 +69,8 @@ int checkfilesys(const char *); #define FSFATMOD 4 /* The FAT was modified */ #define FSERROR 8 /* Some unrecovered error remains */ #define FSFATAL 16 /* Some unrecoverable error occurred */ -#define FSDIRTY 32 /* File system is dirty */ -#define FSFIXFAT 64 /* Fix file system FAT */ +#define FSDIRTY 32 /* File system is dirty */ +#define FSFIXFAT 64 /* Fix file system FAT */ /* * read a boot block in a machine independent fashion and translate Modified: stable/9/sbin/fsck_msdosfs/fat.c ============================================================================== --- stable/9/sbin/fsck_msdosfs/fat.c Thu Jul 17 02:33:40 2014 (r268784) +++ stable/9/sbin/fsck_msdosfs/fat.c Thu Jul 17 02:43:53 2014 (r268785) @@ -240,7 +240,7 @@ readfat(int fs, struct bootblock *boot, ret |= FSDIRTY; else { /* just some odd byte sequence in FAT */ - + switch (boot->ClustMask) { case CLUST32_MASK: pwarn("%s (%02x%02x%02x%02x%02x%02x%02x%02x)\n", @@ -260,7 +260,7 @@ readfat(int fs, struct bootblock *boot, break; } - + if (ask(1, "Correct")) ret |= FSFIXFAT; } @@ -651,7 +651,7 @@ checklost(int dosfs, struct bootblock *b cl_t head; int mod = FSOK; int ret; - + for (head = CLUST_FIRST; head < boot->NumClusters; head++) { /* find next untravelled chain */ if (fat[head].head != head @@ -675,8 +675,9 @@ checklost(int dosfs, struct bootblock *b if (boot->bpbFSInfo) { ret = 0; - if (boot->FSFree != boot->NumFree) { - pwarn("Free space in FSInfo block (%d) not correct (%d)\n", + if (boot->FSFree != 0xffffffffU && + boot->FSFree != boot->NumFree) { + pwarn("Free space in FSInfo block (%u) not correct (%u)\n", boot->FSFree, boot->NumFree); if (ask(1, "Fix")) { boot->FSFree = boot->NumFree; From owner-svn-src-stable-9@FreeBSD.ORG Thu Jul 17 22:42:20 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6A73604; Thu, 17 Jul 2014 22:42:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7FCF299B; Thu, 17 Jul 2014 22:42:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6HMgKgw044778; Thu, 17 Jul 2014 22:42:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6HMgJD9044765; Thu, 17 Jul 2014 22:42:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201407172242.s6HMgJD9044765@svn.freebsd.org> From: Warner Losh Date: Thu, 17 Jul 2014 22:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268814 - in stable/9: . sys/amd64/conf sys/conf sys/i386/conf sys/ia64/conf sys/sparc64/conf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2014 22:42:21 -0000 Author: imp Date: Thu Jul 17 22:42:18 2014 New Revision: 268814 URL: http://svnweb.freebsd.org/changeset/base/268814 Log: MFC r263749,267146: >r267146 | imp | 2014-06-05 22:08:55 -0600 (Thu, 05 Jun 2014) | 4 lines >Restore comments accidentally removed. >r263749 | imp | 2014-03-25 16:08:31 -0600 (Tue, 25 Mar 2014) | 18 lines >Rather than require a makeoptions DEBUG to get debug correct, >add it in kern.mk, but only if we're using clang. While this >option is supported by both clang and gcc, in the future there >may be changes to clang which change the defaults that require >a tweak to build our kernel such that other tools in our tree >will work. Set a good example by forcing -gdwarf-2 only for >clang builds, and only if the user hasn't specified another >dwarf level already. Update UPDATING to reflect the changed >state of affairs. This also keeps us from having to update >all the ARM kernels to add this, and also keeps us from >in the future having to update all the MIPS kernels and is >one less place the user will have to know to do something >special for clang and one less thing developers will need >to do when moving an architecture to clang. Note: Due to the funkadellic way we used to do merges, I've made a direct commit of the relevant text to UPDATING with no merge info being recorded for it so I could commit it at the same time as the other files. Modified: stable/9/UPDATING stable/9/sys/amd64/conf/GENERIC stable/9/sys/conf/kern.mk stable/9/sys/i386/conf/GENERIC stable/9/sys/i386/conf/XEN stable/9/sys/ia64/conf/GENERIC stable/9/sys/sparc64/conf/GENERIC Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Thu Jul 17 22:31:46 2014 (r268813) +++ stable/9/UPDATING Thu Jul 17 22:42:18 2014 (r268814) @@ -11,6 +11,13 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20140717: + It is no longer necessary to include the dwarf version in your DEBUG + options in your kernel config file. The bug that required it to be + placed in the config file has bene fixed. DEBUG should now just + contain -g. The build system will automatically update things + to do the right thing. + 20140716: 9.3-RELEASE. Modified: stable/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Thu Jul 17 22:31:46 2014 (r268813) +++ stable/9/sys/amd64/conf/GENERIC Thu Jul 17 22:42:18 2014 (r268814) @@ -21,7 +21,7 @@ cpu HAMMER ident GENERIC -makeoptions DEBUG=-gdwarf-2 # Build kernel with gdb(1) debug symbols +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support options SCHED_ULE # ULE scheduler Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Thu Jul 17 22:31:46 2014 (r268813) +++ stable/9/sys/conf/kern.mk Thu Jul 17 22:42:18 2014 (r268814) @@ -151,3 +151,10 @@ CFLAGS+= -ffreestanding ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" CFLAGS+= -fstack-protector .endif + +# +# Add -gdwarf-2 when compiling -g +# +.if ${COMPILER_TYPE} == "clang" && ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf} == "" +CFLAGS+= -gdwarf-2 +.endif Modified: stable/9/sys/i386/conf/GENERIC ============================================================================== --- stable/9/sys/i386/conf/GENERIC Thu Jul 17 22:31:46 2014 (r268813) +++ stable/9/sys/i386/conf/GENERIC Thu Jul 17 22:42:18 2014 (r268814) @@ -23,7 +23,7 @@ cpu I586_CPU cpu I686_CPU ident GENERIC -makeoptions DEBUG=-gdwarf-2 # Build kernel with gdb(1) debug symbols +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support options SCHED_ULE # ULE scheduler Modified: stable/9/sys/i386/conf/XEN ============================================================================== --- stable/9/sys/i386/conf/XEN Thu Jul 17 22:31:46 2014 (r268813) +++ stable/9/sys/i386/conf/XEN Thu Jul 17 22:42:18 2014 (r268814) @@ -6,7 +6,7 @@ cpu I686_CPU ident XEN -makeoptions DEBUG=-gdwarf-2 # Build kernel with gdb(1) debug symbols +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols # The following modules don't build with PAE and XEN enabled. makeoptions WITHOUT_MODULES="ctl dpt drm drm2 hptmv ida malo mwl rdma xfs" Modified: stable/9/sys/ia64/conf/GENERIC ============================================================================== --- stable/9/sys/ia64/conf/GENERIC Thu Jul 17 22:31:46 2014 (r268813) +++ stable/9/sys/ia64/conf/GENERIC Thu Jul 17 22:42:18 2014 (r268814) @@ -23,7 +23,7 @@ cpu ITANIUM2 ident GENERIC -makeoptions DEBUG=-g # Build kernel with debug information. +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options AUDIT # Security event auditing options CD9660 # ISO 9660 Filesystem Modified: stable/9/sys/sparc64/conf/GENERIC ============================================================================== --- stable/9/sys/sparc64/conf/GENERIC Thu Jul 17 22:31:46 2014 (r268813) +++ stable/9/sys/sparc64/conf/GENERIC Thu Jul 17 22:42:18 2014 (r268814) @@ -21,7 +21,7 @@ cpu SUN4U ident GENERIC -makeoptions DEBUG=-gdwarf-2 # Build kernel with gdb(1) debug symbols +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols # Platforms supported # At this time all platforms are supported, as-is. From owner-svn-src-stable-9@FreeBSD.ORG Thu Jul 17 23:50:50 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F4D092F; Thu, 17 Jul 2014 23:50:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60E942ED5; Thu, 17 Jul 2014 23:50:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6HNoofD075754; Thu, 17 Jul 2014 23:50:50 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6HNoofe075734; Thu, 17 Jul 2014 23:50:50 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201407172350.s6HNoofe075734@svn.freebsd.org> From: Don Lewis Date: Thu, 17 Jul 2014 23:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268822 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2014 23:50:50 -0000 Author: truckman Date: Thu Jul 17 23:50:49 2014 New Revision: 268822 URL: http://svnweb.freebsd.org/changeset/base/268822 Log: MFC r268373 Declaration whitespace changes for style(9). Modified: stable/9/sys/kern/subr_rman.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_rman.c ============================================================================== --- stable/9/sys/kern/subr_rman.c Thu Jul 17 23:49:01 2014 (r268821) +++ stable/9/sys/kern/subr_rman.c Thu Jul 17 23:50:49 2014 (r268822) @@ -94,12 +94,12 @@ struct resource_i { u_long r_end; /* index of the last entry (inclusive) */ u_int r_flags; void *r_virtual; /* virtual address of this resource */ - struct device *r_dev; /* device which has allocated this resource */ - struct rman *r_rm; /* resource manager from whence this came */ + struct device *r_dev; /* device which has allocated this resource */ + struct rman *r_rm; /* resource manager from whence this came */ int r_rid; /* optional rid for this resource. */ }; -static int rman_debug = 0; +static int rman_debug = 0; TUNABLE_INT("debug.rman_debug", &rman_debug); SYSCTL_INT(_debug, OID_AUTO, rman_debug, CTLFLAG_RW, &rman_debug, 0, "rman debug"); @@ -108,12 +108,12 @@ SYSCTL_INT(_debug, OID_AUTO, rman_debug, static MALLOC_DEFINE(M_RMAN, "rman", "Resource manager"); -struct rman_head rman_head; -static struct mtx rman_mtx; /* mutex to protect rman_head */ -static int int_rman_activate_resource(struct rman *rm, struct resource_i *r, +struct rman_head rman_head; +static struct mtx rman_mtx; /* mutex to protect rman_head */ +static int int_rman_activate_resource(struct rman *rm, struct resource_i *r, struct resource_i **whohas); -static int int_rman_deactivate_resource(struct resource_i *r); -static int int_rman_release_resource(struct rman *rm, struct resource_i *r); +static int int_rman_deactivate_resource(struct resource_i *r); +static int int_rman_release_resource(struct rman *rm, struct resource_i *r); static __inline struct resource_i * int_alloc_resource(int malloc_flag) @@ -312,8 +312,8 @@ rman_last_free_region(struct rman *rm, u int rman_adjust_resource(struct resource *rr, u_long start, u_long end) { - struct resource_i *r, *s, *t, *new; - struct rman *rm; + struct resource_i *r, *s, *t, *new; + struct rman *rm; /* Not supported for shared resources. */ r = rr->__r_i; @@ -434,12 +434,12 @@ rman_adjust_resource(struct resource *rr struct resource * rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end, - u_long count, u_long bound, u_int flags, - struct device *dev) + u_long count, u_long bound, u_int flags, + struct device *dev) { - u_int new_rflags; - struct resource_i *r, *s, *rv; - u_long rstart, rend, amask, bmask; + u_int new_rflags; + struct resource_i *r, *s, *rv; + u_long rstart, rend, amask, bmask; rv = NULL; @@ -716,9 +716,9 @@ rman_activate_resource(struct resource * int rman_await_resource(struct resource *re, int pri, int timo) { - int rv; - struct resource_i *r, *whohas; - struct rman *rm; + int rv; + struct resource_i *r, *whohas; + struct rman *rm; r = re->__r_i; rm = r->r_rm; @@ -754,7 +754,7 @@ int_rman_deactivate_resource(struct reso int rman_deactivate_resource(struct resource *r) { - struct rman *rm; + struct rman *rm; rm = r->__r_i->r_rm; mtx_lock(rm->rm_mtx); @@ -766,7 +766,7 @@ rman_deactivate_resource(struct resource static int int_rman_release_resource(struct rman *rm, struct resource_i *r) { - struct resource_i *s, *t; + struct resource_i *s, *t; if (r->r_flags & RF_ACTIVE) int_rman_deactivate_resource(r); @@ -860,9 +860,9 @@ out: int rman_release_resource(struct resource *re) { - int rv; - struct resource_i *r; - struct rman *rm; + int rv; + struct resource_i *r; + struct rman *rm; r = re->__r_i; rm = r->r_rm; @@ -875,7 +875,7 @@ rman_release_resource(struct resource *r uint32_t rman_make_alignment_flags(uint32_t size) { - int i; + int i; /* * Find the hightest bit set, and add one if more than one bit @@ -893,96 +893,112 @@ rman_make_alignment_flags(uint32_t size) void rman_set_start(struct resource *r, u_long start) { + r->__r_i->r_start = start; } u_long rman_get_start(struct resource *r) { + return (r->__r_i->r_start); } void rman_set_end(struct resource *r, u_long end) { + r->__r_i->r_end = end; } u_long rman_get_end(struct resource *r) { + return (r->__r_i->r_end); } u_long rman_get_size(struct resource *r) { + return (r->__r_i->r_end - r->__r_i->r_start + 1); } u_int rman_get_flags(struct resource *r) { + return (r->__r_i->r_flags); } void rman_set_virtual(struct resource *r, void *v) { + r->__r_i->r_virtual = v; } void * rman_get_virtual(struct resource *r) { + return (r->__r_i->r_virtual); } void rman_set_bustag(struct resource *r, bus_space_tag_t t) { + r->r_bustag = t; } bus_space_tag_t rman_get_bustag(struct resource *r) { + return (r->r_bustag); } void rman_set_bushandle(struct resource *r, bus_space_handle_t h) { + r->r_bushandle = h; } bus_space_handle_t rman_get_bushandle(struct resource *r) { + return (r->r_bushandle); } void rman_set_rid(struct resource *r, int rid) { + r->__r_i->r_rid = rid; } int rman_get_rid(struct resource *r) { + return (r->__r_i->r_rid); } void rman_set_device(struct resource *r, struct device *dev) { + r->__r_i->r_dev = dev; } struct device * rman_get_device(struct resource *r) { + return (r->__r_i->r_dev); } From owner-svn-src-stable-9@FreeBSD.ORG Fri Jul 18 00:32:17 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9ED432B1; Fri, 18 Jul 2014 00:32:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BE5F22A2; Fri, 18 Jul 2014 00:32:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6I0WHc7098366; Fri, 18 Jul 2014 00:32:17 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6I0WHrE098365; Fri, 18 Jul 2014 00:32:17 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201407180032.s6I0WHrE098365@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 18 Jul 2014 00:32:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268824 - stable/9/sys/dev/cxgbe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 00:32:17 -0000 Author: np Date: Fri Jul 18 00:32:17 2014 New Revision: 268824 URL: http://svnweb.freebsd.org/changeset/base/268824 Log: MFC r268706: cxgbe(4): Display CF facility correctly in the device log. Modified: stable/9/sys/dev/cxgbe/t4_main.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_main.c Fri Jul 18 00:31:06 2014 (r268823) +++ stable/9/sys/dev/cxgbe/t4_main.c Fri Jul 18 00:32:17 2014 (r268824) @@ -5361,6 +5361,7 @@ const char *devlog_level_strings[] = { const char *devlog_facility_strings[] = { [FW_DEVLOG_FACILITY_CORE] = "CORE", + [FW_DEVLOG_FACILITY_CF] = "CF", [FW_DEVLOG_FACILITY_SCHED] = "SCHED", [FW_DEVLOG_FACILITY_TIMER] = "TIMER", [FW_DEVLOG_FACILITY_RES] = "RES", From owner-svn-src-stable-9@FreeBSD.ORG Fri Jul 18 07:18:38 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 531A8C13; Fri, 18 Jul 2014 07:18:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25F782234; Fri, 18 Jul 2014 07:18:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6I7IcQI090833; Fri, 18 Jul 2014 07:18:38 GMT (envelope-from royger@svn.freebsd.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6I7Icma090832; Fri, 18 Jul 2014 07:18:38 GMT (envelope-from royger@svn.freebsd.org) Message-Id: <201407180718.s6I7Icma090832@svn.freebsd.org> From: Roger Pau Monné Date: Fri, 18 Jul 2014 07:18:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268832 - stable/9/sys/dev/xen/blkfront X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 07:18:38 -0000 Author: royger Date: Fri Jul 18 07:18:37 2014 New Revision: 268832 URL: http://svnweb.freebsd.org/changeset/base/268832 Log: MFC r256423: Allow FreeBSD to be booted from CDROM media on XenServer 6.2 and prior releases. PR: 164630 Modified: stable/9/sys/dev/xen/blkfront/blkfront.c Modified: stable/9/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/9/sys/dev/xen/blkfront/blkfront.c Fri Jul 18 06:58:01 2014 (r268831) +++ stable/9/sys/dev/xen/blkfront/blkfront.c Fri Jul 18 07:18:37 2014 (r268832) @@ -399,14 +399,44 @@ xb_dump(void *arg, void *virtual, vm_off static int blkfront_probe(device_t dev) { +#ifdef XENHVM + int error; + char *type; +#endif - if (!strcmp(xenbus_get_type(dev), "vbd")) { - device_set_desc(dev, "Virtual Block Device"); - device_quiet(dev); - return (0); + if (strcmp(xenbus_get_type(dev), "vbd") != 0) + return (ENXIO); + +#ifdef XENHVM + /* + * When running in an HVM domain, IDE disk emulation is + * disabled early in boot so that native drivers will + * not see emulated hardware. However, CDROM device + * emulation cannot be disabled. + * + * Through use of FreeBSD's vm_guest and xen_hvm_domain() + * APIs, we could modify the native CDROM driver to fail its + * probe when running under Xen. Unfortunatlely, the PV + * CDROM support in XenServer (up through at least version + * 6.2) isn't functional, so we instead rely on the emulated + * CDROM instance, and fail to attach the PV one here in + * the blkfront driver. + */ + error = xs_read(XST_NIL, xenbus_get_node(dev), + "device-type", NULL, (void **) &type); + if (error) + return (ENXIO); + + if (strncmp(type, "cdrom", 5) == 0) { + free(type, M_XENSTORE); + return (ENXIO); } + free(type, M_XENSTORE); +#endif - return (ENXIO); + device_set_desc(dev, "Virtual Block Device"); + device_quiet(dev); + return (0); } static void From owner-svn-src-stable-9@FreeBSD.ORG Fri Jul 18 18:00:02 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33412C49; Fri, 18 Jul 2014 18:00:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EC332D67; Fri, 18 Jul 2014 18:00:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6II01vg097664; Fri, 18 Jul 2014 18:00:01 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6II01E0097615; Fri, 18 Jul 2014 18:00:01 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201407181800.s6II01E0097615@svn.freebsd.org> From: Don Lewis Date: Fri, 18 Jul 2014 18:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268849 - in stable/9/sys: amd64/conf dev/xen/netback dev/xen/netfront X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 18:00:02 -0000 Author: truckman Date: Fri Jul 18 18:00:00 2014 New Revision: 268849 URL: http://svnweb.freebsd.org/changeset/base/268849 Log: Merge r256868,257276-257277,257515,257913 from head. These are fixes required to make Xen buildable w/o INET. This is the same as r259541 in stable/10 by glebius. Modified: stable/9/sys/amd64/conf/NOTES stable/9/sys/dev/xen/netback/netback.c stable/9/sys/dev/xen/netback/netback_unit_tests.c stable/9/sys/dev/xen/netfront/netfront.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/amd64/conf/NOTES ============================================================================== --- stable/9/sys/amd64/conf/NOTES Fri Jul 18 17:55:12 2014 (r268848) +++ stable/9/sys/amd64/conf/NOTES Fri Jul 18 18:00:00 2014 (r268849) @@ -472,6 +472,12 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +device hyperv # HyperV drivers + +# Xen HVM Guest Optimizations +options XENHVM # Xen HVM kernel infrastructure +device xenpci # Xen HVM Hypervisor services driver + ##################################################################### # Modified: stable/9/sys/dev/xen/netback/netback.c ============================================================================== --- stable/9/sys/dev/xen/netback/netback.c Fri Jul 18 17:55:12 2014 (r268848) +++ stable/9/sys/dev/xen/netback/netback.c Fri Jul 18 18:00:00 2014 (r268849) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); * from this FreeBSD domain to other domains. */ #include "opt_inet.h" +#include "opt_inet6.h" #include "opt_global.h" #include "opt_sctp.h" @@ -182,7 +183,6 @@ static int xnb_rxpkt2gnttab(const struct static int xnb_rxpkt2rsp(const struct xnb_pkt *pkt, const gnttab_copy_table gnttab, int n_entries, netif_rx_back_ring_t *ring); -static void xnb_add_mbuf_cksum(struct mbuf *mbufc); static void xnb_stop(struct xnb_softc*); static int xnb_ioctl(struct ifnet*, u_long, caddr_t); static void xnb_start_locked(struct ifnet*); @@ -193,6 +193,9 @@ static void xnb_ifinit(void*); static int xnb_unit_test_main(SYSCTL_HANDLER_ARGS); static int xnb_dump_rings(SYSCTL_HANDLER_ARGS); #endif +#if defined(INET) || defined(INET6) +static void xnb_add_mbuf_cksum(struct mbuf *mbufc); +#endif /*------------------------------ Data Structures -----------------------------*/ @@ -1780,7 +1783,9 @@ xnb_update_mbufc(struct mbuf *mbufc, con } mbufc->m_pkthdr.len = total_size; +#if defined(INET) || defined(INET6) xnb_add_mbuf_cksum(mbufc); +#endif } /** @@ -2123,6 +2128,7 @@ xnb_rxpkt2rsp(const struct xnb_pkt *pkt, return n_responses; } +#if defined(INET) || defined(INET6) /** * Add IP, TCP, and/or UDP checksums to every mbuf in a chain. The first mbuf * in the chain must start with a struct ether_header. @@ -2177,6 +2183,7 @@ xnb_add_mbuf_cksum(struct mbuf *mbufc) break; } } +#endif /* INET || INET6 */ static void xnb_stop(struct xnb_softc *xnb) @@ -2193,8 +2200,8 @@ static int xnb_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct xnb_softc *xnb = ifp->if_softc; -#ifdef INET struct ifreq *ifr = (struct ifreq*) data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr*)data; #endif int error = 0; Modified: stable/9/sys/dev/xen/netback/netback_unit_tests.c ============================================================================== --- stable/9/sys/dev/xen/netback/netback_unit_tests.c Fri Jul 18 17:55:12 2014 (r268848) +++ stable/9/sys/dev/xen/netback/netback_unit_tests.c Fri Jul 18 18:00:00 2014 (r268849) @@ -104,10 +104,6 @@ struct test_fixture { typedef struct test_fixture test_fixture_t; -static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len, - uint16_t ip_id, uint16_t ip_p, - uint16_t ip_off, uint16_t ip_sum); -static void xnb_fill_tcp(struct mbuf *m); static int xnb_get1pkt(struct xnb_pkt *pkt, size_t size, uint16_t flags); static int xnb_unit_test_runner(test_fixture_t const tests[], int ntests, char *buffer, size_t buflen); @@ -163,17 +159,24 @@ static testcase_t xnb_rxpkt2rsp_extra; static testcase_t xnb_rxpkt2rsp_2short; static testcase_t xnb_rxpkt2rsp_2slots; static testcase_t xnb_rxpkt2rsp_copyerror; +static testcase_t xnb_sscanf_llu; +static testcase_t xnb_sscanf_lld; +static testcase_t xnb_sscanf_hhu; +static testcase_t xnb_sscanf_hhd; +static testcase_t xnb_sscanf_hhn; + +#if defined(INET) || defined(INET6) /* TODO: add test cases for xnb_add_mbuf_cksum for IPV6 tcp and udp */ static testcase_t xnb_add_mbuf_cksum_arp; static testcase_t xnb_add_mbuf_cksum_tcp; static testcase_t xnb_add_mbuf_cksum_udp; static testcase_t xnb_add_mbuf_cksum_icmp; static testcase_t xnb_add_mbuf_cksum_tcp_swcksum; -static testcase_t xnb_sscanf_llu; -static testcase_t xnb_sscanf_lld; -static testcase_t xnb_sscanf_hhu; -static testcase_t xnb_sscanf_hhd; -static testcase_t xnb_sscanf_hhn; +static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len, + uint16_t ip_id, uint16_t ip_p, + uint16_t ip_off, uint16_t ip_sum); +static void xnb_fill_tcp(struct mbuf *m); +#endif /* INET || INET6 */ /** Private data used by unit tests */ static struct { @@ -307,11 +310,13 @@ xnb_unit_test_main(SYSCTL_HANDLER_ARGS) {setup_pvt_data, xnb_rxpkt2rsp_2short, teardown_pvt_data}, {setup_pvt_data, xnb_rxpkt2rsp_2slots, teardown_pvt_data}, {setup_pvt_data, xnb_rxpkt2rsp_copyerror, teardown_pvt_data}, +#if defined(INET) || defined(INET6) {null_setup, xnb_add_mbuf_cksum_arp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_icmp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_tcp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_tcp_swcksum, null_teardown}, {null_setup, xnb_add_mbuf_cksum_udp, null_teardown}, +#endif {null_setup, xnb_sscanf_hhd, null_teardown}, {null_setup, xnb_sscanf_hhu, null_teardown}, {null_setup, xnb_sscanf_lld, null_teardown}, @@ -2066,6 +2071,7 @@ xnb_rxpkt2rsp_copyerror(char *buffer, si safe_m_freem(&mbuf); } +#if defined(INET) || defined(INET6) /** * xnb_add_mbuf_cksum on an ARP request packet */ @@ -2430,6 +2436,7 @@ xnb_add_mbuf_cksum_tcp_swcksum(char *buf m_freem(mbufc); } +#endif /* INET || INET6 */ /** * sscanf on unsigned chars Modified: stable/9/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/9/sys/dev/xen/netfront/netfront.c Fri Jul 18 17:55:12 2014 (r268848) +++ stable/9/sys/dev/xen/netfront/netfront.c Fri Jul 18 18:00:00 2014 (r268849) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" +#include "opt_inet6.h" #include #include @@ -166,7 +167,6 @@ static int xn_configure_features(struct static void xn_watchdog(struct ifnet *); #endif -static void show_device(struct netfront_info *sc); #ifdef notyet static void netfront_closing(device_t dev); #endif @@ -645,8 +645,6 @@ setup_device(device_t dev, struct netfro goto fail; } - show_device(info); - return (0); fail: @@ -968,7 +966,7 @@ static void xn_rxeof(struct netfront_info *np) { struct ifnet *ifp; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) struct lro_ctrl *lro = &np->xn_lro; struct lro_entry *queued; #endif @@ -1065,7 +1063,7 @@ xn_rxeof(struct netfront_info *np) * Do we really need to drop the rx lock? */ XN_RX_UNLOCK(np); -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) /* Use LRO if possible */ if ((ifp->if_capenable & IFCAP_LRO) == 0 || lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) { @@ -1083,7 +1081,7 @@ xn_rxeof(struct netfront_info *np) np->rx.rsp_cons = i; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) /* * Flush any outstanding LRO work */ @@ -1970,25 +1968,6 @@ network_connect(struct netfront_info *np return (0); } -static void -show_device(struct netfront_info *sc) -{ -#ifdef DEBUG - if (sc) { - IPRINTK("\n", - sc->xn_ifno, - be_state_name[sc->xn_backend_state], - sc->xn_user_state ? "open" : "closed", - sc->xn_evtchn, - sc->xn_irq, - sc->xn_tx_if, - sc->xn_rx_if); - } else { - IPRINTK("\n"); - } -#endif -} - static void xn_query_features(struct netfront_info *np) { @@ -2025,14 +2004,14 @@ xn_configure_features(struct netfront_in int err; err = 0; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) if ((np->xn_ifp->if_capenable & IFCAP_LRO) != 0) tcp_lro_free(&np->xn_lro); #endif np->xn_ifp->if_capenable = np->xn_ifp->if_capabilities & ~(IFCAP_LRO|IFCAP_TSO4); np->xn_ifp->if_hwassist &= ~CSUM_TSO; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) if (xn_enable_lro && (np->xn_ifp->if_capabilities & IFCAP_LRO) != 0) { err = tcp_lro_init(&np->xn_lro); if (err) { From owner-svn-src-stable-9@FreeBSD.ORG Fri Jul 18 18:11:25 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA0E633C; Fri, 18 Jul 2014 18:11:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96A002F25; Fri, 18 Jul 2014 18:11:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6IIBPDJ006460; Fri, 18 Jul 2014 18:11:25 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6IIBPkt006459; Fri, 18 Jul 2014 18:11:25 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201407181811.s6IIBPkt006459@svn.freebsd.org> From: Don Lewis Date: Fri, 18 Jul 2014 18:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268853 - stable/9/sys/modules/xenhvm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 18:11:25 -0000 Author: truckman Date: Fri Jul 18 18:11:24 2014 New Revision: 268853 URL: http://svnweb.freebsd.org/changeset/base/268853 Log: Generate *all* the needed autogenerated header files. For some reason normal builds still work without this, but "make universe" requires it. Tested with "make universe". This is a direct commit to stable/9 because this module does not exist in head or stable/10. Modified: stable/9/sys/modules/xenhvm/Makefile Modified: stable/9/sys/modules/xenhvm/Makefile ============================================================================== --- stable/9/sys/modules/xenhvm/Makefile Fri Jul 18 18:09:20 2014 (r268852) +++ stable/9/sys/modules/xenhvm/Makefile Fri Jul 18 18:11:24 2014 (r268853) @@ -13,9 +13,11 @@ SRCS= xenhvm_mod.c \ balloon.c blkfront.c blkback.c control.c netback.c netfront.c \ xenpci.c evtchn.c gnttab.c features.c evtchn_dev.c \ xenbus.c xenbusb.c xenbusb_front.c xenbusb_back.c \ - xenbus_if.c xenbus_if.h xenbusb_if.c xenbusb_if.h \ - xenstore.c xenstore_dev.c -MFILES= xen/xenbus/xenbus_if.m xen/xenbus/xenbusb_if.m + xenbus_if.c xenbus_if.h xenbusb_if.c xenbusb_if.h \ + xenstore.c xenstore_dev.c \ + bus_if.h device_if.h pci_if.h vnode_if.h +MFILES= xen/xenbus/xenbus_if.m xen/xenbus/xenbusb_if.m \ + kern/bus_if.m kern/device_if.m dev/pci/pci_if.m CFLAGS+= -DXENHVM -DMODXENHVM .include From owner-svn-src-stable-9@FreeBSD.ORG Sat Jul 19 18:33:09 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9FABF8BD; Sat, 19 Jul 2014 18:33:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C5D322A8; Sat, 19 Jul 2014 18:33:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6JIX9ma003010; Sat, 19 Jul 2014 18:33:09 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6JIX9P8003009; Sat, 19 Jul 2014 18:33:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201407191833.s6JIX9P8003009@svn.freebsd.org> From: Dimitry Andric Date: Sat, 19 Jul 2014 18:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268882 - in stable: 10/sys/conf 9/sys/conf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jul 2014 18:33:09 -0000 Author: dim Date: Sat Jul 19 18:33:09 2014 New Revision: 268882 URL: http://svnweb.freebsd.org/changeset/base/268882 Log: MFC r268774: After r261991, clang warnings about unused functions in the kernel were completely silenced. Make sure these warnings appear again, so there is some incentive to fix them, but do not error out the whole kernel build for them. Noticed by: steven@pyro.eu.org PR: 191867 Modified: stable/9/sys/conf/kern.mk Directory Properties: stable/9/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/conf/kern.mk Directory Properties: stable/10/ (props changed) Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Sat Jul 19 15:12:38 2014 (r268881) +++ stable/9/sys/conf/kern.mk Sat Jul 19 18:33:09 2014 (r268882) @@ -30,7 +30,7 @@ NO_WSOMETIMES_UNINITIALIZED= -Wno-error- # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \ - -Wno-error-parentheses-equality -Wno-unused-function + -Wno-error-parentheses-equality -Wno-error-unused-function .endif # From owner-svn-src-stable-9@FreeBSD.ORG Sat Jul 19 19:57:27 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ABC4ABCC; Sat, 19 Jul 2014 19:57:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 982E4293C; Sat, 19 Jul 2014 19:57:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6JJvRQe043408; Sat, 19 Jul 2014 19:57:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6JJvRbs043406; Sat, 19 Jul 2014 19:57:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407191957.s6JJvRbs043406@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 19 Jul 2014 19:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268885 - stable/9/sys/dev/usb/controller X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jul 2014 19:57:27 -0000 Author: hselasky Date: Sat Jul 19 19:57:27 2014 New Revision: 268885 URL: http://svnweb.freebsd.org/changeset/base/268885 Log: MFC r268735: Improve support for Intel Lynx Point USB 3.0 controllers by using the USB 2.0 port mask in addition to the USB 3.0 port mask. The hardware does not always accept when writing -1U to the port switching registers. Modified: stable/9/sys/dev/usb/controller/xhci_pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/9/sys/dev/usb/controller/xhci_pci.c Sat Jul 19 19:56:23 2014 (r268884) +++ stable/9/sys/dev/usb/controller/xhci_pci.c Sat Jul 19 19:57:27 2014 (r268885) @@ -140,6 +140,8 @@ static int xhci_pci_port_route(device_t self, uint32_t set, uint32_t clear) { uint32_t temp; + uint32_t usb3_mask; + uint32_t usb2_mask; temp = pci_read_config(self, PCI_XHCI_INTEL_USB3_PSSEN, 4) | pci_read_config(self, PCI_XHCI_INTEL_XUSB2PR, 4); @@ -148,10 +150,11 @@ xhci_pci_port_route(device_t self, uint3 temp &= ~clear; /* Don't set bits which the hardware doesn't support */ - temp &= pci_read_config(self, PCI_XHCI_INTEL_USB3PRM, 4); + usb3_mask = pci_read_config(self, PCI_XHCI_INTEL_USB3PRM, 4); + usb2_mask = pci_read_config(self, PCI_XHCI_INTEL_USB2PRM, 4); - pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, temp, 4); - pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, temp, 4); + pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, temp & usb3_mask, 4); + pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, temp & usb2_mask, 4); device_printf(self, "Port routing mask set to 0x%08x\n", temp); From owner-svn-src-stable-9@FreeBSD.ORG Sat Jul 19 23:57:38 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC80DD0B; Sat, 19 Jul 2014 23:57:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B50F52B0B; Sat, 19 Jul 2014 23:57:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6JNvcej057979; Sat, 19 Jul 2014 23:57:38 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6JNvaaZ057965; Sat, 19 Jul 2014 23:57:36 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407192357.s6JNvaaZ057965@svn.freebsd.org> From: Baptiste Daroussin Date: Sat, 19 Jul 2014 23:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r268897 - in stable/9: contrib/libucl contrib/libucl/cmake contrib/libucl/doc contrib/libucl/include contrib/libucl/src contrib/libucl/tests contrib/libucl/tests/basic contrib/libucl/te... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jul 2014 23:57:38 -0000 Author: bapt Date: Sat Jul 19 23:57:36 2014 New Revision: 268897 URL: http://svnweb.freebsd.org/changeset/base/268897 Log: MFC: r263648, r264789, r266636 This brings: - schema validation - xpath-like interface for ucl objects Adapt pkg(7) to the new libucl API Added: stable/9/contrib/libucl/Makefile.am - copied unchanged from r263648, head/contrib/libucl/Makefile.am stable/9/contrib/libucl/autogen.sh - copied unchanged from r263648, head/contrib/libucl/autogen.sh stable/9/contrib/libucl/cmake/ - copied from r263648, head/contrib/libucl/cmake/ stable/9/contrib/libucl/configure.ac - copied, changed from r263648, head/contrib/libucl/configure.ac stable/9/contrib/libucl/doc/Makefile.am - copied unchanged from r263648, head/contrib/libucl/doc/Makefile.am stable/9/contrib/libucl/doc/libucl.3 - copied, changed from r263648, head/contrib/libucl/doc/libucl.3 stable/9/contrib/libucl/doc/pandoc.template - copied unchanged from r263648, head/contrib/libucl/doc/pandoc.template stable/9/contrib/libucl/libucl.pc.in - copied unchanged from r263648, head/contrib/libucl/libucl.pc.in stable/9/contrib/libucl/src/Makefile.am - copied, changed from r263648, head/contrib/libucl/src/Makefile.am stable/9/contrib/libucl/src/tree.h - copied unchanged from r263648, head/contrib/libucl/src/tree.h stable/9/contrib/libucl/src/ucl_schema.c - copied, changed from r263648, head/contrib/libucl/src/ucl_schema.c stable/9/contrib/libucl/stamp-h.in - copied unchanged from r263648, head/contrib/libucl/stamp-h.in stable/9/contrib/libucl/tests/.gitignore - copied unchanged from r263648, head/contrib/libucl/tests/.gitignore stable/9/contrib/libucl/tests/Makefile.am - copied unchanged from r263648, head/contrib/libucl/tests/Makefile.am stable/9/contrib/libucl/tests/basic/ - copied from r263648, head/contrib/libucl/tests/basic/ stable/9/contrib/libucl/tests/basic.test - copied unchanged from r263648, head/contrib/libucl/tests/basic.test stable/9/contrib/libucl/tests/generate.test - copied unchanged from r263648, head/contrib/libucl/tests/generate.test stable/9/contrib/libucl/tests/schema/ - copied from r263648, head/contrib/libucl/tests/schema/ stable/9/contrib/libucl/tests/schema.test - copied unchanged from r263648, head/contrib/libucl/tests/schema.test stable/9/contrib/libucl/tests/speed.test - copied unchanged from r263648, head/contrib/libucl/tests/speed.test stable/9/contrib/libucl/tests/test_schema.c - copied, changed from r263648, head/contrib/libucl/tests/test_schema.c stable/9/contrib/libucl/utils/Makefile.am - copied unchanged from r263648, head/contrib/libucl/utils/Makefile.am Deleted: stable/9/contrib/libucl/.gitignore stable/9/contrib/libucl/tests/1.in stable/9/contrib/libucl/tests/1.res stable/9/contrib/libucl/tests/10.in stable/9/contrib/libucl/tests/2.in stable/9/contrib/libucl/tests/2.res stable/9/contrib/libucl/tests/3.in stable/9/contrib/libucl/tests/3.res stable/9/contrib/libucl/tests/4.in stable/9/contrib/libucl/tests/4.res stable/9/contrib/libucl/tests/5.in stable/9/contrib/libucl/tests/5.res stable/9/contrib/libucl/tests/6.in stable/9/contrib/libucl/tests/6.res stable/9/contrib/libucl/tests/7.in stable/9/contrib/libucl/tests/7.res stable/9/contrib/libucl/tests/8.in stable/9/contrib/libucl/tests/8.res stable/9/contrib/libucl/tests/9-comment.inc stable/9/contrib/libucl/tests/9-empty.inc stable/9/contrib/libucl/tests/9.in stable/9/contrib/libucl/tests/9.inc stable/9/contrib/libucl/tests/9.res Modified: stable/9/contrib/libucl/Makefile.unix stable/9/contrib/libucl/Makefile.w32 stable/9/contrib/libucl/README.md stable/9/contrib/libucl/doc/api.md stable/9/contrib/libucl/include/ucl.h stable/9/contrib/libucl/src/ucl_emitter.c stable/9/contrib/libucl/src/ucl_hash.c stable/9/contrib/libucl/src/ucl_hash.h stable/9/contrib/libucl/src/ucl_internal.h stable/9/contrib/libucl/src/ucl_parser.c stable/9/contrib/libucl/src/ucl_util.c stable/9/contrib/libucl/tests/run_tests.sh stable/9/contrib/libucl/tests/test_basic.c stable/9/contrib/libucl/tests/test_generate.c stable/9/contrib/libucl/tests/test_speed.c stable/9/contrib/libucl/utils/objdump.c stable/9/lib/libucl/Makefile stable/9/usr.sbin/pkg/config.c stable/9/usr.sbin/pkg/pkg.c Directory Properties: stable/9/contrib/libucl/ (props changed) stable/9/lib/libucl/ (props changed) stable/9/usr.sbin/pkg/ (props changed) Copied: stable/9/contrib/libucl/Makefile.am (from r263648, head/contrib/libucl/Makefile.am) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/libucl/Makefile.am Sat Jul 19 23:57:36 2014 (r268897, copy of r263648, head/contrib/libucl/Makefile.am) @@ -0,0 +1,7 @@ +ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = uthash README.md + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libucl.pc + +SUBDIRS = src tests utils doc \ No newline at end of file Modified: stable/9/contrib/libucl/Makefile.unix ============================================================================== --- stable/9/contrib/libucl/Makefile.unix Sat Jul 19 23:44:57 2014 (r268896) +++ stable/9/contrib/libucl/Makefile.unix Sat Jul 19 23:57:36 2014 (r268897) @@ -4,7 +4,7 @@ LD ?= gcc C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src MAJOR_VERSION = 0 MINOR_VERSION = 2 -PATCH_VERSION = 8 +PATCH_VERSION = 9 VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)" SONAME = libucl.so SONAME_FULL = $(SONAME).$(MAJOR_VERSION) @@ -21,8 +21,17 @@ LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME) LD_UCL_FLAGS ?= -L$(OBJDIR) -Wl,-rpath,$(OBJDIR) -lucl LD_ADD ?= -lrt COPT_FLAGS ?= -O2 -HDEPS = $(SRCDIR)/ucl_hash.h $(SRCDIR)/ucl_chartable.h $(SRCDIR)/ucl_internal.h $(INCLUDEDIR)/ucl.h $(SRCDIR)/xxhash.h -OBJECTS = $(OBJDIR)/ucl_hash.o $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(OBJDIR)/xxhash.o +HDEPS = $(SRCDIR)/ucl_hash.h \ + $(SRCDIR)/ucl_chartable.h \ + $(SRCDIR)/ucl_internal.h \ + $(INCLUDEDIR)/ucl.h \ + $(SRCDIR)/xxhash.h +OBJECTS = $(OBJDIR)/ucl_hash.o \ + $(OBJDIR)/ucl_util.o \ + $(OBJDIR)/ucl_parser.o \ + $(OBJDIR)/ucl_emitter.o \ + $(OBJDIR)/ucl_schema.o \ + $(OBJDIR)/xxhash.o all: $(OBJDIR) $(OBJDIR)/$(SONAME) @@ -44,11 +53,13 @@ $(OBJDIR)/ucl_emitter.o: $(SRCDIR)/ucl_e $(CC) -o $(OBJDIR)/ucl_emitter.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_emitter.c $(OBJDIR)/ucl_hash.o: $(SRCDIR)/ucl_hash.c $(HDEPS) $(CC) -o $(OBJDIR)/ucl_hash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_hash.c +$(OBJDIR)/ucl_schema.o: $(SRCDIR)/ucl_schema.c $(HDEPS) + $(CC) -o $(OBJDIR)/ucl_schema.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_schema.c $(OBJDIR)/xxhash.o: $(SRCDIR)/xxhash.c $(HDEPS) $(CC) -o $(OBJDIR)/xxhash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/xxhash.c clean: - $(RM) $(OBJDIR)/*.o $(OBJDIR)/$(SONAME_FULL) $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/objdump $(OBJDIR)/test_generate + $(RM) $(OBJDIR)/*.o $(OBJDIR)/$(SONAME_FULL) $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/objdump $(OBJDIR)/test_generate $(OBJDIR)/test_schema || true $(RMDIR) $(OBJDIR) # Utils @@ -60,13 +71,15 @@ objdump: utils/objdump.c $(OBJDIR)/$(SON # Tests -test: $(OBJDIR) $(OBJDIR)/$(SONAME) $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate +test: $(OBJDIR) $(OBJDIR)/$(SONAME) $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate $(OBJDIR)/test_schema run-test: test - TEST_DIR=$(TESTDIR) $(TESTDIR)/run_tests.sh $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate + TEST_DIR=$(TESTDIR) $(TESTDIR)/run_tests.sh $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/test_generate $(OBJDIR)/test_schema $(OBJDIR)/test_basic: $(TESTDIR)/test_basic.c $(OBJDIR)/$(SONAME) $(CC) -o $(OBJDIR)/test_basic $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_basic.c $(LD_UCL_FLAGS) +$(OBJDIR)/test_schema: $(TESTDIR)/test_schema.c $(OBJDIR)/$(SONAME) + $(CC) -o $(OBJDIR)/test_schema $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_schema.c $(LD_UCL_FLAGS) $(OBJDIR)/test_speed: $(TESTDIR)/test_speed.c $(OBJDIR)/$(SONAME) $(CC) -o $(OBJDIR)/test_speed $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) $(LDFLAGS) $(TESTDIR)/test_speed.c $(LD_UCL_FLAGS) $(LD_ADD) $(OBJDIR)/test_generate: $(TESTDIR)/test_generate.c $(OBJDIR)/$(SONAME) Modified: stable/9/contrib/libucl/Makefile.w32 ============================================================================== --- stable/9/contrib/libucl/Makefile.w32 Sat Jul 19 23:44:57 2014 (r268896) +++ stable/9/contrib/libucl/Makefile.w32 Sat Jul 19 23:57:36 2014 (r268897) @@ -4,7 +4,7 @@ LD ?= gcc C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src MAJOR_VERSION = 0 MINOR_VERSION = 2 -PATCH_VERSION = 8 +PATCH_VERSION = 9 VERSION = "$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)" SONAME = libucl.dll OBJDIR ?= .obj @@ -24,8 +24,17 @@ LD_SHARED_FLAGS ?= -Wl,-soname,$(SONAME) LD_UCL_FLAGS ?= -L$(OBJDIR) -Wl,-rpath,$(OBJDIR) -lucl LD_ADD ?= -lrt COPT_FLAGS ?= -O2 -HDEPS = $(SRCDIR)/ucl_hash.h $(SRCDIR)/ucl_chartable.h $(SRCDIR)/ucl_internal.h $(INCLUDEDIR)/ucl.h $(SRCDIR)/xxhash.h -OBJECTS = $(OBJDIR)/ucl_hash.o $(OBJDIR)/ucl_util.o $(OBJDIR)/ucl_parser.o $(OBJDIR)/ucl_emitter.o $(OBJDIR)/xxhash.o +HDEPS = $(SRCDIR)/ucl_hash.h \ + $(SRCDIR)/ucl_chartable.h \ + $(SRCDIR)/ucl_internal.h \ + $(INCLUDEDIR)/ucl.h \ + $(SRCDIR)/xxhash.h +OBJECTS = $(OBJDIR)/ucl_hash.o \ + $(OBJDIR)/ucl_util.o \ + $(OBJDIR)/ucl_parser.o \ + $(OBJDIR)/ucl_emitter.o \ + $(OBJDIR)/ucl_schema.o \ + $(OBJDIR)/xxhash.o all: $(OBJDIR) $(OBJDIR)/$(SONAME) @@ -44,6 +53,8 @@ $(OBJDIR)/ucl_emitter.o: $(SRCDIR)/ucl_e $(CC) -o $(OBJDIR)/ucl_emitter.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_emitter.c $(OBJDIR)/ucl_hash.o: $(SRCDIR)/ucl_hash.c $(HDEPS) $(CC) -o $(OBJDIR)/ucl_hash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_hash.c +$(OBJDIR)/ucl_schema.o: $(SRCDIR)/ucl_schema.c $(HDEPS) + $(CC) -o $(OBJDIR)/ucl_schema.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_schema.c $(OBJDIR)/xxhash.o: $(SRCDIR)/xxhash.c $(HDEPS) $(CC) -o $(OBJDIR)/xxhash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/xxhash.c Modified: stable/9/contrib/libucl/README.md ============================================================================== --- stable/9/contrib/libucl/README.md Sat Jul 19 23:44:57 2014 (r268896) +++ stable/9/contrib/libucl/README.md Sat Jul 19 23:57:36 2014 (r268897) @@ -1,3 +1,26 @@ +# LIBUCL + +[![Build Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl) + +**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* + +- [Introduction](#introduction) +- [Basic structure](#basic-structure) +- [Improvements to the json notation](#improvements-to-the-json-notation) + - [General syntax sugar](#general-syntax-sugar) + - [Automatic arrays creation](#automatic-arrays-creation) + - [Named keys hierarchy](#named-keys-hierarchy) + - [Convenient numbers and booleans](#convenient-numbers-and-booleans) +- [General improvements](#general-improvements) + - [Commments](#commments) + - [Macros support](#macros-support) + - [Variables support](#variables-support) + - [Multiline strings](#multiline-strings) +- [Emitter](#emitter) +- [Validation](#validation) +- [Performance](#performance) +- [Conclusion](#conclusion) + ## Introduction This document describes the main features and principles of the configuration @@ -262,6 +285,10 @@ Each UCL object can be serialized to one * `Configuration` - nginx like notation; * `YAML` - yaml inlined notation. +## Validation + +UCL allows validation of objects. It uses the same schema that is used for json: [json schema v4](http://json-schema.org). UCL supports the full set of json schema with the exception of remote references. This feature is unlikely useful for configuration objects. Of course, a schema definition can be in UCL format instead of JSON that simplifies schemas writing. Moreover, since UCL supports multiple values for keys in an object it is possible to specify generic integer constraints `maxValues` and `minValues` to define the limits of values count in a single key. UCL currently is not absolutely strict about validation schemas themselves, therefore UCL users should supply valid schemas (as it is defined in json-schema draft v4) to ensure that the input objects are validated properly. + ## Performance Are UCL parser and emitter fast enough? Well, there are some numbers. Copied: stable/9/contrib/libucl/autogen.sh (from r263648, head/contrib/libucl/autogen.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/libucl/autogen.sh Sat Jul 19 23:57:36 2014 (r268897, copy of r263648, head/contrib/libucl/autogen.sh) @@ -0,0 +1,2 @@ +#!/bin/sh +autoreconf -i Copied and modified: stable/9/contrib/libucl/configure.ac (from r263648, head/contrib/libucl/configure.ac) ============================================================================== --- head/contrib/libucl/configure.ac Sat Mar 22 17:28:14 2014 (r263648, copy source) +++ stable/9/contrib/libucl/configure.ac Sat Jul 19 23:57:36 2014 (r268897) @@ -1,7 +1,7 @@ m4_define([maj_ver], [0]) -m4_define([med_ver], [3]) -m4_define([min_ver], [0]) -m4_define([so_version], [maj_ver:med_ver]) +m4_define([med_ver], [4]) +m4_define([min_ver], [1]) +m4_define([so_version], [1:0:0]) m4_define([ucl_version], [maj_ver.med_ver.min_ver]) AC_INIT([libucl],[ucl_version],[https://github.com/vstakhov/libucl],[libucl]) @@ -48,11 +48,17 @@ AC_CHECK_HEADERS_ONCE([float.h]) AC_CHECK_HEADERS_ONCE([math.h]) dnl Example of default-disabled feature -AC_ARG_ENABLE([urls], AS_HELP_STRING([--enable-urls], [Enable URLs fetch (requires libfetch or libcurl)])) +AC_ARG_ENABLE([urls], AS_HELP_STRING([--enable-urls], + [Enable URLs fetch (requires libfetch or libcurl) @<:@default=no@:>@]), [], + [enable_urls=no]) +AC_ARG_ENABLE([regex], AS_HELP_STRING([--enable-regex], + [Enable regex checking for schema @<:@default=yes@:>@]), [], + [enable_regex=yes]) AC_ARG_ENABLE([signatures], AS_HELP_STRING([--enable-signatures], - [Enable signatures check (requires openssl)])) + [Enable signatures check (requires openssl) @<:@default=no@:>@]), [], + [enable_signatures=no]) AC_ARG_ENABLE([utils], - [--enable-utils Build and install utils], + AS_HELP_STRING([--enable-utils], [Build and install utils @<:@default=no@:>@]), [case "${enableval}" in yes) utils=true ;; no) utils=false ;; @@ -63,11 +69,11 @@ AM_CONDITIONAL([UTILS], [test x$utils = AS_IF([test "x$enable_signatures" = "xyes"], [ AC_SEARCH_LIBS([EVP_MD_CTX_create], [crypto], [ AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if you have the 'crypto' library (-lcrypto).]) - LIBSSL_LIB="-lcrypto" + LIBCRYPTO_LIB="-lcrypto" LIBS_EXTRA="${LIBS_EXTRA} -lcrypto" ], [AC_MSG_ERROR([unable to find the EVP_MD_CTX_create() function])]) ]) - +AC_SUBST(LIBCRYPTO_LIB) AC_PATH_PROG(PANDOC, pandoc, [/non/existent]) AC_SEARCH_LIBS([clock_gettime], [rt], [], [ @@ -77,11 +83,21 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [] ]) AC_SEARCH_LIBS([remainder], [m], [], [AC_MSG_ERROR([unable to find remainder() function])]) -AC_CHECK_HEADER([regex.h], [ - AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the header file.]) - ], - [AC_MSG_ERROR([unable to find the regex.h header])], - [#include ]) +AS_IF([test "x$enable_regex" = "xyes"], [ + AC_CHECK_HEADER([regex.h], [ + AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the header file.]) + AC_SEARCH_LIBS([regexec], [regex], [ + AS_IF([test "x$ac_cv_search_regexec" = "x-lregex"], [ + LIBREGEX_LIB="-lregex" + LIBS_EXTRA="${LIBS_EXTRA} -lregex" + ] + )], + [AC_MSG_ERROR([unable to find the regexec() function])])], + [AC_MSG_ERROR([unable to find the regex.h header]) + ], + [#include ]) +]) +AC_SUBST(LIBREGEX_LIB) AS_IF([test "x$enable_urls" = "xyes"], [ AC_CHECK_HEADER([fetch.h], [ @@ -114,6 +130,29 @@ AS_IF([test "x$enable_urls" = "xyes"], [ AC_SUBST(LIBS_EXTRA) +AC_MSG_CHECKING(for GCC atomic builtins) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([[ + int main() { + volatile unsigned long val = 1; + __sync_synchronize(); + __sync_val_compare_and_swap(&val, 1, 0); + __sync_add_and_fetch(&val, 1); + __sync_sub_and_fetch(&val, 1); + return 0; + } + ]]) +], +[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_ATOMIC_BUILTINS], [1], [Has gcc/MSVC atomic intrinsics]) +], +[ + AC_MSG_RESULT([no]) + AC_DEFINE([HAVE_ATOMIC_BUILTINS], [0], [Has gcc/MSVC atomic intrinsics]) + AC_MSG_WARN([Libucl references could be thread-unsafe because atomic builtins are missing]) +]) + AC_CONFIG_FILES(Makefile \ src/Makefile \ tests/Makefile \ Copied: stable/9/contrib/libucl/doc/Makefile.am (from r263648, head/contrib/libucl/doc/Makefile.am) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/libucl/doc/Makefile.am Sat Jul 19 23:57:36 2014 (r268897, copy of r263648, head/contrib/libucl/doc/Makefile.am) @@ -0,0 +1,8 @@ +EXTRA_DIST = api.md + +dist_man_MANS = libucl.3 + +gen-man: @PANDOC@ + tail -n +$$(grep -n '# Synopsis' api.md | cut -d':' -f1) api.md | \ + cat pandoc.template - | sed -e 's/^# \(.*\)/# \U\1/' | \ + @PANDOC@ -s -f markdown -t man -o libucl.3 \ No newline at end of file Modified: stable/9/contrib/libucl/doc/api.md ============================================================================== --- stable/9/contrib/libucl/doc/api.md Sat Jul 19 23:44:57 2014 (r268896) +++ stable/9/contrib/libucl/doc/api.md Sat Jul 19 23:57:36 2014 (r268897) @@ -1,30 +1,75 @@ -Synopsis -======== +# API documentation + +**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* + +- [Synopsis](#synopsis) +- [Description](#description) + - [Parser functions](#parser-functions) + - [Emitting functions](#emitting-functions) + - [Conversion functions](#conversion-functions) + - [Generation functions](#generation-functions) + - [Iteration functions](#iteration-functions) + - [Validation functions](#validation-functions) + - [Utility functions](#utility-functions) +- [Parser functions](#parser-functions-1) + - [ucl_parser_new](#ucl_parser_new) + - [ucl_parser_register_macro](#ucl_parser_register_macro) + - [ucl_parser_register_variable](#ucl_parser_register_variable) + - [ucl_parser_add_chunk](#ucl_parser_add_chunk) + - [ucl_parser_add_string](#ucl_parser_add_string) + - [ucl_parser_add_file](#ucl_parser_add_file) + - [ucl_parser_get_object](#ucl_parser_get_object) + - [ucl_parser_get_error](#ucl_parser_get_error) + - [ucl_parser_free](#ucl_parser_free) + - [ucl_pubkey_add](#ucl_pubkey_add) + - [ucl_parser_set_filevars](#ucl_parser_set_filevars) + - [Parser usage example](#parser-usage-example) +- [Emitting functions](#emitting-functions-1) + - [ucl_object_emit](#ucl_object_emit) + - [ucl_object_emit_full](#ucl_object_emit_full) +- [Conversion functions](#conversion-functions-1) +- [Generation functions](#generation-functions-1) + - [ucl_object_new](#ucl_object_new) + - [ucl_object_typed_new](#ucl_object_typed_new) + - [Primitive objects generation](#primitive-objects-generation) + - [ucl_object_fromstring_common](#ucl_object_fromstring_common) +- [Iteration functions](#iteration-functions-1) + - [ucl_iterate_object](#ucl_iterate_object) +- [Validation functions](#validation-functions-1) + - [ucl_object_validate](#ucl_object_validate) + +# Synopsis `#include ` -Description -=========== +# Description Libucl is a parser and `C` API to parse and generate `ucl` objects. Libucl consist of several groups of functions: ### Parser functions -Used to parse `ucl` files and provide interface to extract `ucl` object +Used to parse `ucl` files and provide interface to extract `ucl` object. Currently, `libucl` can parse only full `ucl` documents, for instance, it is impossible to parse a part of document and therefore it is impossible to use `libucl` as a streaming parser. In future, this limitation can be removed. ### Emitting functions -Convert `ucl` objects to some textual or binary representation. +Convert `ucl` objects to some textual or binary representation. Currently, libucl supports the following exports: + +- `JSON` - valid json format (can possibly loose some original data, such as implicit arrays) +- `Config` - human-readable configuration format (losseless) +- `YAML` - embedded yaml format (has the same limitations as `json` output) ### Conversion functions -Help to convert `ucl` objects to C types +Help to convert `ucl` objects to C types. These functions are used to convert `ucl_object_t` to C primitive types, such as numbers, strings or boolean values. ### Generation functions -Allow creating of `ucl` objects from C types +Allow creating of `ucl` objects from C types and creating of complex `ucl` objects, such as hashes or arrays from primitive `ucl` objects, such as numbers or strings. ### Iteration functions -Iterate over `ucl` objects +Iterate over `ucl` complex objects or over a chain of values, for example when a key in an object has multiple values (that can be treated as implicit array or implicit consolidation). + +### Validation functions +Validation functions are used to validate some object `obj` using json-schema compatible object `schema`. Both input and schema must be UCL objects to perform validation. ### Utility functions -Provide basic utilities to manage `ucl` objects +Provide basic utilities to manage `ucl` objects: creating, removing, retaining and releasing reference count and so on. # Parser functions @@ -40,6 +85,7 @@ Creates new parser with the specified fl - `UCL_PARSER_KEY_LOWERCASE` - lowercase keys parsed - `UCL_PARSER_ZEROCOPY` - try to use zero-copy mode when reading files (in zero-copy mode text chunk being parsed without copying strings so it should exist till any object parsed is used) +- `UCL_PARSER_NO_TIME` - treat time values as strings without parsing them as floats ### ucl_parser_register_macro @@ -87,6 +133,14 @@ while this one won't be parsed correctly This limitation may possible be removed in future. +### ucl_parser_add_string +~~~C +bool ucl_parser_add_string (struct ucl_parser *parser, + const char *data, size_t len); +~~~ + +This function acts exactly like `ucl_parser_add_chunk` does but if `len` argument is zero, then the string `data` must be zero-terminated and the actual length is calculated up to `\0` character. + ### ucl_parser_add_file ~~~C @@ -228,7 +282,7 @@ Libucl provides the following functions ### ucl_object_emit ~~~C -unsigned char *ucl_object_emit (ucl_object_t *obj, enum ucl_emitter emit_type); +unsigned char *ucl_object_emit (const ucl_object_t *obj, enum ucl_emitter emit_type); ~~~ Allocate a string that is suitable to fit the underlying UCL object `obj` and fill it with the textual representation of the object `obj` according to style `emit_type`. The caller should free the returned string after using. @@ -236,7 +290,7 @@ Allocate a string that is suitable to fi ### ucl_object_emit_full ~~~C -bool ucl_object_emit_full (ucl_object_t *obj, enum ucl_emitter emit_type, +bool ucl_object_emit_full (const ucl_object_t *obj, enum ucl_emitter emit_type, struct ucl_emitter_functions *emitter); ~~~ @@ -314,19 +368,20 @@ This function is used to convert a strin - `UCL_STRING_PARSE_BOOLEAN` - parse passed string and detect boolean - `UCL_STRING_PARSE_INT` - parse passed string and detect integer number - `UCL_STRING_PARSE_DOUBLE` - parse passed string and detect integer or float number -- `UCL_STRING_PARSE_NUMBER` - parse passed string and detect number (both float or integer types) -- `UCL_STRING_PARSE` - parse passed string (and detect booleans and numbers) +- `UCL_STRING_PARSE_TIME` - parse time values as floating point numbers +- `UCL_STRING_PARSE_NUMBER` - parse passed string and detect number (both float, integer and time types) +- `UCL_STRING_PARSE` - parse passed string (and detect booleans, numbers and time values) - `UCL_STRING_PARSE_BYTES` - assume that numeric multipliers are in bytes notation, for example `10k` means `10*1024` and not `10*1000` as assumed without this flag If parsing operations fail then the resulting UCL object will be a `UCL_STRING`. A caller should always check the type of the returned object and release it after using. -# Iteration function +# Iteration functions Iteration are used to iterate over UCL compound types: arrays and objects. Moreover, iterations could be performed over the keys with multiple values (implicit arrays). To iterate over an object, an array or a key with multiple values there is a function `ucl_iterate_object`. ## ucl_iterate_object ~~~C -ucl_object_t* ucl_iterate_object (ucl_object_t *obj, +const ucl_object_t* ucl_iterate_object (const ucl_object_t *obj, ucl_object_iter_t *iter, bool expand_values); ~~~ @@ -334,7 +389,7 @@ This function accept opaque iterator poi ~~~C ucl_object_iter_t it = NULL, it_obj = NULL; -ucl_object_t *cur, *tmp; +const ucl_object_t *cur, *tmp; /* Iterate over the object */ while ((obj = ucl_iterate_object (top, &it, true))) { @@ -345,4 +400,40 @@ while ((obj = ucl_iterate_object (top, & ucl_object_tostring_forced (cur)); } } -~~~ \ No newline at end of file +~~~ + +# Validation functions + +Currently, there is only one validation function called `ucl_object_validate`. It performs validation of object using the specified schema. This function is defined as following: + +## ucl_object_validate +~~~C +bool ucl_object_validate (const ucl_object_t *schema, + const ucl_object_t *obj, struct ucl_schema_error *err); +~~~ + +This function uses ucl object `schema`, that must be valid in terms of `json-schema` draft v4, to validate input object `obj`. If this function returns `true` then validation procedure has been succeed. Otherwise, `false` is returned and `err` is set to a specific value. If caller set `err` to NULL then this function does not set any error just returning `false`. Error is the structure defined as following: + +~~~C +struct ucl_schema_error { + enum ucl_schema_error_code code; /* error code */ + char msg[128]; /* error message */ + ucl_object_t *obj; /* object where error occured */ +}; +~~~ + +Caller may use `code` field to get a numeric error code: + +~~~C +enum ucl_schema_error_code { + UCL_SCHEMA_OK = 0, /* no error */ + UCL_SCHEMA_TYPE_MISMATCH, /* type of object is incorrect */ + UCL_SCHEMA_INVALID_SCHEMA, /* schema is invalid */ + UCL_SCHEMA_MISSING_PROPERTY,/* missing properties */ + UCL_SCHEMA_CONSTRAINT, /* constraint found */ + UCL_SCHEMA_MISSING_DEPENDENCY, /* missing dependency */ + UCL_SCHEMA_UNKNOWN /* generic error */ +}; +~~~ + +`msg` is a stiring description of an error and `obj` is an object where error has been occurred. Error object is not allocated by libucl, so there is no need to free it after validation (a static object should thus be used). \ No newline at end of file Copied and modified: stable/9/contrib/libucl/doc/libucl.3 (from r263648, head/contrib/libucl/doc/libucl.3) ============================================================================== --- head/contrib/libucl/doc/libucl.3 Sat Mar 22 17:28:14 2014 (r263648, copy source) +++ stable/9/contrib/libucl/doc/libucl.3 Sat Jul 19 23:57:36 2014 (r268897) @@ -6,11 +6,11 @@ \f[B]ucl_parser_add_string\f[], \f[B]ucl_parser_add_file\f[], \f[B]ucl_parser_get_object\f[], \f[B]ucl_parser_get_error\f[], \f[B]ucl_parser_free\f[], \f[B]ucl_pubkey_add\f[], -\f[B]ucl_parser_set_filevars\f[] - universal configuration library +\f[B]ucl_parser_set_filevars\f[] \- universal configuration library parser and utility functions .SH LIBRARY .PP -UCL library (libucl, -lucl) +UCL library (libucl, \-lucl) .SH SYNOPSIS .PP \f[C]#include\ \f[] @@ -32,12 +32,12 @@ In future, this limitation can be remove Convert \f[C]ucl\f[] objects to some textual or binary representation. Currently, libucl supports the following exports: .IP \[bu] 2 -\f[C]JSON\f[] - valid json format (can possibly loose some original +\f[C]JSON\f[] \- valid json format (can possibly loose some original data, such as implicit arrays) .IP \[bu] 2 -\f[C]Config\f[] - human-readable configuration format (losseless) +\f[C]Config\f[] \- human\-readable configuration format (losseless) .IP \[bu] 2 -\f[C]YAML\f[] - embedded yaml format (has the same limitations as +\f[C]YAML\f[] \- embedded yaml format (has the same limitations as \f[C]json\f[] output) .SS Conversion functions .PP @@ -57,7 +57,7 @@ as implicit array or implicit consolidat .SS Validation functions .PP Validation functions are used to validate some object \f[C]obj\f[] using -json-schema compatible object \f[C]schema\f[]. +json\-schema compatible object \f[C]schema\f[]. Both input and schema must be UCL objects to perform validation. .SS Utility functions .PP @@ -76,13 +76,13 @@ struct\ ucl_parser*\ ucl_parser_new\ (in .PP Creates new parser with the specified flags: .IP \[bu] 2 -\f[C]UCL_PARSER_KEY_LOWERCASE\f[] - lowercase keys parsed +\f[C]UCL_PARSER_KEY_LOWERCASE\f[] \- lowercase keys parsed .IP \[bu] 2 -\f[C]UCL_PARSER_ZEROCOPY\f[] - try to use zero-copy mode when reading -files (in zero-copy mode text chunk being parsed without copying strings -so it should exist till any object parsed is used) +\f[C]UCL_PARSER_ZEROCOPY\f[] \- try to use zero\-copy mode when reading +files (in zero\-copy mode text chunk being parsed without copying +strings so it should exist till any object parsed is used) .IP \[bu] 2 -\f[C]UCL_PARSER_NO_TIME\f[] - treat time values as strings without +\f[C]UCL_PARSER_NO_TIME\f[] \- treat time values as strings without parsing them as floats .SS ucl_parser_register_macro .IP @@ -161,7 +161,7 @@ bool\ ucl_parser_add_string\ (struct\ uc .PP This function acts exactly like \f[C]ucl_parser_add_chunk\f[] does but if \f[C]len\f[] argument is zero, then the string \f[C]data\f[] must be -zero-terminated and the actual length is calculated up to \f[C]\\0\f[] +zero\-terminated and the actual length is calculated up to \f[C]\\0\f[] character. .SS ucl_parser_add_file .IP @@ -229,7 +229,7 @@ bool\ ucl_pubkey_add\ (struct\ ucl_parse This function adds a public key from text blob \f[C]key\f[] of length \f[C]len\f[] to the \f[C]parser\f[] object. This public key should be in the \f[C]PEM\f[] format and can be used by -\f[C].includes\f[] macro for checking signatures of files included. +\f[C]\&.includes\f[] macro for checking signatures of files included. \f[C]Openssl\f[] support should be enabled to make this function working. If a key cannot be added (e.g. @@ -247,25 +247,26 @@ bool\ ucl_parser_set_filevars\ (struct\ Add the standard file variables to the \f[C]parser\f[] based on the \f[C]filename\f[] specified: .IP \[bu] 2 -\f[C]$FILENAME\f[] - a filename of \f[C]ucl\f[] input +\f[C]$FILENAME\f[] \- a filename of \f[C]ucl\f[] input .IP \[bu] 2 -\f[C]$CURDIR\f[] - a current directory of the input +\f[C]$CURDIR\f[] \- a current directory of the input .PP -For example, if a \f[C]filename\f[] param is \f[C]../something.conf\f[] -then the variables will have the following values: +For example, if a \f[C]filename\f[] param is +\f[C]\&../something.conf\f[] then the variables will have the following +values: .IP \[bu] 2 -\f[C]$FILENAME\f[] - "../something.conf" +\f[C]$FILENAME\f[] \- "../something.conf" .IP \[bu] 2 -\f[C]$CURDIR\f[] - ".." +\f[C]$CURDIR\f[] \- ".." .PP if \f[C]need_expand\f[] parameter is \f[C]true\f[] then all relative paths are expanded using \f[C]realpath\f[] call. -In this example if \f[C]..\f[] is \f[C]/etc/dir\f[] then variables will -have these values: +In this example if \f[C]\&..\f[] is \f[C]/etc/dir\f[] then variables +will have these values: .IP \[bu] 2 -\f[C]$FILENAME\f[] - "/etc/something.conf" +\f[C]$FILENAME\f[] \- "/etc/something.conf" .IP \[bu] 2 -\f[C]$CURDIR\f[] - "/etc" +\f[C]$CURDIR\f[] \- "/etc" .SS Parser usage example .PP The following example loads, parses and extracts \f[C]ucl\f[] object @@ -283,7 +284,7 @@ FILE\ *in; in\ =\ stdin; parser\ =\ ucl_parser_new\ (0); while\ (!feof\ (in)\ &&\ r\ <\ (int)sizeof\ (inbuf))\ { -\ \ \ \ r\ +=\ fread\ (inbuf\ +\ r,\ 1,\ sizeof\ (inbuf)\ -\ r,\ in); +\ \ \ \ r\ +=\ fread\ (inbuf\ +\ r,\ 1,\ sizeof\ (inbuf)\ \-\ r,\ in); } ucl_parser_add_chunk\ (parser,\ inbuf,\ r); fclose\ (in); @@ -309,20 +310,20 @@ return\ ret; .PP Libucl can transform UCL objects to a number of tectual formats: .IP \[bu] 2 -configuration (\f[C]UCL_EMIT_CONFIG\f[]) - nginx like human readable +configuration (\f[C]UCL_EMIT_CONFIG\f[]) \- nginx like human readable configuration file where implicit arrays are transformed to the duplicate keys .IP \[bu] 2 -compact json: \f[C]UCL_EMIT_JSON_COMPACT\f[] - single line valid json +compact json: \f[C]UCL_EMIT_JSON_COMPACT\f[] \- single line valid json without spaces .IP \[bu] 2 -formatted json: \f[C]UCL_EMIT_JSON\f[] - pretty formatted JSON with +formatted json: \f[C]UCL_EMIT_JSON\f[] \- pretty formatted JSON with newlines and spaces .IP \[bu] 2 -compact yaml: \f[C]UCL_EMIT_YAML\f[] - compact YAML output +compact yaml: \f[C]UCL_EMIT_YAML\f[] \- compact YAML output .PP Moreover, libucl API allows to select a custom set of emitting functions -allowing efficent and zero-copy output of libucl objects. +allowing efficent and zero\-copy output of libucl objects. Libucl uses the following structure to support this feature: .IP .nf @@ -344,17 +345,17 @@ struct\ ucl_emitter_functions\ { .PP This structure defines the following callbacks: .IP \[bu] 2 -\f[C]ucl_emitter_append_character\f[] - a function that is called to +\f[C]ucl_emitter_append_character\f[] \- a function that is called to append \f[C]nchars\f[] characters equal to \f[C]c\f[] .IP \[bu] 2 -\f[C]ucl_emitter_append_len\f[] - used to append a string of length +\f[C]ucl_emitter_append_len\f[] \- used to append a string of length \f[C]len\f[] starting from pointer \f[C]str\f[] .IP \[bu] 2 -\f[C]ucl_emitter_append_int\f[] - this function applies to integer +\f[C]ucl_emitter_append_int\f[] \- this function applies to integer numbers .IP \[bu] 2 -\f[C]ucl_emitter_append_double\f[] - this function is intended to output -floating point variable +\f[C]ucl_emitter_append_double\f[] \- this function is intended to +output floating point variable .PP The set of these functions could be used to output text formats of \f[C]UCL\f[] objects to different structures or streams. @@ -364,7 +365,7 @@ Libucl provides the following functions .IP .nf \f[C] -unsigned\ char\ *ucl_object_emit\ (ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type); +unsigned\ char\ *ucl_object_emit\ (const\ ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type); \f[] .fi .PP @@ -376,7 +377,7 @@ The caller should free the returned stri .IP .nf \f[C] -bool\ ucl_object_emit_full\ (ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type, +bool\ ucl_object_emit_full\ (const\ ucl_object_t\ *obj,\ enum\ ucl_emitter\ emit_type, \ \ \ \ \ \ \ \ struct\ ucl_emitter_functions\ *emitter); \f[] .fi @@ -400,26 +401,26 @@ cannot be converted then some reasonable strings and 0 for numbers) .PP Also there is a single \f[C]ucl_object_tostring_forced\f[] function that -converts any UCL object (including compound types - arrays and objects) +converts any UCL object (including compound types \- arrays and objects) to a string representation. For compound and numeric types this function performs emitting to a compact json format actually. .PP Here is a list of all conversion functions: .IP \[bu] 2 -\f[C]ucl_object_toint\f[] - returns \f[C]int64_t\f[] of UCL object +\f[C]ucl_object_toint\f[] \- returns \f[C]int64_t\f[] of UCL object .IP \[bu] 2 -\f[C]ucl_object_todouble\f[] - returns \f[C]double\f[] of UCL object +\f[C]ucl_object_todouble\f[] \- returns \f[C]double\f[] of UCL object .IP \[bu] 2 -\f[C]ucl_object_toboolean\f[] - returns \f[C]bool\f[] of UCL object +\f[C]ucl_object_toboolean\f[] \- returns \f[C]bool\f[] of UCL object .IP \[bu] 2 -\f[C]ucl_object_tostring\f[] - returns \f[C]const\ char\ *\f[] of UCL +\f[C]ucl_object_tostring\f[] \- returns \f[C]const\ char\ *\f[] of UCL object (this string is NULL terminated) .IP \[bu] 2 -\f[C]ucl_object_tolstring\f[] - returns \f[C]const\ char\ *\f[] and +\f[C]ucl_object_tolstring\f[] \- returns \f[C]const\ char\ *\f[] and \f[C]size_t\f[] len of UCL object (string can be not NULL terminated) .IP \[bu] 2 -\f[C]ucl_object_tostring_forced\f[] - returns string representation of +\f[C]ucl_object_tostring_forced\f[] \- returns string representation of any UCL object .PP Strings returned by these pointers are associated with the UCL object @@ -448,26 +449,28 @@ ucl_object_t\ *\ ucl_object_typed_new\ ( \f[] .fi .PP -Create an object of a specified type: - \f[C]UCL_OBJECT\f[] - UCL object -- key/value pairs - \f[C]UCL_ARRAY\f[] - UCL array - \f[C]UCL_INT\f[] - -integer number - \f[C]UCL_FLOAT\f[] - floating point number - -\f[C]UCL_STRING\f[] - NULL terminated string - \f[C]UCL_BOOLEAN\f[] - -boolean value - \f[C]UCL_TIME\f[] - time value (floating point number of -seconds) - \f[C]UCL_USERDATA\f[] - opaque userdata pointer (may be used -in macros) - \f[C]UCL_NULL\f[] - null value +Create an object of a specified type: \- \f[C]UCL_OBJECT\f[] \- UCL +object \- key/value pairs \- \f[C]UCL_ARRAY\f[] \- UCL array \- +\f[C]UCL_INT\f[] \- integer number \- \f[C]UCL_FLOAT\f[] \- floating +point number \- \f[C]UCL_STRING\f[] \- NULL terminated string \- +\f[C]UCL_BOOLEAN\f[] \- boolean value \- \f[C]UCL_TIME\f[] \- time value +(floating point number of seconds) \- \f[C]UCL_USERDATA\f[] \- opaque +userdata pointer (may be used in macros) \- \f[C]UCL_NULL\f[] \- null +value .PP This object should be released by caller. .SS Primitive objects generation .PP Libucl provides the functions similar to inverse conversion functions -called with the specific C type: - \f[C]ucl_object_fromint\f[] - -converts \f[C]int64_t\f[] to UCL object - \f[C]ucl_object_fromdouble\f[] -- converts \f[C]double\f[] to UCL object - -\f[C]ucl_object_fromboolean\f[] - converts \f[C]bool\f[] to UCL object - -\f[C]ucl_object_fromstring\f[] - converts \f[C]const\ char\ *\f[] to UCL -object (this string is NULL terminated) - -\f[C]ucl_object_fromlstring\f[] - converts \f[C]const\ char\ *\f[] and -\f[C]size_t\f[] len to UCL object (string can be not NULL terminated) +called with the specific C type: \- \f[C]ucl_object_fromint\f[] \- +converts \f[C]int64_t\f[] to UCL object \- +\f[C]ucl_object_fromdouble\f[] \- converts \f[C]double\f[] to UCL object +\- \f[C]ucl_object_fromboolean\f[] \- converts \f[C]bool\f[] to UCL +object \- \f[C]ucl_object_fromstring\f[] \- converts +\f[C]const\ char\ *\f[] to UCL object (this string is NULL terminated) +\- \f[C]ucl_object_fromlstring\f[] \- converts \f[C]const\ char\ *\f[] +and \f[C]size_t\f[] len to UCL object (string can be not NULL +terminated) .PP Also there is a function to generate UCL object from a string performing various parsing or conversion operations called @@ -484,35 +487,35 @@ ucl_object_t\ *\ ucl_object_fromstring_c This function is used to convert a string \f[C]str\f[] of size \f[C]len\f[] to an UCL objects applying \f[C]flags\f[] conversions. If \f[C]len\f[] is equal to zero then a \f[C]str\f[] is assumed as -NULL-terminated. +NULL\-terminated. This function supports the following flags (a set of flags can be specified using logical \f[C]OR\f[] operation): .IP \[bu] 2 -\f[C]UCL_STRING_ESCAPE\f[] - perform JSON escape +\f[C]UCL_STRING_ESCAPE\f[] \- perform JSON escape .IP \[bu] 2 -\f[C]UCL_STRING_TRIM\f[] - trim leading and trailing whitespaces +\f[C]UCL_STRING_TRIM\f[] \- trim leading and trailing whitespaces .IP \[bu] 2 -\f[C]UCL_STRING_PARSE_BOOLEAN\f[] - parse passed string and detect +\f[C]UCL_STRING_PARSE_BOOLEAN\f[] \- parse passed string and detect boolean .IP \[bu] 2 -\f[C]UCL_STRING_PARSE_INT\f[] - parse passed string and detect integer +\f[C]UCL_STRING_PARSE_INT\f[] \- parse passed string and detect integer number .IP \[bu] 2 -\f[C]UCL_STRING_PARSE_DOUBLE\f[] - parse passed string and detect +\f[C]UCL_STRING_PARSE_DOUBLE\f[] \- parse passed string and detect integer or float number .IP \[bu] 2 -\f[C]UCL_STRING_PARSE_TIME\f[] - parse time values as floating point +\f[C]UCL_STRING_PARSE_TIME\f[] \- parse time values as floating point numbers .IP \[bu] 2 -\f[C]UCL_STRING_PARSE_NUMBER\f[] - parse passed string and detect number -(both float, integer and time types) +\f[C]UCL_STRING_PARSE_NUMBER\f[] \- parse passed string and detect +number (both float, integer and time types) .IP \[bu] 2 -\f[C]UCL_STRING_PARSE\f[] - parse passed string (and detect booleans, +\f[C]UCL_STRING_PARSE\f[] \- parse passed string (and detect booleans, numbers and time values) .IP \[bu] 2 -\f[C]UCL_STRING_PARSE_BYTES\f[] - assume that numeric multipliers are in -bytes notation, for example \f[C]10k\f[] means \f[C]10*1024\f[] and not -\f[C]10*1000\f[] as assumed without this flag +\f[C]UCL_STRING_PARSE_BYTES\f[] \- assume that numeric multipliers are +in bytes notation, for example \f[C]10k\f[] means \f[C]10*1024\f[] and +not \f[C]10*1000\f[] as assumed without this flag .PP If parsing operations fail then the resulting UCL object will be a \f[C]UCL_STRING\f[]. @@ -530,7 +533,7 @@ is a function \f[C]ucl_iterate_object\f[ .IP .nf \f[C] -ucl_object_t*\ ucl_iterate_object\ (ucl_object_t\ *obj,\ +const\ ucl_object_t*\ ucl_iterate_object\ (const\ ucl_object_t\ *obj,\ \ \ \ \ ucl_object_iter_t\ *iter,\ bool\ expand_values); \f[] .fi @@ -561,7 +564,7 @@ Here is an example of iteration over the .nf \f[C] ucl_object_iter_t\ it\ =\ NULL,\ it_obj\ =\ NULL; -ucl_object_t\ *cur,\ *tmp; +const\ ucl_object_t\ *cur,\ *tmp; /*\ Iterate\ over\ the\ object\ */ while\ ((obj\ =\ ucl_iterate_object\ (top,\ &it,\ true)))\ { @@ -584,13 +587,13 @@ This function is defined as following: .IP .nf \f[C] -bool\ ucl_object_validate\ (ucl_object_t\ *schema, -\ \ \ \ ucl_object_t\ *obj,\ struct\ ucl_schema_error\ *err); +bool\ ucl_object_validate\ (const\ ucl_object_t\ *schema, +\ \ \ \ const\ ucl_object_t\ *obj,\ struct\ ucl_schema_error\ *err); \f[] .fi .PP This function uses ucl object \f[C]schema\f[], that must be valid in -terms of \f[C]json-schema\f[] draft v4, to validate input object +terms of \f[C]json\-schema\f[] draft v4, to validate input object \f[C]obj\f[]. If this function returns \f[C]true\f[] then validation procedure has been succeed. Copied: stable/9/contrib/libucl/doc/pandoc.template (from r263648, head/contrib/libucl/doc/pandoc.template) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/libucl/doc/pandoc.template Sat Jul 19 23:57:36 2014 (r268897, copy of r263648, head/contrib/libucl/doc/pandoc.template) @@ -0,0 +1,12 @@ +% LIBUCL(5) Libucl manual +% Vsevolod Stakhov +% March 20, 2014 + +# Name + +**ucl_parser_new**, **ucl_parser_register_macro**, **ucl_parser_register_variable**, **ucl_parser_add_chunk**, **ucl_parser_add_string**, **ucl_parser_add_file**, **ucl_parser_get_object**, **ucl_parser_get_error**, **ucl_parser_free**, **ucl_pubkey_add**, **ucl_parser_set_filevars** - universal configuration library parser and utility functions + +# Library + +UCL library (libucl, -lucl) + Modified: stable/9/contrib/libucl/include/ucl.h ============================================================================== --- stable/9/contrib/libucl/include/ucl.h Sat Jul 19 23:44:57 2014 (r268896) +++ stable/9/contrib/libucl/include/ucl.h Sat Jul 19 23:57:36 2014 (r268897) @@ -81,6 +81,14 @@ extern "C" { #define UCL_WARN_UNUSED_RESULT #endif +#ifdef __GNUC__ +#define UCL_DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define UCL_DEPRECATED(func) __declspec(deprecated) func +#else +#define UCL_DEPRECATED(func) func +#endif + /** * @defgroup structures Structures and types * UCL defines several enumeration types used for error reporting or specifying flags and attributes. @@ -138,7 +146,8 @@ typedef enum ucl_emitter { */ typedef enum ucl_parser_flags { UCL_PARSER_KEY_LOWERCASE = 0x1, /**< Convert all keys to lower case */ - UCL_PARSER_ZEROCOPY = 0x2 /**< Parse input in zero-copy mode if possible */ + UCL_PARSER_ZEROCOPY = 0x2, /**< Parse input in zero-copy mode if possible */ + UCL_PARSER_NO_TIME = 0x4 /**< Do not parse time and treat time values as strings */ } ucl_parser_flags_t; /** @@ -150,11 +159,12 @@ typedef enum ucl_string_flags { UCL_STRING_PARSE_BOOLEAN = 0x4, /**< Parse passed string and detect boolean */ UCL_STRING_PARSE_INT = 0x8, /**< Parse passed string and detect integer number */ UCL_STRING_PARSE_DOUBLE = 0x10, /**< Parse passed string and detect integer or float number */ - UCL_STRING_PARSE_NUMBER = UCL_STRING_PARSE_INT|UCL_STRING_PARSE_DOUBLE , /**< + UCL_STRING_PARSE_TIME = 0x20, /**< Parse time strings */ + UCL_STRING_PARSE_NUMBER = UCL_STRING_PARSE_INT|UCL_STRING_PARSE_DOUBLE|UCL_STRING_PARSE_TIME, /**< Parse passed string and detect number */ UCL_STRING_PARSE = UCL_STRING_PARSE_BOOLEAN|UCL_STRING_PARSE_NUMBER, /**< Parse passed string (and detect booleans and numbers) */ - UCL_STRING_PARSE_BYTES = 0x20 /**< Treat numbers as bytes */ + UCL_STRING_PARSE_BYTES = 0x40 /**< Treat numbers as bytes */ } ucl_string_flags_t; /** @@ -206,51 +216,33 @@ typedef struct ucl_object_s { * @param obj CL object * @return zero terminated key */ -UCL_EXTERN char* ucl_copy_key_trash (ucl_object_t *obj); +UCL_EXTERN char* ucl_copy_key_trash (const ucl_object_t *obj); /** * Copy and return a string value of an object, returned key is zero-terminated * @param obj CL object * @return zero terminated string representation of object value */ -UCL_EXTERN char* ucl_copy_value_trash (ucl_object_t *obj); +UCL_EXTERN char* ucl_copy_value_trash (const ucl_object_t *obj); /** * Creates a new object * @return new object */ -static inline ucl_object_t* ucl_object_new (void) UCL_WARN_UNUSED_RESULT; -static inline ucl_object_t * -ucl_object_new (void) -{ - ucl_object_t *new; - new = malloc (sizeof (ucl_object_t)); - if (new != NULL) { - memset (new, 0, sizeof (ucl_object_t)); - new->ref = 1; - new->type = UCL_NULL; - } - return new; -} +UCL_EXTERN ucl_object_t* ucl_object_new (void) UCL_WARN_UNUSED_RESULT; /** * Create new object with type specified * @param type type of a new object * @return new object */ -static inline ucl_object_t* ucl_object_typed_new (unsigned int type) UCL_WARN_UNUSED_RESULT; -static inline ucl_object_t * -ucl_object_typed_new (unsigned int type) -{ - ucl_object_t *new; - new = malloc (sizeof (ucl_object_t)); - if (new != NULL) { - memset (new, 0, sizeof (ucl_object_t)); - new->ref = 1; - new->type = (type <= UCL_NULL ? type : UCL_NULL); - } - return new; -} +UCL_EXTERN ucl_object_t* ucl_object_typed_new (ucl_type_t type) UCL_WARN_UNUSED_RESULT; + +/** + * Return the type of an object + * @return the object type + */ +UCL_EXTERN ucl_type_t ucl_object_type (const ucl_object_t *obj); /** * Convert any string to an ucl object making the specified transformations @@ -267,11 +259,7 @@ UCL_EXTERN ucl_object_t * ucl_object_fro * @param str NULL terminated string, will be json escaped * @return new object */ -static inline ucl_object_t * -ucl_object_fromstring (const char *str) -{ - return ucl_object_fromstring_common (str, 0, UCL_STRING_ESCAPE); -} +UCL_EXTERN ucl_object_t *ucl_object_fromstring (const char *str) UCL_WARN_UNUSED_RESULT; /** * Create a UCL object from the specified string @@ -279,68 +267,29 @@ ucl_object_fromstring (const char *str) * @param len length of a string * @return new object */ -static inline ucl_object_t * -ucl_object_fromlstring (const char *str, size_t len) -{ - return ucl_object_fromstring_common (str, len, UCL_STRING_ESCAPE); -} +UCL_EXTERN ucl_object_t *ucl_object_fromlstring (const char *str, + size_t len) UCL_WARN_UNUSED_RESULT; /** * Create an object from an integer number * @param iv number * @return new object */ -static inline ucl_object_t * -ucl_object_fromint (int64_t iv) -{ - ucl_object_t *obj; - - obj = ucl_object_new (); - if (obj != NULL) { - obj->type = UCL_INT; - obj->value.iv = iv; - } - - return obj; -} +UCL_EXTERN ucl_object_t* ucl_object_fromint (int64_t iv) UCL_WARN_UNUSED_RESULT; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***