ENH use central list for names/paths of filesystems

This commit is contained in:
Nathan Dwarshuis 2022-07-13 01:17:58 -04:00
parent f98cde448e
commit 5604df2eb6
3 changed files with 13 additions and 3 deletions

View File

@ -5,12 +5,14 @@ local geometry = require 'geometry'
local pure = require 'pure' local pure = require 'pure'
local impure = require 'impure' local impure = require 'impure'
return function(paths) return function(pathspecs)
local MODULE_Y = 170 local MODULE_Y = 170
local SPACING = 20 local SPACING = 20
local BAR_PAD = 100 local BAR_PAD = 100
local SEPARATOR_SPACING = 20 local SEPARATOR_SPACING = 20
local paths, names = table.unpack(pure.unzip(pathspecs))
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- header -- header
@ -49,7 +51,7 @@ return function(paths)
BAR_Y, BAR_Y,
geometry.SECTION_WIDTH, geometry.SECTION_WIDTH,
BAR_PAD, BAR_PAD,
{'root', 'boot', 'home', 'data', 'dcache', 'tmpfs'}, names,
SPACING, SPACING,
12, 12,
80 80

View File

@ -6,6 +6,7 @@ local sys = require 'sys'
return function(update_freq, devices) return function(update_freq, devices)
local PLOT_SEC_BREAK = 20 local PLOT_SEC_BREAK = 20
local PLOT_HEIGHT = 56 local PLOT_HEIGHT = 56
-- TODO currently this will find any block device
local DEVICE_PATHS = sys.get_disk_paths(devices) local DEVICE_PATHS = sys.get_disk_paths(devices)
local init_read_bytes, init_write_bytes = sys.get_total_disk_io(DEVICE_PATHS) local init_read_bytes, init_write_bytes = sys.get_total_disk_io(DEVICE_PATHS)

View File

@ -37,7 +37,14 @@ function conky_start(update_interval)
local update_freq = 1 / update_interval local update_freq = 1 / update_interval
local devices = {'sda', 'nvme0n1'} local devices = {'sda', 'nvme0n1'}
local battery = 'BAT0' local battery = 'BAT0'
local fs_paths = {'/', '/boot', '/home', '/mnt/data', '/mnt/dcache', "/tmp"} local fs_paths = {
{'/', 'root'},
{'/boot', 'boot'},
{'/home', 'home'},
{'/mnt/data', 'data'},
{'/mnt/dcache', 'dcache'},
{'/tmp', 'tmpfs'}
}
local mem = memory(update_freq) local mem = memory(update_freq)
local rw = readwrite(update_freq, devices) local rw = readwrite(update_freq, devices)