rename shell_len_or_place to _idx
This commit is contained in:
parent
2964c918cc
commit
93c6a1c12a
|
@ -220,7 +220,7 @@ const User = struct {
|
||||||
additional_gids_offset: u29,
|
additional_gids_offset: u29,
|
||||||
// shell is a different story, documented elsewhere.
|
// shell is a different story, documented elsewhere.
|
||||||
shell_here: u1,
|
shell_here: u1,
|
||||||
shell_len_or_place: u6,
|
shell_len_or_idx: u6,
|
||||||
homedir_len: u6,
|
homedir_len: u6,
|
||||||
username_is_a_suffix: u1,
|
username_is_a_suffix: u1,
|
||||||
username_offset_or_len: u5,
|
username_offset_or_len: u5,
|
||||||
|
@ -279,7 +279,7 @@ const ShellIndex = struct {
|
||||||
In the user's struct the `shell_here=true` bit signifies that the shell is
|
In the user's struct the `shell_here=true` bit signifies that the shell is
|
||||||
stored with userdata. `false` means it is stored in the `Shells` section. If
|
stored with userdata. `false` means it is stored in the `Shells` section. If
|
||||||
the shell is stored "here", it is the first element in `stringdata`, and it's
|
the shell is stored "here", it is the first element in `stringdata`, and it's
|
||||||
length is `shell_len_or_place`. If it is stored externally, the latter variable
|
length is `shell_len_or_idx`. If it is stored externally, the latter variable
|
||||||
points to it's index in the ShellIndex area.
|
points to it's index in the ShellIndex area.
|
||||||
|
|
||||||
Shells in the external storage are sorted by their weight, which is
|
Shells in the external storage are sorted by their weight, which is
|
||||||
|
|
10
src/user.zig
10
src/user.zig
|
@ -8,7 +8,7 @@ pub const PackedUser = packed struct {
|
||||||
gid: u32,
|
gid: u32,
|
||||||
additional_gids_offset: u29,
|
additional_gids_offset: u29,
|
||||||
shell_here: u1,
|
shell_here: u1,
|
||||||
shell_len_or_place: u6,
|
shell_len_or_idx: u6,
|
||||||
homedir_len: u6,
|
homedir_len: u6,
|
||||||
username_is_a_suffix: u1,
|
username_is_a_suffix: u1,
|
||||||
username_offset_or_len: u5,
|
username_offset_or_len: u5,
|
||||||
|
@ -44,13 +44,13 @@ pub const UserWriter = struct {
|
||||||
|
|
||||||
pub fn fromUser(self: *UserWriter, user: User) !PackedUser {
|
pub fn fromUser(self: *UserWriter, user: User) !PackedUser {
|
||||||
var shell_here: u1 = undefined;
|
var shell_here: u1 = undefined;
|
||||||
var shell_len_or_place: u6 = undefined;
|
var shell_len_or_idx: u6 = undefined;
|
||||||
if (self.shellIndexFn(user.shell)) |idx| {
|
if (self.shellIndexFn(user.shell)) |idx| {
|
||||||
shell_here = false;
|
shell_here = false;
|
||||||
shell_len_or_place = idx;
|
shell_len_or_idx = idx;
|
||||||
} else {
|
} else {
|
||||||
shell_here = true;
|
shell_here = true;
|
||||||
shell_len_or_place = user.shell.len;
|
shell_len_or_idx = user.shell.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
var puser = PackedUser{
|
var puser = PackedUser{
|
||||||
|
@ -58,7 +58,7 @@ pub const UserWriter = struct {
|
||||||
.gid = user.gid,
|
.gid = user.gid,
|
||||||
.additional_gids_offset = 0, // second pass
|
.additional_gids_offset = 0, // second pass
|
||||||
.shell_here = shell_here,
|
.shell_here = shell_here,
|
||||||
.shell_len_or_place = shell_len_or_place,
|
.shell_len_or_idx = shell_len_or_idx,
|
||||||
.homedir_len = undefined,
|
.homedir_len = undefined,
|
||||||
.username_is_a_suffix = undefined,
|
.username_is_a_suffix = undefined,
|
||||||
.username_offset_or_len = undefined,
|
.username_offset_or_len = undefined,
|
||||||
|
|
Loading…
Reference in New Issue