diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-12-18 12:33:13 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2012-01-06 11:26:07 -0500 |
commit | f766619db2be059cd0dbba8a36176fe01a29d588 (patch) | |
tree | 5c2f824bec85ef3515c801c4e68b94155d6b22b2 /fs/9p | |
parent | b6054793069bf08fcf220fff5fb33735d5493594 (diff) |
fs/9p: iattr_valid flags are kernel internal flags map them to 9p values.
Kernel internal values can change, add protocol values for these constant
and use them.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 73488fb69d38..7ca7171273d1 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -522,6 +522,46 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry, | |||
522 | return 0; | 522 | return 0; |
523 | } | 523 | } |
524 | 524 | ||
525 | /* | ||
526 | * Attribute flags. | ||
527 | */ | ||
528 | #define P9_ATTR_MODE (1 << 0) | ||
529 | #define P9_ATTR_UID (1 << 1) | ||
530 | #define P9_ATTR_GID (1 << 2) | ||
531 | #define P9_ATTR_SIZE (1 << 3) | ||
532 | #define P9_ATTR_ATIME (1 << 4) | ||
533 | #define P9_ATTR_MTIME (1 << 5) | ||
534 | #define P9_ATTR_CTIME (1 << 6) | ||
535 | #define P9_ATTR_ATIME_SET (1 << 7) | ||
536 | #define P9_ATTR_MTIME_SET (1 << 8) | ||
537 | |||
538 | struct dotl_iattr_map { | ||
539 | int iattr_valid; | ||
540 | int p9_iattr_valid; | ||
541 | }; | ||
542 | |||
543 | static int v9fs_mapped_iattr_valid(int iattr_valid) | ||
544 | { | ||
545 | int i; | ||
546 | int p9_iattr_valid = 0; | ||
547 | struct dotl_iattr_map dotl_iattr_map[] = { | ||
548 | { ATTR_MODE, P9_ATTR_MODE }, | ||
549 | { ATTR_UID, P9_ATTR_UID }, | ||
550 | { ATTR_GID, P9_ATTR_GID }, | ||
551 | { ATTR_SIZE, P9_ATTR_SIZE }, | ||
552 | { ATTR_ATIME, P9_ATTR_ATIME }, | ||
553 | { ATTR_MTIME, P9_ATTR_MTIME }, | ||
554 | { ATTR_CTIME, P9_ATTR_CTIME }, | ||
555 | { ATTR_ATIME_SET, P9_ATTR_ATIME_SET }, | ||
556 | { ATTR_MTIME_SET, P9_ATTR_MTIME_SET }, | ||
557 | }; | ||
558 | for (i = 0; i < ARRAY_SIZE(dotl_iattr_map); i++) { | ||
559 | if (iattr_valid & dotl_iattr_map[i].iattr_valid) | ||
560 | p9_iattr_valid |= dotl_iattr_map[i].p9_iattr_valid; | ||
561 | } | ||
562 | return p9_iattr_valid; | ||
563 | } | ||
564 | |||
525 | /** | 565 | /** |
526 | * v9fs_vfs_setattr_dotl - set file metadata | 566 | * v9fs_vfs_setattr_dotl - set file metadata |
527 | * @dentry: file whose metadata to set | 567 | * @dentry: file whose metadata to set |
@@ -542,7 +582,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
542 | if (retval) | 582 | if (retval) |
543 | return retval; | 583 | return retval; |
544 | 584 | ||
545 | p9attr.valid = iattr->ia_valid; | 585 | p9attr.valid = v9fs_mapped_iattr_valid(iattr->ia_valid); |
546 | p9attr.mode = iattr->ia_mode; | 586 | p9attr.mode = iattr->ia_mode; |
547 | p9attr.uid = iattr->ia_uid; | 587 | p9attr.uid = iattr->ia_uid; |
548 | p9attr.gid = iattr->ia_gid; | 588 | p9attr.gid = iattr->ia_gid; |