summaryrefslogtreecommitdiff
path: root/src/basic/stat-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-04-13 15:38:21 +0200
committerLennart Poettering <lennart@poettering.net>2022-04-13 16:26:31 +0200
commit7176f06c9efea4b86f3f55e448fc80e16d43e54b (patch)
tree7143992013c291f643297d98ff003bf4bfbeaa1f /src/basic/stat-util.h
parentc87c30780624df257ed96909a2286b2b933f8c44 (diff)
downloadsystemd-7176f06c9efea4b86f3f55e448fc80e16d43e54b.tar.gz
basic: split out dev_t related calls into new devno-util.[ch]
No actual code changes, just splitting out of some dev_t handling related calls from stat-util.[ch], they are quite a number already, and deserve their own module now I think. Also, try to settle on the name "devnum" as the name for the concept, instead of "devno" or "dev" or "devid". "devnum" is the name exported in udev APIs, hence probably best to stick to that. (this just renames a few symbols to "devum", local variables are left untouched, to make the patch not too invasive) No actual code changes.
Diffstat (limited to 'src/basic/stat-util.h')
-rw-r--r--src/basic/stat-util.h29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h
index 37513a43e7..4483ceb7de 100644
--- a/src/basic/stat-util.h
+++ b/src/basic/stat-util.h
@@ -71,29 +71,6 @@ int fd_verify_regular(int fd);
int stat_verify_directory(const struct stat *st);
int fd_verify_directory(int fd);
-/* glibc and the Linux kernel have different ideas about the major/minor size. These calls will check whether the
- * specified major is valid by the Linux kernel's standards, not by glibc's. Linux has 20bits of minor, and 12 bits of
- * major space. See MINORBITS in linux/kdev_t.h in the kernel sources. (If you wonder why we define _y here, instead of
- * comparing directly >= 0: it's to trick out -Wtype-limits, which would otherwise complain if the type is unsigned, as
- * such a test would be pointless in such a case.) */
-
-#define DEVICE_MAJOR_VALID(x) \
- ({ \
- typeof(x) _x = (x), _y = 0; \
- _x >= _y && _x < (UINT32_C(1) << 12); \
- \
- })
-
-#define DEVICE_MINOR_VALID(x) \
- ({ \
- typeof(x) _x = (x), _y = 0; \
- _x >= _y && _x < (UINT32_C(1) << 20); \
- })
-
-int device_path_make_major_minor(mode_t mode, dev_t devno, char **ret);
-int device_path_make_canonical(mode_t mode, dev_t devno, char **ret);
-int device_path_parse_major_minor(const char *path, mode_t *ret_mode, dev_t *ret_devno);
-
int proc_mounted(void);
bool stat_inode_same(const struct stat *a, const struct stat *b);
@@ -119,9 +96,3 @@ int statx_fallback(int dfd, const char *path, int flags, unsigned mask, struct s
struct new_statx nsx; \
} var
#endif
-
-static inline bool devid_set_and_equal(dev_t a, dev_t b) {
- /* Returns true if a and b definitely refer to the same device. If either is zero, this means "don't
- * know" and we'll return false */
- return a == b && a != 0;
-}