60 #include <linux/slab.h>
61 #include <linux/xattr.h>
68 #define MAX_XATTRS_PER_INODE 65535
107 .new_ino_d =
ALIGN(size, 8), .dirtied_ino = 1,
128 err = PTR_ERR(inode);
134 inode->
i_op = &empty_iops;
135 inode->
i_fop = &empty_fops;
150 host->
i_ctime = ubifs_current_time(host);
162 insert_inode_hash(inode);
191 static int change_xattr(
struct ubifs_info *c,
struct inode *host,
192 struct inode *inode,
const void *value,
int size)
215 host->
i_ctime = ubifs_current_time(host);
251 static int check_namespace(
const struct qstr *nm)
285 ubifs_err(
"dead extended attribute entry, error %d",
286 (
int)PTR_ERR(inode));
291 ubifs_err(
"corrupt extended attribute entry");
297 const void *value,
size_t size,
int flags)
306 dbg_gen(
"xattr '%s', host ino %lu ('%.*s'), size %zd", name,
313 type = check_namespace(&nm);
325 xent_key_init(c, &key, host->
i_ino, &nm);
335 err = create_xattr(c, host, &nm, value, size);
347 err = PTR_ERR(inode);
351 err = change_xattr(c, host, inode, value, size);
370 dbg_gen(
"xattr '%s', ino %lu ('%.*s'), buf size %zd", name,
373 err = check_namespace(&nm);
381 xent_key_init(c, &key, host->
i_ino, &nm);
391 err = PTR_ERR(inode);
402 ubifs_err(
"buffer size %zd, xattr len %d",
422 struct inode *host = dentry->
d_inode;
426 int err,
len, written = 0;
429 dbg_gen(
"ino %lu ('%.*s'), buffer size %zd", host->
i_ino,
443 lowest_xent_key(c, &key, host->
i_ino);
456 type = check_namespace(&nm);
464 memcpy(buffer + written, nm.
name, nm.len + 1);
465 written += nm.len + 1;
470 key_read(c, &xent->
key, &key);
475 ubifs_err(
"cannot find next direntry, error %d", err);
483 static int remove_xattr(
struct ubifs_info *c,
struct inode *host,
484 struct inode *inode,
const struct qstr *nm)
499 host->
i_ctime = ubifs_current_time(host);
532 dbg_gen(
"xattr '%s', ino %lu ('%.*s')", name,
536 err = check_namespace(&nm);
544 xent_key_init(c, &key, host->
i_ino, &nm);
554 err = PTR_ERR(inode);
560 err = remove_xattr(c, host, inode, &nm);