Implement Time Machine xattr support (Phase 4.1 complete)

This commit is contained in:
Warren
2026-06-22 15:30:44 +08:00
parent 3029327d5e
commit 5b0086f6f0

View File

@@ -94,6 +94,31 @@ pub async fn handle(
Access::Read => FILE_GENERIC_READ | FILE_GENERIC_EXECUTE,
Access::ReadWrite => FILE_ALL_ACCESS,
};
// Time Machine: set xattr on share root directory
if share.time_machine {
use crate::path::SmbPath;
let root_path = SmbPath::root();
// Generate UUID for this Time Machine backup
let uuid = uuid::Uuid::new_v4();
let uuid_bytes = uuid.as_bytes();
// Set com.apple.TimeMachine.SupportedFilesStoreUUID
share.backend.set_xattr(&root_path, "com.apple.TimeMachine.SupportedFilesStoreUUID", uuid_bytes).await.ok();
// Set com.apple.TimeMachine.SupportsThisDevice (1 = true)
share.backend.set_xattr(&root_path, "com.apple.TimeMachine.SupportsThisDevice", &[1]).await.ok();
// Set max_size if specified
if let Some(max_size) = share.time_machine_max_size {
let max_size_bytes = max_size.to_le_bytes();
share.backend.set_xattr(&root_path, "com.apple.TimeMachine.MaxSize", &max_size_bytes).await.ok();
}
tracing::info!(share = %share.name, uuid = %uuid, "Time Machine enabled");
}
let resp = TreeConnectResponse {
structure_size: 16,
share_type: if share.is_ipc {