adding user
This commit is contained in:
parent
411fb91fd1
commit
1fe23aa1e5
@ -2,4 +2,5 @@ test "turbonss test suite" {
|
||||
_ = @import("main.zig");
|
||||
_ = @import("shell.zig");
|
||||
_ = @import("header.zig");
|
||||
_ = @import("user.zig");
|
||||
}
|
||||
|
20
src/user.zig
Normal file
20
src/user.zig
Normal file
@ -0,0 +1,20 @@
|
||||
const std = @import("std");
|
||||
|
||||
const PackedUserSize = @sizeOf(PackedUser);
|
||||
const PackedUser = packed struct {
|
||||
uid: u32,
|
||||
gid: u32,
|
||||
additional_gids_offset: u29,
|
||||
shell_here: u1,
|
||||
shell_len_or_place: u6,
|
||||
homedir_len: u6,
|
||||
username_is_a_suffix: u1,
|
||||
username_offset_or_len: u5,
|
||||
gecos_len: u8,
|
||||
};
|
||||
|
||||
const testing = std.testing;
|
||||
|
||||
test "PackedUser is byte-aligned" {
|
||||
//try testing.expectEqual(PackedUserSize * 8, @bitSizeOf(PackedUser));
|
||||
}
|
@ -1,34 +1,7 @@
|
||||
const std = @import("std");
|
||||
|
||||
const DB = struct {
|
||||
users: std.StringHashMap(User),
|
||||
groups: std.StringHashMap(Group),
|
||||
};
|
||||
|
||||
const Group = struct {
|
||||
gid: u32,
|
||||
name: []const u8,
|
||||
members: std.BufSet,
|
||||
};
|
||||
|
||||
const User = struct {
|
||||
uid: u32,
|
||||
gid: u32,
|
||||
name: []const u8,
|
||||
gecos: []const u8,
|
||||
home: []const u8,
|
||||
shell: []const u8,
|
||||
groups: std.BufSet,
|
||||
};
|
||||
|
||||
const PackedUser = packed struct {
|
||||
uid: u32,
|
||||
gid: u32,
|
||||
additional_gids_offset: u29,
|
||||
shell_here: u1,
|
||||
shell_len_or_place: u6,
|
||||
homedir_len: u6,
|
||||
username_is_a_suffix: u1,
|
||||
username_offset_or_len: u5,
|
||||
gecos_len: u8,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user