about summary refs log tree commit diff
path: root/mdstat.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2024-06-07 12:27:29 +0200
committerLeah Neukirchen <leah@vuxu.org>2024-06-07 12:27:29 +0200
commit6b2d87eef41a3cee1dccca431dc4575fe4ce5cef (patch)
treeae950a7e85d27ac5e87e5edfc0d3f1df8ac26ddf /mdstat.c
parent787ccd83d19d33de90db3df1554c4d05de2c30f4 (diff)
downloadnano-exporter-6b2d87eef41a3cee1dccca431dc4575fe4ce5cef.tar.gz
nano-exporter-6b2d87eef41a3cee1dccca431dc4575fe4ce5cef.tar.xz
nano-exporter-6b2d87eef41a3cee1dccca431dc4575fe4ce5cef.zip
move read_file_at to util.c
Diffstat (limited to 'mdstat.c')
-rw-r--r--mdstat.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/mdstat.c b/mdstat.c
index bc8b62a..d2567a4 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -19,24 +19,6 @@ const struct collector mdstat_collector = {
   .collect = mdstat_collect,
 };
 
-static ssize_t
-read_file_at(int dirfd, char *pathname, char *buf, size_t bufsiz) {
-  int fd = openat(dirfd, pathname, O_RDONLY);
-  if (fd < 0)
-    return -1;
-
-  ssize_t r = read(fd, buf, bufsiz - 1);
-  close(fd);
-  if (r < 0)
-    return -1;
-
-  if (buf[r-1] == '\n')
-    r--;
-
-  buf[r] = 0;
-  return r;
-}
-
 void
 scrape_write_md_label(scrape_req *req, char *name, char *md, char *label, char *value, double d) {
   struct label labels[] = {