From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dimitris Papastamos Subject: Re: [PATCH] Syscalls: reboot: Add options to the reboot syscall to remount filesystems ro Date: Mon, 7 Mar 2011 11:00:20 +0000 Message-ID: <20110307110020.GA13712@opensource.wolfsonmicro.com> References: <1299137483-10975-1-git-send-email-ksumrall@android.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Ken Sumrall , linux-kernel@vger.kernel.org, Alexander Viro , Christoph Hellwig , Andrew Morton , Jan Kara , Jens Axboe , Matthew Wilcox , Eric Paris , Dave Young , Jiri Slaby , James Morris , linux-fsdevel@vger.kernel.org To: Linus Torvalds Return-path: Received: from opensource.wolfsonmicro.com ([80.75.67.52]:47351 "EHLO opensource2.wolfsonmicro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750944Ab1CGLAX (ORCPT ); Mon, 7 Mar 2011 06:00:23 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Mar 03, 2011 at 10:17:32AM -0800, Linus Torvalds wrote: > On Thu, Mar 3, 2011 at 9:45 AM, Linus Torvalds > wrote: > > > > How many mounted filesystems do you have that it's so hard to keep track of? > > Btw, /proc/mounts will track them for you even if you don't have a > 'mount' binary that does. > > Parsing that is pretty trivial. If you have spaces or special > characters in your pathnames (you may control the mount paths, you may > not - I have no idea), you'll need to be able to handle the escape > format (\oct). But other than that, it's literally just > > - read all of /proc/mounts into a buffer > > - for each line, split by space, and you'll have the directory name > right there in the second field > > - do the unescaping ("\oct" -> character) if needed. It's good > practice. Test it. > > - just do a read-only remount on it. > > All done. No kernel changes necessary. It just works. That or using setmntent() etc. Thanks, Dimitris