[OpenWrt-Devel] Meeting on TR-069 Work - Friday, June 10 - 7 AM PT

2016-06-03 Thread Eric Schultz
I'm excited to see so many people interested in TR-069 support! As a
follow up to the previous TR-069 email, I've set up a meeting on TR-069
support for OpenWrt. The meeting is on Friday, June 10 at 7 AM PT.

I expect the meeting will discuss:

* The proposals for creating/integrating TR-069 support into OpenWrt
from Luka and Felix
* The proposed open source TR-069 stacks from SoftAtHome and
Technicolor, as well as the potential for reuse between stacks
* The potential for a standard TR-069 stack interface in OpenWrt
* A standard interface in OpenWrt for protocols like TR-069, as proposed
by Felix
* A face-to-face meeting for all of the core implementers to work
through the technical details to develop a plan forward
* Anything else related!

Everyone interested is invited to join the meeting. I also plan to post
a video of the meeting to Youtube for those who couldn't attend. To join
the meeting using any WebRTC enabled browser, please follow the
instructions below.

Thanks a lot and I look forward to seeing many of you at the meeting.

Thanks,

Eric

--

Eric Schultz, Community Manager, prpl Foundation
http://www.prplfoundation.org
eschu...@prplfoundation.org 
cell: 920-539-0404 
skype: ericschultzwi
@EricPrpl

---

 
To join the web meeting click or copy and paste this URL into your browser:
 
_http://fuze.me/32924366_
 
To join the audio portion of this meeting:
 
Internet Audio: Simply select the internet audio option after joining.
Toll / Intl #: +12014794595
Toll free #: +18553463893
You can find international access numbers at
_https://www.fuze.com/extras/symphony_
If prompted, enter the meeting number: 32924366, then press #.
 
For the optimal experience, download Fuze: 
_www.fuzebox.com/products/download_

 
Need help? You can connect to our Customer Support Team or access self-help
tools at _www.fuzebox.com/support_ .
 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [LEDE-DEV] [PATCH libubox] blobmsg_json: add new functions blobmsg_format_json_value*

2016-06-03 Thread Eyal Birger

Hi,

> On 3 Jun 2016, at 13:11, Matthias Schiffer  
> wrote:
> 
(snip)
> 
> 1) and 2) would allow blobmsg to store everything that json-c can (with the
> caveat that json-c stores integers as int64 internally, while blobmsg_json
> uses int32) -

We also noticed this as a problem for us since when converting json strings to 
blobmsg, integers become signed and thus no more than INT32_MAX can be used.

Do you plans to approach this in your patchsets?

Eyal

> do you think these changes make sense?
> 
> Would there also be general interest in 3), so it might be integrated into
> libubox?
> 
> Regards,
> Matthias
> 
> 
>> 
>>> 
>>> Signed-off-by: Matthias Schiffer 
>>> ---
>>> blobmsg_json.c | 49 -
>>> blobmsg_json.h | 14 ++
>>> 2 files changed, 50 insertions(+), 13 deletions(-)
>>> 
>>> diff --git a/blobmsg_json.c b/blobmsg_json.c
>>> index 5713948..538c816 100644
>>> --- a/blobmsg_json.c
>>> +++ b/blobmsg_json.c
>>> @@ -207,7 +207,7 @@ static void blobmsg_format_string(struct strbuf *s, 
>>> const char *str)
>>> 
>>> static void blobmsg_format_json_list(struct strbuf *s, struct blob_attr 
>>> *attr, int len, bool array);
>>> 
>>> -static void blobmsg_format_element(struct strbuf *s, struct blob_attr 
>>> *attr, bool array, bool head)
>>> +static void blobmsg_format_element(struct strbuf *s, struct blob_attr 
>>> *attr, bool without_name, bool head)
>>> {
>>>const char *data_str;
>>>char buf[32];
>>> @@ -217,7 +217,7 @@ static void blobmsg_format_element(struct strbuf *s, 
>>> struct blob_attr *attr, boo
>>>if (!blobmsg_check_attr(attr, false))
>>>return;
>>> 
>>> -if (!array && blobmsg_name(attr)[0]) {
>>> +if (!without_name && blobmsg_name(attr)[0]) {
>>>blobmsg_format_string(s, blobmsg_name(attr));
>>>blobmsg_puts(s, ": ", s->indent ? 2 : 1);
>>>}
>>> @@ -286,22 +286,26 @@ static void blobmsg_format_json_list(struct strbuf 
>>> *s, struct blob_attr *attr, i
>>>blobmsg_puts(s, (array ? "]" : "}"), 1);
>>> }
>>> 
>>> +static void setup_strbuf(struct strbuf *s, struct blob_attr *attr, 
>>> blobmsg_json_format_t cb, void *priv, int indent) {
>>> +s->len = blob_len(attr);
>>> +s->buf = malloc(s->len);
>>> +s->pos = 0;
>>> +s->custom_format = cb;
>>> +s->priv = priv;
>>> +s->indent = false;
>>> +
>>> +if (indent >= 0) {
>>> +s->indent = true;
>>> +s->indent_level = indent;
>>> +}
>>> +}
>>> +
>>> char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, 
>>> blobmsg_json_format_t cb, void *priv, int indent)
>>> {
>>>struct strbuf s;
>>>bool array;
>>> 
>>> -s.len = blob_len(attr);
>>> -s.buf = malloc(s.len);
>>> -s.pos = 0;
>>> -s.custom_format = cb;
>>> -s.priv = priv;
>>> -s.indent = false;
>>> -
>>> -if (indent >= 0) {
>>> -s.indent = true;
>>> -s.indent_level = indent;
>>> -}
>>> +setup_strbuf(, attr, cb, priv, indent);
>>> 
>>>array = blob_is_extended(attr) &&
>>>blobmsg_type(attr) == BLOBMSG_TYPE_ARRAY;
>>> @@ -321,3 +325,22 @@ char *blobmsg_format_json_with_cb(struct blob_attr 
>>> *attr, bool list, blobmsg_jso
>>> 
>>>return s.buf;
>>> }
>>> +
>>> +char *blobmsg_format_json_value_with_cb(struct blob_attr *attr, 
>>> blobmsg_json_format_t cb, void *priv, int indent)
>>> +{
>>> +struct strbuf s;
>>> +
>>> +setup_strbuf(, attr, cb, priv, indent);
>>> +
>>> +blobmsg_format_element(, attr, true, false);
>>> +
>>> +if (!s.len) {
>>> +free(s.buf);
>>> +return NULL;
>>> +}
>>> +
>>> +s.buf = realloc(s.buf, s.pos + 1);
>>> +s.buf[s.pos] = 0;
>>> +
>>> +return s.buf;
>>> +}
>>> diff --git a/blobmsg_json.h b/blobmsg_json.h
>>> index cd9ed33..9dfc02d 100644
>>> --- a/blobmsg_json.h
>>> +++ b/blobmsg_json.h
>>> @@ -42,4 +42,18 @@ static inline char *blobmsg_format_json_indent(struct 
>>> blob_attr *attr, bool list
>>>return blobmsg_format_json_with_cb(attr, list, NULL, NULL, indent);
>>> }
>>> 
>>> +char *blobmsg_format_json_value_with_cb(struct blob_attr *attr,
>>> +blobmsg_json_format_t cb, void *priv,
>>> +int indent);
>>> +
>>> +static inline char *blobmsg_format_json_value(struct blob_attr *attr)
>>> +{
>>> +return blobmsg_format_json_value_with_cb(attr, NULL, NULL, -1);
>>> +}
>>> +
>>> +static inline char *blobmsg_format_json_value_indent(struct blob_attr 
>>> *attr, int indent)
>>> +{
>>> +return blobmsg_format_json_value_with_cb(attr, NULL, NULL, indent);
>>> +}
>>> +
>>> #endif
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org

Re: [OpenWrt-Devel] [LEDE-DEV] [PATCH] package/devel/gdb: Add support of ARC gdb

2016-06-03 Thread Alexey Brodkin
Hi John,

On Fri, 2016-06-03 at 11:09 +0200, John Crispin wrote:
> Hi,
> 
> On 01/06/2016 17:32, Alexey Brodkin wrote:
> > 
> > As of today gdb port for ARC is not yet in upstream even though
> > we're working hard on that.
> > 
> > Still to allow ARC users to debug user-space apps on top of
> > Linux kernel we're adding here support for building GDB from
> > sources hosted on our GitHub here:
> > https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/releases/tag/arc-2016.03-gdb
> > 
> > Likewise for host GDB sources that come from unified git repository
> > (which is the case for upstream binutils/gdb today) we need to disable
> > building of binutils in gdb:
> > -->8--
> > --disable-binutils
> > --disable-ld
> > --disable-gas
> > -->8--
> > 
> these work for !arc targets. disabling them for all targets because they
> are broken on arc seem weird even if they might not be used.
> 
> rather than cluttering the makefile how about marking the packahe broken
> for arc and adding a new one called gdb-arc that depends on arc only.
> this will allow us to keep gdb clean and just drop the gdb-arc package
> once the fixes treacled down the tree.

Well all 3 options except "--sim" are very valid because modern GDB sources
come from "unified" git repo where binutils co-exist with gdb.

That's done on purpose because a lot of stuff indeed is the same in both
projects. And there's really no point in building either binutils, ld or gas
when we're building GDB. Disabling those options we at least saving some time
and in some cases may escape build failures.

Mentioned build failures might happen with some even release versions of GDB
tarballs. Again that is because gdb comes from the same unified repo BUT
(and that's important) still from the separate branch and so some parts of
binutils might be taken from "binutils" branch in unstable state.

In other words disabling build of not used components is pretty safe and
future-proof. And simulator falls here as well - we don't need it anyways
for either arch/board.

As for adding a separate package... we'll need to propagate new Kconfig symbol 
in
other files and so instead of limiting changes to 1 file we'll spread our
contamination all over source tree. Do we really want it?

-Alexey
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [LEDE-DEV] [PATCH libubox] blobmsg_json: add new functions blobmsg_format_json_value*

2016-06-03 Thread Matthias Schiffer
On 06/03/2016 11:05 AM, John Crispin wrote:
> 
> 
> On 01/06/2016 22:27, Matthias Schiffer wrote:
>> The current blobmsg_format_json* functions will return invalid JSON when
>> the "list" argument is given as false (blobmsg_format_element() will
>> output the name of the blob_attr as if the value is printed as part of a
>> JSON object).
>>
>> To avoid breaking software relying on this behaviour, introduce new
>> functions which will never print the blob_attr name and thus always
>> produce valid JSON.
> 
> what software relies on this function/behaviour ? maybe we should mark
> the current implementation as deprected and drop support in time X.
> producing broken json syntax seems very fragile.
> 
>   John

The most promiment usage is the output of `ubus list -v`, most other uses
seem to be just error messages.

I've found a number of other issues in blobmsg_json (more broken JSON
output, missing or broken allocation failure handling, ...). You can drop
this patch for now, I'll send a new version together with some other
patches next week.

Three more remarks/questions:

1) I'd like to add two more blobmsg datatypes, F32 and F64 for
single/double precision floating-point numbers, to complete the
JSON<->blobmsg mapping. I've already looked into possible platform-specific
encoding issues of floats, the only platform-specific part seems to be some
NaN encodings, which would need to be mapped to a generic NaN encoding.
(NaN is not valid JSON, so it wouldn't be important for blobmsg_json
anyways; json-c accepts NaN and +/- Infinity though).
Usecase: I'm currently implementing a configuration storage daemon as part
of my GSoC project. In particular, I think that geocoordinates would be
nice to store as floats.

2) blogmsg currently doesn't allow tables with empty keys. In JSON, the
empty string is not special and can be used as a key. I'd like to adjust
blobmsg to allow this.

3) Another thing I'm working on is a blobtree library. blobtrees are very
similar to blobmsg, but tables and arrays store just a list of pointers to
the child blobs. This allows efficient manipulation of such trees (for the
mentioned configuration storage daemon), while still making conversion from
and to blobmsg as simple as possible.

1) and 2) would allow blobmsg to store everything that json-c can (with the
caveat that json-c stores integers as int64 internally, while blobmsg_json
uses int32) - do you think these changes make sense?

Would there also be general interest in 3), so it might be integrated into
libubox?

Regards,
Matthias


> 
>>
>> Signed-off-by: Matthias Schiffer 
>> ---
>>  blobmsg_json.c | 49 -
>>  blobmsg_json.h | 14 ++
>>  2 files changed, 50 insertions(+), 13 deletions(-)
>>
>> diff --git a/blobmsg_json.c b/blobmsg_json.c
>> index 5713948..538c816 100644
>> --- a/blobmsg_json.c
>> +++ b/blobmsg_json.c
>> @@ -207,7 +207,7 @@ static void blobmsg_format_string(struct strbuf *s, 
>> const char *str)
>>  
>>  static void blobmsg_format_json_list(struct strbuf *s, struct blob_attr 
>> *attr, int len, bool array);
>>  
>> -static void blobmsg_format_element(struct strbuf *s, struct blob_attr 
>> *attr, bool array, bool head)
>> +static void blobmsg_format_element(struct strbuf *s, struct blob_attr 
>> *attr, bool without_name, bool head)
>>  {
>>  const char *data_str;
>>  char buf[32];
>> @@ -217,7 +217,7 @@ static void blobmsg_format_element(struct strbuf *s, 
>> struct blob_attr *attr, boo
>>  if (!blobmsg_check_attr(attr, false))
>>  return;
>>  
>> -if (!array && blobmsg_name(attr)[0]) {
>> +if (!without_name && blobmsg_name(attr)[0]) {
>>  blobmsg_format_string(s, blobmsg_name(attr));
>>  blobmsg_puts(s, ": ", s->indent ? 2 : 1);
>>  }
>> @@ -286,22 +286,26 @@ static void blobmsg_format_json_list(struct strbuf *s, 
>> struct blob_attr *attr, i
>>  blobmsg_puts(s, (array ? "]" : "}"), 1);
>>  }
>>  
>> +static void setup_strbuf(struct strbuf *s, struct blob_attr *attr, 
>> blobmsg_json_format_t cb, void *priv, int indent) {
>> +s->len = blob_len(attr);
>> +s->buf = malloc(s->len);
>> +s->pos = 0;
>> +s->custom_format = cb;
>> +s->priv = priv;
>> +s->indent = false;
>> +
>> +if (indent >= 0) {
>> +s->indent = true;
>> +s->indent_level = indent;
>> +}
>> +}
>> +
>>  char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, 
>> blobmsg_json_format_t cb, void *priv, int indent)
>>  {
>>  struct strbuf s;
>>  bool array;
>>  
>> -s.len = blob_len(attr);
>> -s.buf = malloc(s.len);
>> -s.pos = 0;
>> -s.custom_format = cb;
>> -s.priv = priv;
>> -s.indent = false;
>> -
>> -if (indent >= 0) {
>> -s.indent = true;
>> -s.indent_level = indent;
>> -}
>> +setup_strbuf(, attr, cb, priv, indent);
>>  
>>  array = blob_is_extended(attr) &&

Re: [OpenWrt-Devel] [LEDE-DEV] git.openwrt.org site half broken

2016-06-03 Thread Etienne Champetier
2016-06-03 11:13 GMT+02:00 John Crispin :
>
>
> On 02/06/2016 13:20, Etienne Champetier wrote:
>> Hi,
>>
>> someone messed with git.openwrt.org nginx config, i can't get the js and css.
>>
>> see https://git.openwrt.org/project/static/gitweb.css (doesn't look
>> like a css :) )
>>
>> Cheers
>> Etienne
>>
>
> that url looks weird.
> -> https://git.openwrt.org/static/gitweb.css
> works and for me the service seems to be functional.

Indeed, i don't know were i found
https://git.openwrt.org/project/
right url is
https://git.openwrt.org/

>
> John
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [LEDE-DEV] git.openwrt.org site half broken

2016-06-03 Thread John Crispin


On 02/06/2016 13:20, Etienne Champetier wrote:
> Hi,
> 
> someone messed with git.openwrt.org nginx config, i can't get the js and css.
> 
> see https://git.openwrt.org/project/static/gitweb.css (doesn't look
> like a css :) )
> 
> Cheers
> Etienne
> 

that url looks weird.
-> https://git.openwrt.org/static/gitweb.css
works and for me the service seems to be functional.

John


> ___
> Lede-dev mailing list
> lede-...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [LEDE-DEV] [PATCH] package/devel/gdb: Add support of ARC gdb

2016-06-03 Thread John Crispin
Hi,

On 01/06/2016 17:32, Alexey Brodkin wrote:
> As of today gdb port for ARC is not yet in upstream even though
> we're working hard on that.
> 
> Still to allow ARC users to debug user-space apps on top of
> Linux kernel we're adding here support for building GDB from
> sources hosted on our GitHub here:
> https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/releases/tag/arc-2016.03-gdb
> 
> Likewise for host GDB sources that come from unified git repository
> (which is the case for upstream binutils/gdb today) we need to disable
> building of binutils in gdb:
> -->8--
> --disable-binutils
> --disable-ld
> --disable-gas
> -->8--
> 

these work for !arc targets. disabling them for all targets because they
are broken on arc seem weird even if they might not be used.

rather than cluttering the makefile how about marking the packahe broken
for arc and adding a new one called gdb-arc that depends on arc only.
this will allow us to keep gdb clean and just drop the gdb-arc package
once the fixes treacled down the tree.

John


> Also we disable sim because if the following breakage while
> building with it:
> >8
> /usr/bin/env bash ./../common/genmloop.sh -shell /usr/bin/env bash \
> -mono -fast -pbb -switch sem5-switch.c \
> -cpu a5f -infile ./mloop5.in \
> -outfile-suffix 5
> unknown option: bash
> Makefile:699: recipe for target 'stamp-5mloop' failed
> make[7]: *** [stamp-5mloop] Error 1
> >8
> 
> Signed-off-by: Alexey Brodkin 
> Cc: John Crispin 
> Cc: Felix Fietkau 
> ---
>  package/devel/gdb/Makefile | 23 ++--
>  .../001-gdb-pr14523-mips-signal-number.patch   |  0
>  .../gdb/patches/{ => 7.11}/100-musl_fix.patch  |  0
>  .../patches/arc-2016.03/100-no_extern_inline.patch | 32 
> ++
>  .../gdb/patches/arc-2016.03/110-no_testsuite.patch | 21 ++
>  .../120-fix-compile-flag-mismatch.patch| 11 
>  .../arc-2016.03/200-arc-fix-target-mask.patch  | 13 +
>  7 files changed, 98 insertions(+), 2 deletions(-)
>  rename package/devel/gdb/patches/{ => 
> 7.11}/001-gdb-pr14523-mips-signal-number.patch (100%)
>  rename package/devel/gdb/patches/{ => 7.11}/100-musl_fix.patch (100%)
>  create mode 100644 
> package/devel/gdb/patches/arc-2016.03/100-no_extern_inline.patch
>  create mode 100644 
> package/devel/gdb/patches/arc-2016.03/110-no_testsuite.patch
>  create mode 100644 
> package/devel/gdb/patches/arc-2016.03/120-fix-compile-flag-mismatch.patch
>  create mode 100644 
> package/devel/gdb/patches/arc-2016.03/200-arc-fix-target-mask.patch
> 
> diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile
> index f6d5fec..2e6b332 100644
> --- a/package/devel/gdb/Makefile
> +++ b/package/devel/gdb/Makefile
> @@ -8,12 +8,27 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=gdb
> +
> +ifeq ($(CONFIG_arc),y)
> +PKG_VERSION:=arc-2016.03-gdb
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> +PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_VERSION)
> +PKG_MD5SUM:=775caaf6385c16f20b6f53c0a2b95f79
> +GDB_DIR:=binutils-$(PKG_NAME)-$(PKG_VERSION)
> +else
>  PKG_VERSION:=7.11
> -PKG_RELEASE:=1
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@GNU/gdb
>  PKG_MD5SUM:=b5c784685e1cde65ba135feea86b6d75
> +GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION)
> +endif
> +
> +PKG_RELEASE:=1
> +
> +PATCH_DIR:=./patches/$(PKG_VERSION)
> +PKG_BUILD_DIR:=$(BUILD_DIR)/$(GDB_DIR)
>  
>  PKG_BUILD_PARALLEL:=1
>  PKG_INSTALL:=1
> @@ -55,7 +70,11 @@ CONFIGURE_ARGS+= \
>   --with-system-readline \
>   --without-expat \
>   --without-lzma \
> - --disable-werror
> + --disable-werror \
> + --disable-binutils \
> + --disable-ld \
> + --disable-gas \
> + --disable-sim
>  
>  CONFIGURE_VARS+= \
>   ac_cv_search_tgetent="$(TARGET_LDFLAGS) -lncurses -lreadline"
> diff --git 
> a/package/devel/gdb/patches/001-gdb-pr14523-mips-signal-number.patch 
> b/package/devel/gdb/patches/7.11/001-gdb-pr14523-mips-signal-number.patch
> similarity index 100%
> rename from package/devel/gdb/patches/001-gdb-pr14523-mips-signal-number.patch
> rename to 
> package/devel/gdb/patches/7.11/001-gdb-pr14523-mips-signal-number.patch
> diff --git a/package/devel/gdb/patches/100-musl_fix.patch 
> b/package/devel/gdb/patches/7.11/100-musl_fix.patch
> similarity index 100%
> rename from package/devel/gdb/patches/100-musl_fix.patch
> rename to package/devel/gdb/patches/7.11/100-musl_fix.patch
> diff --git a/package/devel/gdb/patches/arc-2016.03/100-no_extern_inline.patch 
> b/package/devel/gdb/patches/arc-2016.03/100-no_extern_inline.patch
> new file mode 100644
> index 000..8c18c6e
> --- /dev/null
> +++ b/package/devel/gdb/patches/arc-2016.03/100-no_extern_inline.patch
> @@ -0,0 +1,32 @@
> +--- 

Re: [OpenWrt-Devel] [LEDE-DEV] [PATCH libubox] blobmsg_json: add new functions blobmsg_format_json_value*

2016-06-03 Thread John Crispin


On 01/06/2016 22:27, Matthias Schiffer wrote:
> The current blobmsg_format_json* functions will return invalid JSON when
> the "list" argument is given as false (blobmsg_format_element() will
> output the name of the blob_attr as if the value is printed as part of a
> JSON object).
> 
> To avoid breaking software relying on this behaviour, introduce new
> functions which will never print the blob_attr name and thus always
> produce valid JSON.

what software relies on this function/behaviour ? maybe we should mark
the current implementation as deprected and drop support in time X.
producing broken json syntax seems very fragile.

John

> 
> Signed-off-by: Matthias Schiffer 
> ---
>  blobmsg_json.c | 49 -
>  blobmsg_json.h | 14 ++
>  2 files changed, 50 insertions(+), 13 deletions(-)
> 
> diff --git a/blobmsg_json.c b/blobmsg_json.c
> index 5713948..538c816 100644
> --- a/blobmsg_json.c
> +++ b/blobmsg_json.c
> @@ -207,7 +207,7 @@ static void blobmsg_format_string(struct strbuf *s, const 
> char *str)
>  
>  static void blobmsg_format_json_list(struct strbuf *s, struct blob_attr 
> *attr, int len, bool array);
>  
> -static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, 
> bool array, bool head)
> +static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, 
> bool without_name, bool head)
>  {
>   const char *data_str;
>   char buf[32];
> @@ -217,7 +217,7 @@ static void blobmsg_format_element(struct strbuf *s, 
> struct blob_attr *attr, boo
>   if (!blobmsg_check_attr(attr, false))
>   return;
>  
> - if (!array && blobmsg_name(attr)[0]) {
> + if (!without_name && blobmsg_name(attr)[0]) {
>   blobmsg_format_string(s, blobmsg_name(attr));
>   blobmsg_puts(s, ": ", s->indent ? 2 : 1);
>   }
> @@ -286,22 +286,26 @@ static void blobmsg_format_json_list(struct strbuf *s, 
> struct blob_attr *attr, i
>   blobmsg_puts(s, (array ? "]" : "}"), 1);
>  }
>  
> +static void setup_strbuf(struct strbuf *s, struct blob_attr *attr, 
> blobmsg_json_format_t cb, void *priv, int indent) {
> + s->len = blob_len(attr);
> + s->buf = malloc(s->len);
> + s->pos = 0;
> + s->custom_format = cb;
> + s->priv = priv;
> + s->indent = false;
> +
> + if (indent >= 0) {
> + s->indent = true;
> + s->indent_level = indent;
> + }
> +}
> +
>  char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, 
> blobmsg_json_format_t cb, void *priv, int indent)
>  {
>   struct strbuf s;
>   bool array;
>  
> - s.len = blob_len(attr);
> - s.buf = malloc(s.len);
> - s.pos = 0;
> - s.custom_format = cb;
> - s.priv = priv;
> - s.indent = false;
> -
> - if (indent >= 0) {
> - s.indent = true;
> - s.indent_level = indent;
> - }
> + setup_strbuf(, attr, cb, priv, indent);
>  
>   array = blob_is_extended(attr) &&
>   blobmsg_type(attr) == BLOBMSG_TYPE_ARRAY;
> @@ -321,3 +325,22 @@ char *blobmsg_format_json_with_cb(struct blob_attr 
> *attr, bool list, blobmsg_jso
>  
>   return s.buf;
>  }
> +
> +char *blobmsg_format_json_value_with_cb(struct blob_attr *attr, 
> blobmsg_json_format_t cb, void *priv, int indent)
> +{
> + struct strbuf s;
> +
> + setup_strbuf(, attr, cb, priv, indent);
> +
> + blobmsg_format_element(, attr, true, false);
> +
> + if (!s.len) {
> + free(s.buf);
> + return NULL;
> + }
> +
> + s.buf = realloc(s.buf, s.pos + 1);
> + s.buf[s.pos] = 0;
> +
> + return s.buf;
> +}
> diff --git a/blobmsg_json.h b/blobmsg_json.h
> index cd9ed33..9dfc02d 100644
> --- a/blobmsg_json.h
> +++ b/blobmsg_json.h
> @@ -42,4 +42,18 @@ static inline char *blobmsg_format_json_indent(struct 
> blob_attr *attr, bool list
>   return blobmsg_format_json_with_cb(attr, list, NULL, NULL, indent);
>  }
>  
> +char *blobmsg_format_json_value_with_cb(struct blob_attr *attr,
> + blobmsg_json_format_t cb, void *priv,
> + int indent);
> +
> +static inline char *blobmsg_format_json_value(struct blob_attr *attr)
> +{
> + return blobmsg_format_json_value_with_cb(attr, NULL, NULL, -1);
> +}
> +
> +static inline char *blobmsg_format_json_value_indent(struct blob_attr *attr, 
> int indent)
> +{
> + return blobmsg_format_json_value_with_cb(attr, NULL, NULL, indent);
> +}
> +
>  #endif
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel