ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

I wrote a patch for util-linux that allows me to exclusively use /proc/mounts over /etc/mtab, given that I could see no difference between the two.
I quickly found out that the /proc/mounts does not append the user=blah option to specify that some non-root user should be able to umount the device.
I then followed with a new patch that effectively appends the option umount=somegid.

I am using umount= so that I do not conflict with any special parameters in existing filesystems.

The problem is that I am trying to look through the kernel to see what I need to change to allow /proc/mounts to have umount=somegid and not have the filesystem upchuck because it does not recognize the umount=somegid option.

I can see the good way and the bad way to implement this.
The good way would be to remove the umount=somegid option after it gets placed into /proc/mounts and before the options get passed to the filesystem.
The bad way would be to tweak every single filesystem and have them explicitly ignore the umount=somegid option.

I am having trouble finding in the linux source, where in the code I need to make this change and remove the umount=somegid option.

I think you misunderstand a few things. There is a reason that mtab has more information than /proc/mounts, and it is not that the kernel is stingy. The “user=” feature is implemented completely in userspace. In particular, that information never travels to the kernel via the mount(2) system call, but is enforced by the SUID-root program umount. Besides the “user=” information, there is also information pertaining to loopback devices that ensures proper unmounting of those as well.

So that information is written to mtab by the mount utility with the sole intention of its use by the umount utility.

If you want to know, the procfile output is controlled by the show_vfsmnt() function. In order for you to change the current state of affairs, however, I believe you will have to ammend the sys_mount() and sys_umount() functions (but I may be wrong about that).