Skip to content

Commit ea2fdd6

Browse files
committed
Replace Id with ID
1 parent b9449db commit ea2fdd6

File tree

8 files changed

+78
-56
lines changed

8 files changed

+78
-56
lines changed

Sources/System/FileStatus/FileStatus.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public struct FileStatus: RawRepresentable {
2121
@_alwaysEmitIntoClient
2222
public init(rawValue: CInterop.Stat) { self.rawValue = rawValue }
2323

24-
// FIXME: replace with swift type DeviceId that splits out major/minor
25-
// FIXME: whats the difference between this and rDeviceId?
24+
// FIXME: replace with swift type DeviceID that splits out major/minor
25+
// FIXME: whats the difference between this and rDeviceID?
2626
/// ID of device containing file.
2727
@_alwaysEmitIntoClient
28-
public var deviceId: CInterop.DeviceId { rawValue.st_dev }
28+
public var deviceID: CInterop.DeviceID { rawValue.st_dev }
2929

3030
/// Mode of file.
3131
@_alwaysEmitIntoClient
@@ -41,16 +41,16 @@ public struct FileStatus: RawRepresentable {
4141

4242
/// User ID of the file.
4343
@_alwaysEmitIntoClient
44-
public var userId: CInterop.UserId { rawValue.st_uid }
44+
public var userID: CInterop.UserID { rawValue.st_uid }
4545

4646
/// Group ID of the file.
4747
@_alwaysEmitIntoClient
48-
public var groupId: CInterop.GroupId { rawValue.st_gid }
48+
public var groupID: CInterop.GroupID { rawValue.st_gid }
4949

50-
// FIXME: whats the difference between this and deviceId?
50+
// FIXME: whats the difference between this and deviceID?
5151
/// Device ID.
5252
@_alwaysEmitIntoClient
53-
public var rDeviceId: CInterop.DeviceId { rawValue.st_rdev }
53+
public var rDeviceID: CInterop.DeviceID { rawValue.st_rdev }
5454

5555
/// Time of last access.
5656
@_alwaysEmitIntoClient
@@ -86,7 +86,7 @@ public struct FileStatus: RawRepresentable {
8686

8787
/// File generation number.
8888
@_alwaysEmitIntoClient
89-
public var generation: CInterop.GenerationId { rawValue.st_gen }
89+
public var generationID: CInterop.GenerationID { rawValue.st_gen }
9090
}
9191

9292
#endif

Sources/System/FileStatus/FileStatusOperations.swift

+23-23
Original file line numberDiff line numberDiff line change
@@ -251,30 +251,30 @@ extension FileDescriptor {
251251
extension FilePath {
252252
@_alwaysEmitIntoClient
253253
public func chown(
254-
userId: CInterop.UserId,
255-
groupId: CInterop.GroupId,
254+
userID: CInterop.UserID,
255+
groupID: CInterop.GroupID,
256256
followSymlinks: Bool = true,
257257
retryOnInterrupt: Bool = true
258258
) throws {
259259
try _chown(
260-
userId: userId,
261-
groupId: groupId,
260+
userID: userID,
261+
groupID: groupID,
262262
followSymlinks: followSymlinks,
263263
retryOnInterrupt: retryOnInterrupt
264264
).get()
265265
}
266266

267267
@usableFromInline
268268
internal func _chown(
269-
userId: CInterop.UserId,
270-
groupId: CInterop.GroupId,
269+
userID: CInterop.UserID,
270+
groupID: CInterop.GroupID,
271271
followSymlinks: Bool,
272272
retryOnInterrupt: Bool
273273
) -> Result<Void, Errno> {
274274
let _chown = followSymlinks ? system_chown : system_lchown
275275
return withPlatformString { ptr in
276276
nothingOrErrno(retryOnInterrupt: retryOnInterrupt) {
277-
_chown(ptr, userId, groupId)
277+
_chown(ptr, userID, groupID)
278278
}
279279
}
280280
}
@@ -284,40 +284,40 @@ extension FilePath {
284284
extension FileDescriptor {
285285
@_alwaysEmitIntoClient
286286
public func fchown(
287-
userId: CInterop.UserId,
288-
groupId: CInterop.GroupId,
287+
userID: CInterop.UserID,
288+
groupID: CInterop.GroupID,
289289
retryOnInterrupt: Bool = true
290290
) throws {
291291
try _fchown(
292-
userId: userId,
293-
groupId: groupId,
292+
userID: userID,
293+
groupID: groupID,
294294
retryOnInterrupt: retryOnInterrupt
295295
).get()
296296
}
297297

298298
@usableFromInline
299299
internal func _fchown(
300-
userId: CInterop.UserId,
301-
groupId: CInterop.GroupId,
300+
userID: CInterop.UserID,
301+
groupID: CInterop.GroupID,
302302
retryOnInterrupt: Bool
303303
) -> Result<Void, Errno> {
304304
nothingOrErrno(retryOnInterrupt: retryOnInterrupt) {
305-
system_fchown(self.rawValue, userId, groupId)
305+
system_fchown(self.rawValue, userID, groupID)
306306
}
307307
}
308308

309309
@_alwaysEmitIntoClient
310310
public func fchownat(
311311
path: FilePath,
312-
userId: CInterop.UserId,
313-
groupId: CInterop.GroupId,
312+
userID: CInterop.UserID,
313+
groupID: CInterop.GroupID,
314314
fcntrl: FileDescriptor.ControlFlags,
315315
retryOnInterrupt: Bool = true
316316
) throws {
317317
try _fchownat(
318318
path: path,
319-
userId: userId,
320-
groupId: groupId,
319+
userID: userID,
320+
groupID: groupID,
321321
fcntrl: fcntrl,
322322
retryOnInterrupt: retryOnInterrupt
323323
).get()
@@ -326,14 +326,14 @@ extension FileDescriptor {
326326
@usableFromInline
327327
internal func _fchownat(
328328
path: FilePath,
329-
userId: CInterop.UserId,
330-
groupId: CInterop.GroupId,
329+
userID: CInterop.UserID,
330+
groupID: CInterop.GroupID,
331331
fcntrl: FileDescriptor.ControlFlags,
332332
retryOnInterrupt: Bool
333333
) -> Result<Void, Errno> {
334334
path.withPlatformString { ptr in
335335
nothingOrErrno(retryOnInterrupt: retryOnInterrupt) {
336-
system_fchownat(self.rawValue, ptr, userId, groupId, fcntrl.rawValue)
336+
system_fchownat(self.rawValue, ptr, userID, groupID, fcntrl.rawValue)
337337
}
338338
}
339339
}
@@ -457,7 +457,7 @@ extension FilePath {
457457
@_alwaysEmitIntoClient
458458
public func mknod(
459459
permissions: FilePermissions,
460-
device: CInterop.DeviceId,
460+
device: CInterop.DeviceID,
461461
retryOnInterrupt: Bool = true
462462
) throws {
463463
try _mknod(
@@ -470,7 +470,7 @@ extension FilePath {
470470
@usableFromInline
471471
internal func _mknod(
472472
permissions: FilePermissions,
473-
device: CInterop.DeviceId,
473+
device: CInterop.DeviceID,
474474
retryOnInterrupt: Bool
475475
) -> Result<Void, Errno> {
476476
withPlatformString { ptr in

Sources/System/Internals/CInterop.swift

+27-5
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,40 @@ public enum CInterop {
6565
#endif
6666

6767
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
68-
// FIXME: Document
68+
/// The C `stat` type.
6969
public typealias Stat = stat
70-
public typealias UserId = uid_t
71-
public typealias GroupId = gid_t
72-
public typealias DeviceId = dev_t
70+
71+
/// The C `uid_t` type.
72+
public typealias UserID = uid_t
73+
74+
/// The C `gid_t` type.
75+
public typealias GroupID = gid_t
76+
77+
/// The C `dev_t` type.
78+
public typealias DeviceID = dev_t
79+
80+
/// The C `nlink_t` type.
7381
public typealias NumberOfLinks = nlink_t
82+
83+
/// The C `ino_t` type.
7484
public typealias INodeNumber = ino_t
85+
86+
/// The C `timespec` type.
7587
public typealias TimeSpec = timespec
88+
89+
/// The C `off_t` type.
7690
public typealias Offset = off_t
91+
92+
/// The C `blkcnt_t` type.
7793
public typealias BlockCount = blkcnt_t
94+
95+
/// The C `blksize_t` type.
7896
public typealias BlockSize = blksize_t
79-
public typealias GenerationId = UInt32
97+
98+
/// The C `UInt32` type.
99+
public typealias GenerationID = UInt32
100+
101+
/// The C `UInt32` type.
80102
public typealias FileFlags = UInt32
81103
#endif
82104
}

Sources/System/Internals/Constants.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ internal var _SEEK_DATA: CInt { SEEK_DATA }
531531

532532
// MARK: - Mode Masks
533533
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
534-
// mode_t: xxxx ugs rwx rwx rwx
534+
// mode_t: type ugs rwx rwx rwx
535535
@_alwaysEmitIntoClient
536536
internal var _MODE_PERMISSIONS: CInterop.Mode { 0b0000_111_111_111_111 }
537537

Sources/System/Internals/Syscalls.swift

+19-19
Original file line numberDiff line numberDiff line change
@@ -219,51 +219,51 @@ internal func system_fchmodat(
219219
// chown
220220
internal func system_chown(
221221
_ path: UnsafePointer<CInterop.PlatformChar>?,
222-
_ userId: CInterop.UserId,
223-
_ groupId: CInterop.GroupId
222+
_ userID: CInterop.UserID,
223+
_ groupID: CInterop.GroupID
224224
) -> Int32 {
225225
#if ENABLE_MOCKING
226-
if mockingEnabled { return _mock(path, userId, groupId) }
226+
if mockingEnabled { return _mock(path, userID, groupID) }
227227
#endif
228-
return chown(path, userId, groupId)
228+
return chown(path, userID, groupID)
229229
}
230230

231231
// lchown
232232
internal func system_lchown(
233233
_ path: UnsafePointer<CInterop.PlatformChar>?,
234-
_ userId: CInterop.UserId,
235-
_ groupId: CInterop.GroupId
234+
_ userID: CInterop.UserID,
235+
_ groupID: CInterop.GroupID
236236
) -> Int32 {
237237
#if ENABLE_MOCKING
238-
if mockingEnabled { return _mock(path, userId, groupId) }
238+
if mockingEnabled { return _mock(path, userID, groupID) }
239239
#endif
240-
return lchown(path, userId, groupId)
240+
return lchown(path, userID, groupID)
241241
}
242242

243243
// fchown
244244
internal func system_fchown(
245245
_ fd: Int32,
246-
_ userId: CInterop.UserId,
247-
_ groupId: CInterop.GroupId
246+
_ userID: CInterop.UserID,
247+
_ groupID: CInterop.GroupID
248248
) -> Int32 {
249249
#if ENABLE_MOCKING
250-
if mockingEnabled { return _mock(fd, userId, groupId) }
250+
if mockingEnabled { return _mock(fd, userID, groupID) }
251251
#endif
252-
return fchown(fd, userId, groupId)
252+
return fchown(fd, userID, groupID)
253253
}
254254

255255
// fchownat
256256
internal func system_fchownat(
257257
_ fd: Int32,
258258
_ path: UnsafePointer<CInterop.PlatformChar>?,
259-
_ userId: CInterop.UserId,
260-
_ groupId: CInterop.GroupId,
259+
_ userID: CInterop.UserID,
260+
_ groupID: CInterop.GroupID,
261261
_ flag: Int32
262262
) -> Int32 {
263263
#if ENABLE_MOCKING
264-
if mockingEnabled { return _mock(fd, path, userId, groupId, flag) }
264+
if mockingEnabled { return _mock(fd, path, userID, groupID, flag) }
265265
#endif
266-
return fchownat(fd, path, userId, groupId, flag)
266+
return fchownat(fd, path, userID, groupID, flag)
267267
}
268268

269269
// chflags
@@ -324,12 +324,12 @@ internal func system_mkfifo(
324324
internal func system_mknod(
325325
_ path: UnsafePointer<CInterop.PlatformChar>?,
326326
_ mode: CInterop.Mode,
327-
_ deviceId: CInterop.DeviceId
327+
_ deviceID: CInterop.DeviceID
328328
) -> Int32 {
329329
#if ENABLE_MOCKING
330-
if mockingEnabled { return _mock(path, mode, deviceId) }
330+
if mockingEnabled { return _mock(path, mode, deviceID) }
331331
#endif
332-
return mknod(path, mode, deviceId)
332+
return mknod(path, mode, deviceID)
333333
}
334334

335335
// mkdir

0 commit comments

Comments
 (0)