Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347536
b: refs/heads/master
c: 573ea5f
h: refs/heads/master
v: v3
  • Loading branch information
Jaegeuk Kim committed Dec 11, 2012
1 parent cf265f8 commit 7b98e95
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 52 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0a8165d7c2cf1395059db20ab07665baf3758fcd
refs/heads/master: 573ea5fcf0a65fea4811f82edd6dc6045c04edda
1 change: 1 addition & 0 deletions trunk/fs/f2fs/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config F2FS_FS
tristate "F2FS filesystem support (EXPERIMENTAL)"
depends on BLOCK
help
F2FS is based on Log-structured File System (LFS), which supports
versatile "flash-friendly" features. The design has been focused on
Expand Down
51 changes: 0 additions & 51 deletions trunk/fs/f2fs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,54 +412,3 @@ const struct xattr_handler f2fs_xattr_acl_access_handler = {
.get = f2fs_xattr_get_acl,
.set = f2fs_xattr_set_acl,
};

static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
size_t list_size, const char *name, size_t name_len, int type)
{
const char *xname = F2FS_SYSTEM_ADVISE_PREFIX;
size_t size;

if (type != F2FS_XATTR_INDEX_ADVISE)
return 0;

size = strlen(xname) + 1;
if (list && size <= list_size)
memcpy(list, xname, size);
return size;
}

static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
void *buffer, size_t size, int type)
{
struct inode *inode = dentry->d_inode;

if (strcmp(name, "") != 0)
return -EINVAL;

*((char *)buffer) = F2FS_I(inode)->i_advise;
return sizeof(char);
}

static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags, int type)
{
struct inode *inode = dentry->d_inode;

if (strcmp(name, "") != 0)
return -EINVAL;
if (!inode_owner_or_capable(inode))
return -EPERM;
if (value == NULL)
return -EINVAL;

F2FS_I(inode)->i_advise |= *(char *)value;
return 0;
}

const struct xattr_handler f2fs_xattr_advise_handler = {
.prefix = F2FS_SYSTEM_ADVISE_PREFIX,
.flags = F2FS_XATTR_INDEX_ADVISE,
.list = f2fs_xattr_advise_list,
.get = f2fs_xattr_advise_get,
.set = f2fs_xattr_advise_set,
};
51 changes: 51 additions & 0 deletions trunk/fs/f2fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,49 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
return f2fs_setxattr(dentry->d_inode, type, name, value, size);
}

static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
size_t list_size, const char *name, size_t name_len, int type)
{
const char *xname = F2FS_SYSTEM_ADVISE_PREFIX;
size_t size;

if (type != F2FS_XATTR_INDEX_ADVISE)
return 0;

size = strlen(xname) + 1;
if (list && size <= list_size)
memcpy(list, xname, size);
return size;
}

static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
void *buffer, size_t size, int type)
{
struct inode *inode = dentry->d_inode;

if (strcmp(name, "") != 0)
return -EINVAL;

*((char *)buffer) = F2FS_I(inode)->i_advise;
return sizeof(char);
}

static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags, int type)
{
struct inode *inode = dentry->d_inode;

if (strcmp(name, "") != 0)
return -EINVAL;
if (!inode_owner_or_capable(inode))
return -EPERM;
if (value == NULL)
return -EINVAL;

F2FS_I(inode)->i_advise |= *(char *)value;
return 0;
}

const struct xattr_handler f2fs_xattr_user_handler = {
.prefix = XATTR_USER_PREFIX,
.flags = F2FS_XATTR_INDEX_USER,
Expand All @@ -118,6 +161,14 @@ const struct xattr_handler f2fs_xattr_trusted_handler = {
.set = f2fs_xattr_generic_set,
};

const struct xattr_handler f2fs_xattr_advise_handler = {
.prefix = F2FS_SYSTEM_ADVISE_PREFIX,
.flags = F2FS_XATTR_INDEX_ADVISE,
.list = f2fs_xattr_advise_list,
.get = f2fs_xattr_advise_get,
.set = f2fs_xattr_advise_set,
};

static const struct xattr_handler *f2fs_xattr_handler_map[] = {
[F2FS_XATTR_INDEX_USER] = &f2fs_xattr_user_handler,
#ifdef CONFIG_F2FS_FS_POSIX_ACL
Expand Down

0 comments on commit 7b98e95

Please sign in to comment.