From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from <gentoo-commits+bounces-422573-garchives=archives.gentoo.org@lists.gentoo.org>) id 1RsMgM-00037i-S8 for garchives@archives.gentoo.org; Tue, 31 Jan 2012 23:00:11 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 857BFE05BE; Tue, 31 Jan 2012 23:00:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3EB80E05BE for <gentoo-commits@lists.gentoo.org>; Tue, 31 Jan 2012 23:00:00 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ABF541B4052 for <gentoo-commits@lists.gentoo.org>; Tue, 31 Jan 2012 22:59:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 2B81680042 for <gentoo-commits@lists.gentoo.org>; Tue, 31 Jan 2012 22:59:59 +0000 (UTC) From: "William Hubbs" <williamh@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org> Message-ID: <0fcc6251fcde9c722207afa6f953aea7e80d771b.WilliamH@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/fstabinfo.c X-VCS-Directories: src/rc/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 0fcc6251fcde9c722207afa6f953aea7e80d771b Date: Tue, 31 Jan 2012 22:59:59 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 64f0c5e0-a5ce-476c-864f-989d761fc6c3 X-Archives-Hash: a32baaf0241a8fcd9bcc6da1e69510d4 commit: 0fcc6251fcde9c722207afa6f953aea7e80d771b Author: William Hubbs <williamh <AT> gentoo <DOT> org> AuthorDate: Tue Jan 31 16:56:57 2012 +0000 Commit: William Hubbs <williamh <AT> gentoo <DOT> org> CommitDate: Tue Jan 31 22:33:05 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D0fcc6251 fstabinfo: add --remount option This adds a --remount/-R option to fstabinfo. This new option works like --mount, but it adds the necessary options to remount a file system that is already mounted. Reported-by: Piotr Karbowski <piotr.karbowski <AT> gmail.com> X-Gentoo-Bug: 401573 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=3D401573 --- src/rc/fstabinfo.c | 39 ++++++++++++++++++++++++++++++++------- 1 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/rc/fstabinfo.c b/src/rc/fstabinfo.c index 3cf0e02..91f2a56 100644 --- a/src/rc/fstabinfo.c +++ b/src/rc/fstabinfo.c @@ -93,9 +93,9 @@ getmntfile(const char *file) extern const char *applet; =20 static int -do_mount(struct ENT *ent) +do_mount(struct ENT *ent, bool remount) { - char *argv[8]; + char *argv[10]; pid_t pid; int status; =20 @@ -104,9 +104,24 @@ do_mount(struct ENT *ent) argv[2] =3D ENT_OPTS(*ent); argv[3] =3D UNCONST("-t"); argv[4] =3D ENT_TYPE(*ent); - argv[5] =3D ENT_BLOCKDEVICE(*ent); - argv[6] =3D ENT_FILE(*ent); - argv[7] =3D NULL; + if (!remount) { + argv[5] =3D ENT_BLOCKDEVICE(*ent); + argv[6] =3D ENT_FILE(*ent); + argv[7] =3D NULL; + } else { +#ifdef __linux__ + argv[5] =3D UNCONST("-o"); + argv[6] =3D UNCONST("remount"); + argv[7] =3D ENT_BLOCKDEVICE(*ent); + argv[8] =3D ENT_FILE(*ent); + argv[9] =3D NULL; +#else + argv[5] =3D UNCONST("-u"); + argv[6] =3D ENT_BLOCKDEVICE(*ent); + argv[7] =3D ENT_FILE(*ent); + argv[8] =3D NULL; +#endif + } switch (pid =3D vfork()) { case -1: eerrorx("%s: vfork: %s", applet, strerror(errno)); @@ -127,9 +142,10 @@ do_mount(struct ENT *ent) } =20 #include "_usage.h" -#define getoptstring "Mbmop:t:" getoptstring_COMMON +#define getoptstring "MRbmop:t:" getoptstring_COMMON static const struct option longopts[] =3D { { "mount", 0, NULL, 'M' }, + { "remount", 0, NULL, 'R' }, { "blockdevice", 0, NULL, 'b' }, { "mountargs", 0, NULL, 'm' }, { "options", 0, NULL, 'o' }, @@ -139,6 +155,7 @@ static const struct option longopts[] =3D { }; static const char * const longopts_help[] =3D { "Mounts the filesytem from the mountpoint", + "Remounts the filesystem based on the information in fstab", "Extract the block device", "Show arguments needed to mount the entry", "Extract the options field", @@ -154,6 +171,7 @@ static const char * const longopts_help[] =3D { #define OUTPUT_PASSNO (1 << 4) #define OUTPUT_BLOCKDEV (1 << 5) #define OUTPUT_MOUNT (1 << 6) +#define OUTPUT_REMOUNT (1 << 7) =20 int fstabinfo(int argc, char **argv) @@ -182,6 +200,9 @@ fstabinfo(int argc, char **argv) case 'M': output =3D OUTPUT_MOUNT; break; + case 'R': + output =3D OUTPUT_REMOUNT; + break; case 'b': output =3D OUTPUT_BLOCKDEV; break; @@ -287,7 +308,11 @@ fstabinfo(int argc, char **argv) break; =20 case OUTPUT_MOUNT: - result +=3D do_mount(ent); + result +=3D do_mount(ent, false); + break; + + case OUTPUT_REMOUNT: + result +=3D do_mount(ent, true); break; =20 case OUTPUT_MOUNTARGS: