什么是 USEC_INITIALIZED 属性?
What is USEC_INITIALIZED property?
我得到 udevadm info -q property -n /dev/sda
的以下输出
DEVLINKS=/dev/disk/by-path/pci-0000:00:1f.2-ata-1 /dev/disk/by-id/wwn-0x5000c500a90b2880 /dev/disk/by-id/ata-ST500LM021-1KJ152_W62GX4GF
DEVNAME=/dev/sda
DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda
DEVTYPE=disk
ID_ATA=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=128
ID_ATA_FEATURE_SET_APM_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=78
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=78
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_ROTATION_RATE_RPM=7200
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_MODEL=ST500LM021-1KJ152
ID_MODEL_ENC=ST500LM021-1KJ152\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PART_TABLE_TYPE=gpt
ID_PART_TABLE_UUID=f8f58152-5c2e-4c72-9b1a-8bdde0e1c8ee
ID_PATH=pci-0000:00:1f.2-ata-1
ID_PATH_TAG=pci-0000_00_1f_2-ata-1
ID_REVISION=0005SDM1
ID_SERIAL=ST500LM021-1KJ152_W62GX4GF
ID_SERIAL_SHORT=W62GX4GF
ID_TYPE=disk
ID_WWN=0x5000c500a90b2880
ID_WWN_WITH_EXTENSION=0x5000c500a90b2880
MAJOR=8
MINOR=0
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=2694098
输出最后一行的USEC_INITIALIZED属性是什么。
是否只是连接设备和实际初始化设备之间的时间。
此外,如果是初始化时间,内核将如何知道设备何时初始化,因为对于不同类型的设备(例如:块设备、相机等),它会以不同的方式完成。
USEC_INITIALIZED
设置为设备注册到udevd时单调递增的系统时钟的值。这个时钟的保证是它永远不会倒退。它通常在启动时从 0 开始。这是函数,来自 systemd/src/libsystemd/sd-device/device-private.c
:
int device_ensure_usec_initialized(sd_device *device, sd_device *device_old) {
usec_t when;
assert(device);
if (device_old && device_old->usec_initialized > 0)
when = device_old->usec_initialized;
else
when = now(CLOCK_MONOTONIC);
return device_set_usec_initialized(device, when);
}
我得到 udevadm info -q property -n /dev/sda
DEVLINKS=/dev/disk/by-path/pci-0000:00:1f.2-ata-1 /dev/disk/by-id/wwn-0x5000c500a90b2880 /dev/disk/by-id/ata-ST500LM021-1KJ152_W62GX4GF
DEVNAME=/dev/sda
DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda
DEVTYPE=disk
ID_ATA=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=128
ID_ATA_FEATURE_SET_APM_ENABLED=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=78
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=78
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_ROTATION_RATE_RPM=7200
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_MODEL=ST500LM021-1KJ152
ID_MODEL_ENC=ST500LM021-1KJ152\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PART_TABLE_TYPE=gpt
ID_PART_TABLE_UUID=f8f58152-5c2e-4c72-9b1a-8bdde0e1c8ee
ID_PATH=pci-0000:00:1f.2-ata-1
ID_PATH_TAG=pci-0000_00_1f_2-ata-1
ID_REVISION=0005SDM1
ID_SERIAL=ST500LM021-1KJ152_W62GX4GF
ID_SERIAL_SHORT=W62GX4GF
ID_TYPE=disk
ID_WWN=0x5000c500a90b2880
ID_WWN_WITH_EXTENSION=0x5000c500a90b2880
MAJOR=8
MINOR=0
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=2694098
输出最后一行的USEC_INITIALIZED属性是什么。
是否只是连接设备和实际初始化设备之间的时间。
此外,如果是初始化时间,内核将如何知道设备何时初始化,因为对于不同类型的设备(例如:块设备、相机等),它会以不同的方式完成。
USEC_INITIALIZED
设置为设备注册到udevd时单调递增的系统时钟的值。这个时钟的保证是它永远不会倒退。它通常在启动时从 0 开始。这是函数,来自 systemd/src/libsystemd/sd-device/device-private.c
:
int device_ensure_usec_initialized(sd_device *device, sd_device *device_old) {
usec_t when;
assert(device);
if (device_old && device_old->usec_initialized > 0)
when = device_old->usec_initialized;
else
when = now(CLOCK_MONOTONIC);
return device_set_usec_initialized(device, when);
}