From owner-freebsd-fs@freebsd.org Mon Mar 7 16:15:03 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3D83AC3B45 for ; Mon, 7 Mar 2016 16:15:03 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id A8DE06B1 for ; Mon, 7 Mar 2016 16:15:03 +0000 (UTC) (envelope-from ken@kdm.org) Received: by mailman.ysv.freebsd.org (Postfix) id A80A7AC3B44; Mon, 7 Mar 2016 16:15:03 +0000 (UTC) Delivered-To: fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D91AAC3B42; Mon, 7 Mar 2016 16:15:03 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (mithlond.kdm.org [96.89.93.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "A1-33714", Issuer "A1-33714" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D2B96AE; Mon, 7 Mar 2016 16:15:02 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (localhost [127.0.0.1]) by mithlond.kdm.org (8.15.2/8.14.9) with ESMTPS id u27GEsSm004385 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 7 Mar 2016 11:14:54 -0500 (EST) (envelope-from ken@mithlond.kdm.org) Received: (from ken@localhost) by mithlond.kdm.org (8.15.2/8.14.9/Submit) id u27GEsD8004384; Mon, 7 Mar 2016 11:14:54 -0500 (EST) (envelope-from ken) Date: Mon, 7 Mar 2016 11:14:54 -0500 From: "Kenneth D. Merry" To: Rick Macklem Cc: fs@freebsd.org, scsi@freebsd.org, Robert Watson Subject: Re: FUSE extended attribute patches available Message-ID: <20160307161454.GA3501@mithlond.kdm.org> References: <800018199.6694281.1457233600357.JavaMail.zimbra@uoguelph.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <800018199.6694281.1457233600357.JavaMail.zimbra@uoguelph.ca> User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mithlond.kdm.org [127.0.0.1]); Mon, 07 Mar 2016 11:14:55 -0500 (EST) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mithlond.kdm.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2016 16:15:04 -0000 On Sat, Mar 05, 2016 at 22:06:40 -0500, Rick Macklem wrote: > Ken Merry wrote: > > I have patches for FreeBSD???s FUSE filesystem kernel module to support > > extended attributes: > > > > https://people.freebsd.org/~ken/fuse_extattr.20160229.1.txt > > > The only bit of code I have that might be useful for this patch is: > case FUSE_GETXATTR: > case FUSE_LISTXATTR: > ! /* > ! * These can have varying response lengths, and 0 length > ! * isn't necessarily invalid. > ! */ > ! err = 0; > *** I came up with this: > fgin = (struct fuse_getxattr_in *) > ((char *)ftick->tk_ms_fiov.base + > sizeof(struct fuse_in_header)); > if (fgin->size == 0) > err = (blen == sizeof(struct fuse_getxattr_out)) ? 0 : > EINVAL; > else > err = (blen <= fgin->size) ? 0 : EINVAL; > break; > I think I got the size check right? I think that is correct, yes. > The big question is... > What to do with the NAMESPACE? > - My code fails for SYSTEM and does USER without prepending "user.". > (That seemed to be what rwatson@ felt was reasonable. I thought our > discussion was on a mailing list, but I can't find it.) > I've cc'd him. Maybe he can comment again. IBM's LTFS at least seems to require the "user." prefix on Linux. For context, this code supports Windows, Linux and MacOS X. So the "#else" case is Linux. Here's the code in question: /** * Strip a Linux namespace prefix from the given xattr name and return the position of the suffix. * If the name is "user.X", return the "X" portion. Otherwise, return an error. * This function does nothing on Mac OS X. * @param name Name to strip. * @return A pointer to the name suffix, or NULL to indicate an invalid name. On Mac OS X, * always returns @name. */ const char *_xattr_strip_name(const char *name) { #if (defined (__APPLE__) || defined (mingw_PLATFORM)) return name; #else if (strstr(name, "user.") == name) return name + 5; else return NULL; #endif } I can certainly change it to do whatever is the correct answer on FreeBSD. It looks like for FUSE with MacOS and Windows, they expect just the attribute name without a namespace prefix. > - If you stick with prepending "user." or "system." there needs to be > some way to bypass this so that attributes that don't start in "user." > or "system." can be accessed. I've seen "trusted." and "glusterfs." > on GlusterFS. > --> Maybe a new namespace called something like "nil" that just bypasses > any USER or SYSTEM checks? > I'll respond to rwatson's email on this part... Ken -- Kenneth Merry ken@FreeBSD.ORG