12 #include <linux/module.h>
13 #include <linux/sched.h>
18 #include <linux/xattr.h>
19 #include <linux/slab.h>
22 static const char cachefiles_xattr_cache[] =
32 char type[3], xtype[3];
43 _enter(
"%p{%s}",
object, type);
46 ret =
vfs_setxattr(dentry, cachefiles_xattr_cache, type, 2,
54 kerror(
"Can't set xattr on %*.*s [%lu] (err %d)",
62 ret =
vfs_getxattr(dentry, cachefiles_xattr_cache, xtype, 3);
67 kerror(
"Can't read xattr on %*.*s [%lu] (err %d)",
78 if (xtype[0] != type[0] || xtype[1] != type[1])
88 kerror(
"Cache object %lu type xattr length incorrect",
95 kerror(
"Cache object %*.*s [%lu] type %s not %s",
123 if (ret < 0 && ret != -
ENOMEM)
126 "Failed to set xattr with error %d", ret);
152 if (ret < 0 && ret != -
ENOMEM)
155 "Failed to update xattr with error %d", ret);
185 &auxbuf->
type, 512 + 1);
192 goto bad_type_length;
195 "Can't read xattr on %lu (err %d)",
202 goto bad_type_length;
210 if (object->
fscache.cookie->def->check_aux) {
214 dlen = auxbuf->
len - 1;
217 object->
fscache.cookie->def->name, dlen);
220 &auxbuf->
data, dlen);
245 "Can't update xattr on %lu"
261 kerror(
"Cache object %lu xattr length incorrect",
285 "Can't remove xattr from %lu"