Merge pull request #9928 from yuwata/libudev-cleanups

libudev: coding style updates
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-09-15 22:36:38 +02:00
committed by GitHub
15 changed files with 647 additions and 754 deletions
+36
View File
@@ -951,3 +951,39 @@ int mount_option_mangle(
return 0;
}
int dev_is_devtmpfs(void) {
_cleanup_fclose_ FILE *proc_self_mountinfo = NULL;
char line[LINE_MAX], *e;
int mount_id, r;
r = path_get_mnt_id("/dev", &mount_id);
if (r < 0)
return r;
proc_self_mountinfo = fopen("/proc/self/mountinfo", "re");
if (!proc_self_mountinfo)
return -errno;
(void) __fsetlocking(proc_self_mountinfo, FSETLOCKING_BYCALLER);
FOREACH_LINE(line, proc_self_mountinfo, return -errno) {
int mid;
if (sscanf(line, "%i", &mid) != 1)
continue;
if (mid != mount_id)
continue;
e = strstr(line, " - ");
if (!e)
continue;
/* accept any name that starts with the currently expected type */
if (startswith(e + 3, "devtmpfs"))
return true;
}
return false;
}
+2
View File
@@ -54,3 +54,5 @@ int mount_option_mangle(
unsigned long mount_flags,
unsigned long *ret_mount_flags,
char **ret_remaining_options);
int dev_is_devtmpfs(void);