* [Buildroot] [PATCH 1/1] bridge-utils: add upstream patch fixing sysfs writes
@ 2015-10-15 14:16 Thomas De Schampheleire
2015-10-15 14:20 ` Baruch Siach
0 siblings, 1 reply; 5+ messages in thread
From: Thomas De Schampheleire @ 2015-10-15 14:16 UTC (permalink / raw)
To: buildroot
From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Add upstream patch that fixes a sysfs path in br_set.
The patch is on top of the latest release 1.5, which already dates from
2011.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
package/bridge-utils/0003-sysfs-write-fixes.patch | 79 +++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 package/bridge-utils/0003-sysfs-write-fixes.patch
diff --git a/package/bridge-utils/0003-sysfs-write-fixes.patch b/package/bridge-utils/0003-sysfs-write-fixes.patch
new file mode 100644
index 0000000..2f36209
--- /dev/null
+++ b/package/bridge-utils/0003-sysfs-write-fixes.patch
@@ -0,0 +1,79 @@
+commit bb9970a9df95837e39d680021b1f73d231e85406
+Author: Stephen Hemminger <shemminger@vyatta.com>
+Date: Tue May 3 09:52:43 2011 -0700
+
+ Check error returns from write to sysfs
+
+ Add helper function to check write to sysfs files.
+
+
+[tdescham: this patch also fixes an incorrect path in br_set]
+
+diff --git a/libbridge/libbridge_devif.c b/libbridge/libbridge_devif.c
+index aa8bc36..1e83925 100644
+--- a/libbridge/libbridge_devif.c
++++ b/libbridge/libbridge_devif.c
+@@ -280,25 +280,38 @@ fallback:
+ return old_get_port_info(brname, port, info);
+ }
+
++static int set_sysfs(const char *path, unsigned long value)
++{
++ int fd, ret = 0, cc;
++ char buf[32];
++
++ fd = open(path, O_WRONLY);
++ if (fd < 0)
++ return -1;
++
++ cc = snprintf(buf, sizeof(buf), "%lu\n", value);
++ if (write(fd, buf, cc) < 0)
++ ret = -1;
++ close(fd);
++
++ return ret;
++}
++
+
+ static int br_set(const char *bridge, const char *name,
+ unsigned long value, unsigned long oldcode)
+ {
+ int ret;
+ char path[SYSFS_PATH_MAX];
+- FILE *f;
+
+- snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/%s", bridge, name);
++ snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/bridge/%s",
++ bridge, name);
+
+- f = fopen(path, "w");
+- if (f) {
+- ret = fprintf(f, "%ld\n", value);
+- fclose(f);
+- } else {
++ if ((ret = set_sysfs(path, value)) < 0) {
+ /* fallback to old ioctl */
+ struct ifreq ifr;
+ unsigned long args[4] = { oldcode, value, 0, 0 };
+-
++
+ strncpy(ifr.ifr_name, bridge, IFNAMSIZ);
+ ifr.ifr_data = (char *) &args;
+ ret = ioctl(br_socket_fd, SIOCDEVPRIVATE, &ifr);
+@@ -348,14 +361,10 @@ static int port_set(const char *bridge, const char *ifname,
+ {
+ int ret;
+ char path[SYSFS_PATH_MAX];
+- FILE *f;
+
+ snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brport/%s", ifname, name);
+- f = fopen(path, "w");
+- if (f) {
+- ret = fprintf(f, "%ld\n", value);
+- fclose(f);
+- } else {
++
++ if ((ret = set_sysfs(path, value)) < 0) {
+ int index = get_portno(bridge, ifname);
+
+ if (index < 0)
--
1.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/1] bridge-utils: add upstream patch fixing sysfs writes
2015-10-15 14:16 [Buildroot] [PATCH 1/1] bridge-utils: add upstream patch fixing sysfs writes Thomas De Schampheleire
@ 2015-10-15 14:20 ` Baruch Siach
2015-10-15 14:31 ` Thomas De Schampheleire
0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2015-10-15 14:20 UTC (permalink / raw)
To: buildroot
Hi Thomas,
On Thu, Oct 15, 2015 at 04:16:19PM +0200, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>
> Add upstream patch that fixes a sysfs path in br_set.
> The patch is on top of the latest release 1.5, which already dates from
> 2011.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
> package/bridge-utils/0003-sysfs-write-fixes.patch | 79 +++++++++++++++++++++++
> 1 file changed, 79 insertions(+)
> create mode 100644 package/bridge-utils/0003-sysfs-write-fixes.patch
>
> diff --git a/package/bridge-utils/0003-sysfs-write-fixes.patch b/package/bridge-utils/0003-sysfs-write-fixes.patch
> new file mode 100644
> index 0000000..2f36209
> --- /dev/null
> +++ b/package/bridge-utils/0003-sysfs-write-fixes.patch
> @@ -0,0 +1,79 @@
> +commit bb9970a9df95837e39d680021b1f73d231e85406
> +Author: Stephen Hemminger <shemminger@vyatta.com>
> +Date: Tue May 3 09:52:43 2011 -0700
> +
> + Check error returns from write to sysfs
> +
> + Add helper function to check write to sysfs files.
> +
> +
> +[tdescham: this patch also fixes an incorrect path in br_set]
Your sign-off on this patch is missing.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/1] bridge-utils: add upstream patch fixing sysfs writes
2015-10-15 14:20 ` Baruch Siach
@ 2015-10-15 14:31 ` Thomas De Schampheleire
2015-10-15 14:33 ` Baruch Siach
2015-10-15 20:55 ` Peter Korsgaard
0 siblings, 2 replies; 5+ messages in thread
From: Thomas De Schampheleire @ 2015-10-15 14:31 UTC (permalink / raw)
To: buildroot
On Thu, Oct 15, 2015 at 4:20 PM, Baruch Siach <baruch@tkos.co.il> wrote:
> Hi Thomas,
>
> On Thu, Oct 15, 2015 at 04:16:19PM +0200, Thomas De Schampheleire wrote:
>> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>>
>> Add upstream patch that fixes a sysfs path in br_set.
>> The patch is on top of the latest release 1.5, which already dates from
>> 2011.
>>
>> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>> ---
>> package/bridge-utils/0003-sysfs-write-fixes.patch | 79 +++++++++++++++++++++++
>> 1 file changed, 79 insertions(+)
>> create mode 100644 package/bridge-utils/0003-sysfs-write-fixes.patch
>>
>> diff --git a/package/bridge-utils/0003-sysfs-write-fixes.patch b/package/bridge-utils/0003-sysfs-write-fixes.patch
>> new file mode 100644
>> index 0000000..2f36209
>> --- /dev/null
>> +++ b/package/bridge-utils/0003-sysfs-write-fixes.patch
>> @@ -0,0 +1,79 @@
>> +commit bb9970a9df95837e39d680021b1f73d231e85406
>> +Author: Stephen Hemminger <shemminger@vyatta.com>
>> +Date: Tue May 3 09:52:43 2011 -0700
>> +
>> + Check error returns from write to sysfs
>> +
>> + Add helper function to check write to sysfs files.
>> +
>> +
>> +[tdescham: this patch also fixes an incorrect path in br_set]
>
> Your sign-off on this patch is missing.
Is that also necessary for untouched, imported patches?
(I've been out of buildroot development for a while :-o)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/1] bridge-utils: add upstream patch fixing sysfs writes
2015-10-15 14:31 ` Thomas De Schampheleire
@ 2015-10-15 14:33 ` Baruch Siach
2015-10-15 20:55 ` Peter Korsgaard
1 sibling, 0 replies; 5+ messages in thread
From: Baruch Siach @ 2015-10-15 14:33 UTC (permalink / raw)
To: buildroot
Hi Thomas,
On Thu, Oct 15, 2015 at 04:31:16PM +0200, Thomas De Schampheleire wrote:
> On Thu, Oct 15, 2015 at 4:20 PM, Baruch Siach <baruch@tkos.co.il> wrote:
> > On Thu, Oct 15, 2015 at 04:16:19PM +0200, Thomas De Schampheleire wrote:
> >> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> >>
> >> Add upstream patch that fixes a sysfs path in br_set.
> >> The patch is on top of the latest release 1.5, which already dates from
> >> 2011.
> >>
> >> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> >> ---
> >> package/bridge-utils/0003-sysfs-write-fixes.patch | 79 +++++++++++++++++++++++
> >> 1 file changed, 79 insertions(+)
> >> create mode 100644 package/bridge-utils/0003-sysfs-write-fixes.patch
> >>
> >> diff --git a/package/bridge-utils/0003-sysfs-write-fixes.patch b/package/bridge-utils/0003-sysfs-write-fixes.patch
> >> new file mode 100644
> >> index 0000000..2f36209
> >> --- /dev/null
> >> +++ b/package/bridge-utils/0003-sysfs-write-fixes.patch
> >> @@ -0,0 +1,79 @@
> >> +commit bb9970a9df95837e39d680021b1f73d231e85406
> >> +Author: Stephen Hemminger <shemminger@vyatta.com>
> >> +Date: Tue May 3 09:52:43 2011 -0700
> >> +
> >> + Check error returns from write to sysfs
> >> +
> >> + Add helper function to check write to sysfs files.
> >> +
> >> +
> >> +[tdescham: this patch also fixes an incorrect path in br_set]
> >
> > Your sign-off on this patch is missing.
>
> Is that also necessary for untouched, imported patches?
>
> (I've been out of buildroot development for a while :-o)
Yes. It's a legal statement. See
http://elinux.org/Developer_Certificate_Of_Origin.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/1] bridge-utils: add upstream patch fixing sysfs writes
2015-10-15 14:31 ` Thomas De Schampheleire
2015-10-15 14:33 ` Baruch Siach
@ 2015-10-15 20:55 ` Peter Korsgaard
1 sibling, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2015-10-15 20:55 UTC (permalink / raw)
To: buildroot
>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin@gmail.com> writes:
> Is that also necessary for untouched, imported patches?
Yes.
> (I've been out of buildroot development for a while :-o)
Welcome back! ;)
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-15 20:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 14:16 [Buildroot] [PATCH 1/1] bridge-utils: add upstream patch fixing sysfs writes Thomas De Schampheleire
2015-10-15 14:20 ` Baruch Siach
2015-10-15 14:31 ` Thomas De Schampheleire
2015-10-15 14:33 ` Baruch Siach
2015-10-15 20:55 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox