diff options
author | Ritesh Harjani <riteshh@codeaurora.org> | 2018-06-06 15:08:59 +0530 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-06-14 09:15:04 +0200 |
commit | 08cc6a2af66e62e3228e17bfa8e8aa918643d06e (patch) | |
tree | 8766201e6fb49f523186a3bb1c5b37c4464edce0 | |
parent | 0f833ac73ad631248826386e2918d8571ecf0347 (diff) |
mkfs.ubifs: add_xattr is not depending on host XATTR support
add_xattr adds the xattr to the ubifs image and has nothing
to do with host XATTR support.
Now that we are adding support where selinux interfaces
may use this API even when host OS(where ubi/ubifs image
is being created) does not support XATTR -so remove it
from WITHOUT_XATTR #ifdef.
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r-- | ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c index 6323dd4..2333dde 100644 --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c @@ -1007,46 +1007,6 @@ static int add_node(union ubifs_key *key, char *name, void *node, int len) return 0; } -#ifdef WITHOUT_XATTR -static inline int create_inum_attr(ino_t inum, const char *name) -{ - (void)inum; - (void)name; - - return 0; -} - -static inline int inode_add_xattr(struct ubifs_ino_node *host_ino, - const char *path_name, struct stat *st, ino_t inum) -{ - (void)host_ino; - (void)path_name; - (void)st; - (void)inum; - - return 0; -} -#else -static int create_inum_attr(ino_t inum, const char *name) -{ - char *str; - int ret; - - if (!do_create_inum_attr) - return 0; - - ret = asprintf(&str, "%llu", (unsigned long long)inum); - if (ret < 0) - return -1; - - ret = lsetxattr(name, "user.image-inode-number", str, ret, 0); - - free(str); - - return ret; -} - - static int add_xattr(struct stat *st, ino_t inum, const void *data, unsigned int data_len, struct qstr *nm) { @@ -1117,6 +1077,46 @@ out: return ret; } +#ifdef WITHOUT_XATTR +static inline int create_inum_attr(ino_t inum, const char *name) +{ + (void)inum; + (void)name; + + return 0; +} + +static inline int inode_add_xattr(struct ubifs_ino_node *host_ino, + const char *path_name, + struct stat *st, ino_t inum) +{ + (void)host_ino; + (void)path_name; + (void)st; + (void)inum; + + return 0; +} +#else +static int create_inum_attr(ino_t inum, const char *name) +{ + char *str; + int ret; + + if (!do_create_inum_attr) + return 0; + + ret = asprintf(&str, "%llu", (unsigned long long)inum); + if (ret < 0) + return ret; + + ret = lsetxattr(name, "user.image-inode-number", str, ret, 0); + + free(str); + + return ret; +} + static int inode_add_xattr(struct ubifs_ino_node *host_ino, const char *path_name, struct stat *st, ino_t inum) { |