From 501bb7d052f5b41a6bbb0dad1db611f5b527cafc Mon Sep 17 00:00:00 2001 From: Jonathan Flat Date: Tue, 28 Oct 2025 22:30:47 -0600 Subject: [PATCH] Remove commented-out code for future directions --- Sources/System/FileSystem/Identifiers.swift | 22 ------- Sources/System/FileSystem/Stat.swift | 64 --------------------- Sources/System/Internals/Exports.swift | 13 ----- 3 files changed, 99 deletions(-) diff --git a/Sources/System/FileSystem/Identifiers.swift b/Sources/System/FileSystem/Identifiers.swift index 7620b60..ca2835e 100644 --- a/Sources/System/FileSystem/Identifiers.swift +++ b/Sources/System/FileSystem/Identifiers.swift @@ -62,28 +62,6 @@ public struct DeviceID: RawRepresentable, Sendable, Hashable, Codable { /// Creates a strongly-typed `DeviceID` from the raw C value. @_alwaysEmitIntoClient public init(_ rawValue: CInterop.DeviceID) { self.rawValue = rawValue } - - // TODO: API review for ID wrapper functionality - -// /// Creates a `DeviceID` from the given major and minor device numbers. -// /// -// /// The corresponding C function is `makedev()`. -// @_alwaysEmitIntoClient -// private static func make(major: CUnsignedInt, minor: CUnsignedInt) -> DeviceID { -// DeviceID(rawValue: system_makedev(major, minor)) -// } -// -// /// The major device number -// /// -// /// The corresponding C function is `major()`. -// @_alwaysEmitIntoClient -// private var major: CInt { system_major(rawValue) } -// -// /// The minor device number -// /// -// /// The corresponding C function is `minor()`. -// @_alwaysEmitIntoClient -// private var minor: CInt { system_minor(rawValue) } } /// A Swift wrapper of the C `ino_t` type. diff --git a/Sources/System/FileSystem/Stat.swift b/Sources/System/FileSystem/Stat.swift index 31243e6..f31fa5d 100644 --- a/Sources/System/FileSystem/Stat.swift +++ b/Sources/System/FileSystem/Stat.swift @@ -85,17 +85,6 @@ public struct Stat: RawRepresentable, Sendable { @available(macOS 26.0, iOS 26.0, tvOS 26.0, watchOS 26.0, visionOS 26.0, *) public static var resolveBeneath: Flags { Flags(rawValue: _AT_RESOLVE_BENEATH) } #endif - - // TODO: Re-enable when _GNU_SOURCE can be defined. -// #if os(FreeBSD) || os(Linux) || os(Android) -// /// If the path is an empty string (or `NULL` since Linux 6.11), -// /// return information about the given file descriptor. -// /// -// /// The corresponding C constant is `AT_EMPTY_PATH`. -// /// - Note: Only available on FreeBSD, Linux, and Android. -// @_alwaysEmitIntoClient -// public static var emptyPath: Flags { Flags(rawValue: _AT_EMPTY_PATH) } -// #endif } // MARK: Initializers @@ -520,59 +509,6 @@ public struct Stat: RawRepresentable, Sendable { } #endif - // TODO: Investigate changing time properties to UTCClock.Instant once available. - -// /// Time of last access, given as a `UTCClock.Instant` -// /// -// /// The corresponding C property is `st_atim` (or `st_atimespec` on Darwin). -// public var accessTime: UTCClock.Instant { -// get { -// UTCClock.systemEpoch.advanced(by: Duration(st_atim)) -// } -// set { -// st_atim = timespec(UTCClock.systemEpoch.duration(to: newValue)) -// } -// } -// -// /// Time of last modification, given as a `UTCClock.Instant` -// /// -// /// The corresponding C property is `st_mtim` (or `st_mtimespec` on Darwin). -// public var modificationTime: UTCClock.Instant { -// get { -// UTCClock.systemEpoch.advanced(by: Duration(st_mtim)) -// } -// set { -// st_mtim = timespec(UTCClock.systemEpoch.duration(to: newValue)) -// } -// } -// -// /// Time of last status (inode) change, given as a `UTCClock.Instant` -// /// -// /// The corresponding C property is `st_ctim` (or `st_ctimespec` on Darwin). -// public var changeTime: UTCClock.Instant { -// get { -// UTCClock.systemEpoch.advanced(by: Duration(st_ctim)) -// } -// set { -// st_ctim = timespec(UTCClock.systemEpoch.duration(to: newValue)) -// } -// } -// -// #if SYSTEM_PACKAGE_DARWIN || os(FreeBSD) -// /// Time of file creation, given as a `UTCClock.Instant` -// /// -// /// The corresponding C property is `st_birthtim` (or `st_birthtimespec` on Darwin). -// /// - Note: Only available on Darwin and FreeBSD. -// public var creationTime: UTCClock.Instant { -// get { -// UTCClock.systemEpoch.advanced(by: Duration(st_birthtim)) -// } -// set { -// st_birthtim = timespec(UTCClock.systemEpoch.duration(to: newValue)) -// } -// } -// #endif - #if SYSTEM_PACKAGE_DARWIN || os(FreeBSD) || os(OpenBSD) /// File flags /// diff --git a/Sources/System/Internals/Exports.swift b/Sources/System/Internals/Exports.swift index 025aefa..58d0db8 100644 --- a/Sources/System/Internals/Exports.swift +++ b/Sources/System/Internals/Exports.swift @@ -103,19 +103,6 @@ internal func system_fstat(_ fd: CInt, _ s: inout CInterop.Stat) -> Int32 { internal func system_fstatat(_ fd: CInt, _ p: UnsafePointer, _ s: inout CInterop.Stat, _ flags: CInt) -> Int32 { fstatat(fd, p, &s, flags) } - -@usableFromInline -internal func system_major(_ dev: CInterop.DeviceID) -> CInt { - numericCast((dev >> 24) & 0xff) -} -@usableFromInline -internal func system_minor(_ dev: CInterop.DeviceID) -> CInt { - numericCast(dev & 0xffffff) -} -@usableFromInline -internal func system_makedev(_ maj: CUnsignedInt, _ min: CUnsignedInt) -> CInterop.DeviceID { - CInterop.DeviceID((maj << 24) | min) -} #endif // Convention: `system_platform_foo` is a