mirror of
https://github.com/systemd/systemd.git
synced 2024-11-27 12:13:33 +08:00
homed: replace home-grown fs magic translation with fs_type_to_string()
This commit is contained in:
parent
66d39325d7
commit
7c604e89aa
@ -17,6 +17,7 @@
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "filesystems.h"
|
||||
#include "fs-util.h"
|
||||
#include "home-util.h"
|
||||
#include "homed-home-bus.h"
|
||||
@ -2466,19 +2467,6 @@ int home_get_disk_status(
|
||||
ret_access_mode);
|
||||
}
|
||||
|
||||
static const char *fstype_magic_to_name(statfs_f_type_t magic) {
|
||||
/* For now, let's only translate the magic values of the file systems we actually are able to manage */
|
||||
|
||||
if (F_TYPE_EQUAL(magic, EXT4_SUPER_MAGIC))
|
||||
return "ext4";
|
||||
if (F_TYPE_EQUAL(magic, XFS_SUPER_MAGIC))
|
||||
return "xfs";
|
||||
if (F_TYPE_EQUAL(magic, BTRFS_SUPER_MAGIC))
|
||||
return "btrfs";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int home_augment_status(
|
||||
Home *h,
|
||||
UserRecordLoadFlags flags,
|
||||
@ -2518,7 +2506,7 @@ int home_augment_status(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
fstype = fstype_magic_to_name(magic);
|
||||
fstype = fs_type_to_string(magic);
|
||||
|
||||
if (disk_floor == UINT64_MAX || (disk_usage != UINT64_MAX && disk_floor < disk_usage))
|
||||
disk_floor = disk_usage;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "copy.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "filesystems.h"
|
||||
#include "fs-util.h"
|
||||
#include "home-util.h"
|
||||
#include "homework-cifs.h"
|
||||
@ -704,14 +705,7 @@ static const char *file_system_type_fd(int fd) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (is_fs_type(&sfs, XFS_SB_MAGIC))
|
||||
return "xfs";
|
||||
if (is_fs_type(&sfs, EXT4_SUPER_MAGIC))
|
||||
return "ext4";
|
||||
if (is_fs_type(&sfs, BTRFS_SUPER_MAGIC))
|
||||
return "btrfs";
|
||||
|
||||
return NULL;
|
||||
return fs_type_to_string(sfs.f_type);
|
||||
}
|
||||
|
||||
int home_extend_embedded_identity(UserRecord *h, UserRecord *used, HomeSetup *setup) {
|
||||
|
Loading…
Reference in New Issue
Block a user