Skip to content

Add /proc/mounts#261

Merged
eminence merged 1 commit intoeminence:masterfrom
tatref:mounts
May 10, 2023
Merged

Add /proc/mounts#261
eminence merged 1 commit intoeminence:masterfrom
tatref:mounts

Conversation

@tatref
Copy link
Contributor

@tatref tatref commented Mar 28, 2023

/proc/<pid>/mounts is the same format, so we could reuse some code

@eminence
Copy link
Owner

Thanks for all the PRs. I think I want to get #257 merged first, as I'm sure it'll conflict with other things.

@tatref
Copy link
Contributor Author

tatref commented Apr 21, 2023

I rebased from master.

A few changes compared to the first version:

  • There is no Mounts(pub Vec<MountEntry>) anymore
  • I used impl Current for Vec<MountEntry>, same for FromBufRead
  • Simple usage is easy: procfs::mounts().unwrap()
  • Advanced usage is more complicated: Vec::<MountEntry>::from_buf_read(cursor).unwrap()

What do you think?

fn from_buf_read<R: BufRead>(r: R) -> ProcResult<Self> {
let mut vec = Vec::new();

for line in r.lines().skip(1) {
Copy link
Owner

Choose a reason for hiding this comment

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

Is this skip(1) right?

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 don't know what I did there... the file has no headers, so no reason to skip the first line

@eminence
Copy link
Owner

Also can you update support.md ?

@eminence eminence merged commit bea7031 into eminence:master May 10, 2023
@eminence
Copy link
Owner

Thanks

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