From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K. V" Subject: Re: What should listxattr() return if there are no xattrs? Date: Tue, 21 Dec 2010 09:57:17 +0530 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: "Theodore Ts'o" , linux-fsdevel@vger.kernel.org, a.gruenbacher@bestbits.at, Wang Sheng-Hui , Michael Kerrisk Return-path: Received: from e23smtp02.au.ibm.com ([202.81.31.144]:37587 "EHLO e23smtp02.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933461Ab0LUE10 (ORCPT ); Mon, 20 Dec 2010 23:27:26 -0500 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp02.au.ibm.com (8.14.4/8.13.1) with ESMTP id oBL4MX4L029487 for ; Tue, 21 Dec 2010 15:22:33 +1100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oBL4ROhZ2125906 for ; Tue, 21 Dec 2010 15:27:24 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oBL4RNum024729 for ; Tue, 21 Dec 2010 15:27:24 +1100 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, 20 Dec 2010 08:26:53 -0500, "Theodore Ts'o" wrote: > > Wang Sheng-Hui has sent some patches that change listxattr for the extN > file systems to return ENODATA when an inode has no extended attributes > (instead of zero). > > I've noted that neither btrfs nor XFS do this, and would have rejected > the patches on that basis. However, I'll note the man page for the > listxattr(2) syscall is ambiguous: > > On success, a positive number is returned indicating the size of the > extended attribute name list. On failure, -1 is returned and errno is > set appropriately. > > It states that on success a _positive_ number is returned. I've looked > and this wordining is in SGI's man page as well. I suspect the man page > should be corrected to sate that "non-negative" number is returned? I agree that man page needs update. Note that getfattr code does length = do_listxattr(path, NULL, 0); if (length < 0) { fprintf(stderr, "%s: %s: %s\n", progname, xquote(path, "\n\r"), strerror_ea(errno)); had_errors++; return 1; } else if (length == 0) return 0; -aneesh