Skip to contentSkip to conversation

i_op->listxattr semantics

DISCUSSION Will Dyson 2 participants 2 messages Jun 8, 2003 VFS

lore
Share & tools
lore

Will Dyson

author
#0 lore raw

Hello all,

I am attempting to implement support for extended attributes in the Be Filesystem (befs) driver. But I am stuck trying to figure out why the getfattr program does not list my attributes.

Below is a test version of befs_listxattr that gives all files one attribute named "MyAttr". When I mount my filesystem on /befs (in 2.5.69-uml) and issue the command "getfattr -d /befs", no attributes are printed. The debugging statements appear in my syslog, so I know the function is being called.

Can anyone help me figure out what I am doing wrong? Thanks!

static ssize_t
befs_listxattr(struct dentry *dentry, char *buffer, size_t size)

{
	struct super_block *sb = dentry->d_inode->i_sb;
	ssize_t attr_len = 0;
	char *attr = "MyAttr";

	befs_debug(sb, "---> befs_listxattr for inode %lu "
			"with %d buffer_size",
			dentry->d_inode->i_ino, size);

	attr_len = strlen(attr);
	
	if (buffer) {
		memcpy(buffer, attr, attr_len);
		buffer[attr_len] = '\0';
	}
	
	befs_debug(sb, "<--- befs_listxattr");
	return attr_len + 1;
}
Signature · 2 lines
Will Dyson
"Back off man, I'm a scientist!" -Dr. Peter Venkman
#1 lore raw
Quoted 6 lines · Will Dyson

Hello all,

I am attempting to implement support for extended attributes in the Be Filesystem (befs) driver. But I am stuck trying to figure out why the getfattr program does not list my attributes.

Quoted 7 lines

Below is a test version of befs_listxattr that gives all files one attribute named "MyAttr". When I mount my filesystem on /befs (in 2.5.69-uml) and issue the command "getfattr -d /befs", no attributes are printed. The debugging statements appear in my syslog, so I know the function is being called.

Can anyone help me figure out what I am doing wrong? Thanks!

At first guess, probably the lack of a namespace prefix is causing your problem - see attr(5) and listxattr(2).

Quoted 6 lines

static ssize_t
befs_listxattr(struct dentry *dentry, char *buffer, size_t size)

{
	struct super_block *sb = dentry->d_inode->i_sb;
	ssize_t attr_len = 0;
	char *attr = "MyAttr";

Try 's/MyAttr/user.MyAttr/g' or whichever namespace is appropriate.

cheers.

Signature · 1 line
Nathan