summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev.c25
-rw-r--r--dev.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/dev.c b/dev.c
index cf8d643..5a43643 100644
--- a/dev.c
+++ b/dev.c
@@ -124,6 +124,31 @@ int device_address(const char *ifname, int af, struct sockaddr_storage *ss)
return ret;
}
+int device_hw_address(const char *ifname, uint8_t *addr, size_t len)
+{
+ int ret, sock;
+ struct ifreq ifr;
+
+ if (!addr)
+ return -EINVAL;
+ if (len < IFHWADDRLEN)
+ return -ENOSPC;
+ if (!strncmp("any", ifname, strlen("any")))
+ return -EINVAL;
+
+ sock = af_socket(AF_INET);
+
+ memset(&ifr, 0, sizeof(ifr));
+ strlcpy(ifr.ifr_name, ifname, IFNAMSIZ);
+
+ ret = ioctl(sock, SIOCGIFHWADDR, &ifr);
+ if (!ret)
+ memcpy(addr, &ifr.ifr_hwaddr.sa_data[0], IFHWADDRLEN);
+
+ close(sock);
+ return ret;
+}
+
size_t device_mtu(const char *ifname)
{
size_t mtu = 0;
diff --git a/dev.h b/dev.h
index a9e4ccf..06e51d2 100644
--- a/dev.h
+++ b/dev.h
@@ -7,6 +7,7 @@
extern size_t device_mtu(const char *ifname);
extern int device_address(const char *ifname, int af, struct sockaddr_storage *ss);
extern int __device_ifindex(const char *ifname);
+extern int device_hw_address(const char *ifname, uint8_t *addr, size_t len);
extern int device_ifindex(const char *ifname);
extern int device_type(const char *ifname);
extern short device_get_flags(const char *ifname);
nfs_fop_write+0x17c/0x250 __vfs_write+0x6c/0x1e0 vfs_write+0xd0/0x270 SyS_write+0x6c/0x110 system_call+0x38/0xe0 Examination of the queue showed a single reference (no PERCPU_COUNT_BIAS, and __PERCPU_REF_DEAD, __PERCPU_REF_ATOMIC set) and no requests. However, conditions at the time of the race are count of PERCPU_COUNT_BIAS + 0 and __PERCPU_REF_DEAD and __PERCPU_REF_ATOMIC set. The fix is to make the tryget routines use an actual boolean internally instead of the atomic long result truncated to a int. Fixes: e625305b3907 percpu-refcount: make percpu_ref based on longs instead of ints Link: https://bugzilla.kernel.org/show_bug.cgi?id=190751 Signed-off-by: Douglas Miller <dougmill@linux.vnet.ibm.com> Reviewed-by: Jens Axboe <axboe@fb.com> Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: e625305b3907 ("percpu-refcount: make percpu_ref based on longs instead of ints") Cc: stable@vger.kernel.org # v3.18+
Diffstat (limited to 'include/dt-bindings/clock/exynos3250.h')