From owner-freebsd-current@FreeBSD.ORG Wed Feb 9 03:06:21 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75666106566C for ; Wed, 9 Feb 2011 03:06:21 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5474A8FC08 for ; Wed, 9 Feb 2011 03:06:20 +0000 (UTC) Received: by pxi1 with SMTP id 1so1470538pxi.13 for ; Tue, 08 Feb 2011 19:06:20 -0800 (PST) Received: by 10.142.136.6 with SMTP id j6mr17877911wfd.179.1297218914524; Tue, 08 Feb 2011 18:35:14 -0800 (PST) Received: from [10.123.2.181] (99-74-169-43.lightspeed.sntcca.sbcglobal.net [99.74.169.43]) by mx.google.com with ESMTPS id b11sm605749wff.21.2011.02.08.18.35.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Feb 2011 18:35:12 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: Date: Tue, 8 Feb 2011 18:35:09 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <80373F51-25C7-48A0-8920-3444A98D857F@kientzle.com> References: To: Shawn Webb X-Mailer: Apple Mail (2.1082) Cc: FreeBSD-current Subject: Re: setfacl Recursive Functionality X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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, 09 Feb 2011 03:06:21 -0000 On Feb 8, 2011, at 9:58 AM, Shawn Webb wrote: > I've just finished a patch to add recursive functionality to setfacl. = Before > I officially submit it, I'd like a few suggestions on how to improve = the > patch. >=20 > The part I'm worried about involves the #define directive at top. I'm = not > sure what ramifications using that define might have. I needed it for = my > remove_invalid_inherit() function to work. You should certainly not need=20 #define _ACL_PRIVATE for any user-space utilities. What exactly is the problem without that? Your approach to directory walking here is a little simplistic. In particular, you're storing every filename for the entire tree in memory, which is a problem for large filesystems. It would be much better to refactor the code so that the actual ACL update was in a function and then recurse_directory should call that function for each filename as it visited it. That will reduce the memory requirements significantly. You should also take a look at fts(3). In particular, you'll want to implement the BSD-standard -L/-P/-H options, and fts(3) makes that much easier. (-L always follows symlinks, -P never follows symlinks, -H follows symlinks on the command line). Tim