From owner-freebsd-current@FreeBSD.ORG Wed Feb 27 16:17:57 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AF13DAE0 for ; Wed, 27 Feb 2013 16:17:57 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by mx1.freebsd.org (Postfix) with ESMTP id 51F5EC3D for ; Wed, 27 Feb 2013 16:17:57 +0000 (UTC) Received: by mail-wg0-f53.google.com with SMTP id fn15so627737wgb.32 for ; Wed, 27 Feb 2013 08:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=bpRrSCh9o913RvYAQaEfFncGmmZNd1tGneZd9Lp2QDk=; b=Melx2n/NGIY9GJqm3nzzcC1D7ZdzTbsnks05olm9luybYUpco20Dah1EPKgpOqUQX9 YU8Rxtem8hH7Q9lwbdoHbDOn47D4c9zI98qCOwnYb/qEl9Iq42gWvwhm4FRJIyeGk1LE CWU+MalKDa0wGAm7Pv+vEzwiGW/TSBBLHK+siZulAbxbguMyyJ7F0GXx1xK3AqwBaUq1 HT7NYYHoA3EubDXbTX5RACdVSrd6sziwPTQ1XvbTFtfDqWLMxvlF6p19y5yTX61n1Vwx xgOrKh5IhdQUoJIqyscv2iuVpOEd3zw3Mpt2S8DxkECpyYTQZgsjqJ/+cu1uMBUgoBYI A0DA== MIME-Version: 1.0 X-Received: by 10.194.6.2 with SMTP id w2mr5159526wjw.10.1361981876291; Wed, 27 Feb 2013 08:17:56 -0800 (PST) Received: by 10.194.86.167 with HTTP; Wed, 27 Feb 2013 08:17:56 -0800 (PST) In-Reply-To: References: Date: Wed, 27 Feb 2013 19:17:56 +0300 Message-ID: Subject: Re: [patch] Proposal: move getmntopts(3) into libutil From: Sergey Kandaurov To: Craig Rodrigues Content-Type: text/plain; charset=ISO-8859-1 Cc: FreeBSD Current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2013 16:17:57 -0000 On 26 February 2013 23:11, Craig Rodrigues wrote: > On Tue, Feb 26, 2013 at 3:39 AM, Sergey Kandaurov wrote: >> >> Hi. >> >> >> >> External mount-like utilities may also have difficulties with building >> to get getmntopts.c source as this requires /usr/src presence which is >> in sync with installed world. Look how mount_fusefs from ports compiles: >> # mount_fusefs needs mntopts.h and getmntopts.c from src/sbin/mount/ > > > I have no object in moving getmntopts.c to libutil. > > I'll give some history to some of this stuff, to the best of my ability. > A few years ago, phk@ made a big change by introducing the nmount() system > call to replace mount(). > Look at all mount-related commits around this time: > http://lists.freebsd.org/pipermail/cvs-src/2004-December/author.html#36373 > > This required changing every file system, and for old file systems which > supported the "classic mount" cmount(), > in each file system, the cmount() call had to internally call the nmount() > code. > > In addition, phk made a pass to clean up all the userland mount programs to > use nmount(). There was a lot > of duplicated ("copy and pasted") code in various mount programs. I helped > in the effort to clean up some of the userland mount() programs. > > pjd@ proposed to make the main /sbin/mount load a shared library for each > specific file system, > and each shared library would have file-system specific mount logic. For > example: > > mount -t newfoofs /dev/blah /mnt > > would internally do something like: > > dlopen("libmount_newfoofs",.....); > > > phk@ opposed this approach, saying that it could lead to ABI/API problems, > library mismatches, etc. > So we kept the existing approach. I modified /sbin/mount to by default use > nmount() and only > for certain file systems, exec an external mount program. > > phk's ideas for getmntopts.c was always to keep it as a place where > "library-like" functions for mounting > file systems would be kept. To avoid library mismatch problems, it was kept > has a C file directly compiled > into the mount programs. Sure, keeping it directly compiled has its own benefits. Reading your mail is very educational, thank you. > > I have no problems keeping getmntopts.c in a separate library. libutil is > fine, or even a separate libmntutil (or whatever). > Just keep in mind the issues that could possibly come up if there is a > mismatch between > the userland mount programs, and the library which contains getmntopts.c > > Other than that, you proposal is quite reasonable, and I have no issue with > it. Although libutil is already used with such binaries like mount and mountd, library mismatch is a real concern. I will need to think somewhat more. Thanks for looking at this. -- wbr, pluknet