nilfs-utils/include/lookup_device.h
Ryusuke Konishi fb146a5345 lib: add helper files to resolve device name from sysfs
Add a new helper function, nilfs_lookup_device(), to resolve the kernel
device name (e.g. "sda1") associated with a filesystem node (file or
directory).

This function internally uses a static helper,
nilfs_get_devname_by_devid(), which reads the symlink at
/sys/dev/block/<major>:<minor> to identify the canonical device name
from a device ID.

These helpers are separated into a standalone module to allow sharing
the logic between the nilfs library and other utilities (e.g.
nilfs-clean) without exposing internal symbols in the public API.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2026-01-21 20:53:35 +09:00

12 lines
267 B
C

/*
* lookup_device.h - Internal header for device lookup helper
*
* This file is not exported to users.
*/
#ifndef NILFS_LOOKUP_DEVICE_H
#define NILFS_LOOKUP_DEVICE_H
int nilfs_lookup_device(const char *node, char **devpath);
#endif /* NILFS_LOOKUP_DEVICE_H */