Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/linux: fix errors in dev_loop.txt #3121

Merged
merged 4 commits into from
May 5, 2022
Merged

sys/linux: fix errors in dev_loop.txt #3121

merged 4 commits into from
May 5, 2022

Conversation

ZHYfeng
Copy link
Contributor

@ZHYfeng ZHYfeng commented May 3, 2022

No description provided.

@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #3121 (14af96a) into master (2df221f) will increase coverage by 0.0%.
The diff coverage is n/a.

Impacted Files Coverage Δ
prog/checksum.go 74.1% <0.0%> (-13.6%) ⬇️
dashboard/app/main.go 71.4% <0.0%> (+0.7%) ⬆️
prog/any.go 84.5% <0.0%> (+1.0%) ⬆️
prog/mutation.go 88.8% <0.0%> (+1.0%) ⬆️
prog/hints.go 92.5% <0.0%> (+1.9%) ⬆️

@ZHYfeng
Copy link
Contributor Author

ZHYfeng commented May 3, 2022

Sorry that I try to have two merge requests because they are different things but Github directly adds the second commit.
What can I do about this?

sys/linux/dev_loop.txt Outdated Show resolved Hide resolved
sys/linux/dev_loop.txt Outdated Show resolved Hide resolved
@dvyukov
Copy link
Collaborator

dvyukov commented May 3, 2022

Sorry that I try to have two merge requests because they are different things but Github directly adds the second commit. What can I do about this?

We can merge 2 unrelated in a single PR as well as long as both commits are good.
But it's possible to send them as separate PRs as well. You need to have each commit in a separate branch in your fork. And then send PR from each branch.

@ZHYfeng
Copy link
Contributor Author

ZHYfeng commented May 4, 2022

Thanks a lot. I have fixed them.

@@ -22,12 +23,19 @@ resource fd_loop_ctrl[fd]
resource fd_loop_num[intptr]: 0, 1, 2, 10, 11, 12
openat$loop_ctrl(fd const[AT_FDCWD], file ptr[in, string["/dev/loop-control"]], flags flags[open_flags], mode const[0]) fd_loop_ctrl
ioctl$LOOP_CTL_GET_FREE(fd fd_loop_ctrl, cmd const[LOOP_CTL_GET_FREE]) fd_loop_num
ioctl$LOOP_CTL_ADD(fd fd_loop_ctrl, cmd const[LOOP_CTL_ADD], num fd_loop_num)
ioctl$LOOP_CTL_ADD(fd fd_loop_ctrl, cmd const[LOOP_CTL_ADD], num fd_loop_num) fd_loop
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not seem to return a loop fd.
It returns i:
https://elixir.bootlin.com/linux/v5.18-rc5/source/drivers/block/loop.c#L2073
which is assigned here:
https://elixir.bootlin.com/linux/v5.18-rc5/source/drivers/block/loop.c#L1997
which comes from idr_alloc for loop indices:
https://elixir.bootlin.com/linux/v5.18-rc5/source/drivers/block/loop.c#L1988
So it seems to be a loop index rather than a file descriptor.
If you agree, please revert this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. But I find another question.
I think the return value should be "fd_loop_num", which is the same as "ioctl$LOOP_CTL_GET_FREE()":
https://elixir.bootlin.com/linux/v5.18-rc5/source/drivers/block/loop.c#L2186
https://elixir.bootlin.com/linux/v5.18-rc5/source/drivers/block/loop.c#L2175
However, I do not find how the number are decided in "resource fd_loop_num[intptr]: 0, 1, 2, 10, 11, 12".
Not sure whether should we keep those numbers.

@dvyukov dvyukov merged commit b3f0941 into google:master May 5, 2022
@dvyukov
Copy link
Collaborator

dvyukov commented May 5, 2022

I think the return value should be "fd_loop_num"

You are right. Looks good now.

However, I do not find how the number are decided in "resource fd_loop_num[intptr]: 0, 1, 2, 10, 11, 12".
Not sure whether should we keep those numbers.

I don't remember now as well.
Probably the intention was to have some existing and non-existing loop numbers, or some that can be auto-allocated and some that are large enough to not be auto-allocated in most cases.
If we change it, I am not sure what would be a better set...

@ZHYfeng
Copy link
Contributor Author

ZHYfeng commented May 5, 2022

Thanks for the reasons.
By the way, would it be possible to accept the syscall descriptions which is just better than nothing?
We generate a lot of syscall descriptions and I am working on automatically giving them some meaningful names as you suggested.
However, they just have basic things (e.g., the file name of open(), cmd value and argument type of ioctl()) without the additional things (e.g., values of some fileds llike "const[0, int64]" or fd_loop_num).

@dvyukov
Copy link
Collaborator

dvyukov commented May 6, 2022

Oh, interesting. We wanted that for a long time (#590). Can you upload them as a PR, or as a commit in your fork? Then it will be easier to asses if/how they can be merged and how they can cohabit with existing descriptions.

@ZHYfeng
Copy link
Contributor Author

ZHYfeng commented May 7, 2022

Thanks, and I learn a lot from (#590).

I will upload them as a PR directly without any human modifications so that we can know what other automated steps are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants