hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/ubifs/ubifs.h
....@@ -1,20 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * This file is part of UBIFS.
34 *
45 * Copyright (C) 2006-2008 Nokia Corporation
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License version 2 as published by
8
- * the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful, but WITHOUT
11
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- * more details.
14
- *
15
- * You should have received a copy of the GNU General Public License along with
16
- * this program; if not, write to the Free Software Foundation, Inc., 51
17
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
186 *
197 * Authors: Artem Bityutskiy (Битюцкий Артём)
208 * Adrian Hunter
....@@ -39,6 +27,9 @@
3927 #include <linux/security.h>
4028 #include <linux/xattr.h>
4129 #include <linux/random.h>
30
+#include <crypto/hash_info.h>
31
+#include <crypto/hash.h>
32
+#include <crypto/algapi.h>
4233
4334 #include <linux/fscrypt.h>
4435
....@@ -155,6 +146,14 @@
155146
156147 /* Maximum number of data nodes to bulk-read */
157148 #define UBIFS_MAX_BULK_READ 32
149
+
150
+#ifdef CONFIG_UBIFS_FS_AUTHENTICATION
151
+#define UBIFS_HASH_ARR_SZ UBIFS_MAX_HASH_LEN
152
+#define UBIFS_HMAC_ARR_SZ UBIFS_MAX_HMAC_LEN
153
+#else
154
+#define UBIFS_HASH_ARR_SZ 0
155
+#define UBIFS_HMAC_ARR_SZ 0
156
+#endif
158157
159158 /*
160159 * Lockdep classes for UBIFS inode @ui_mutex.
....@@ -357,6 +356,7 @@
357356 * @ui_mutex: serializes inode write-back with the rest of VFS operations,
358357 * serializes "clean <-> dirty" state changes, serializes bulk-read,
359358 * protects @dirty, @bulk_read, @ui_size, and @xattr_size
359
+ * @xattr_sem: serilizes write operations (remove|set|create) on xattr
360360 * @ui_lock: protects @synced_i_size
361361 * @synced_i_size: synchronized size of inode, i.e. the value of inode size
362362 * currently stored on the flash; used only for regular file
....@@ -410,6 +410,7 @@
410410 unsigned int bulk_read:1;
411411 unsigned int compr_type:2;
412412 struct mutex ui_mutex;
413
+ struct rw_semaphore xattr_sem;
413414 spinlock_t ui_lock;
414415 loff_t synced_i_size;
415416 loff_t ui_size;
....@@ -705,6 +706,7 @@
705706 * @jhead: journal head number this bud belongs to
706707 * @list: link in the list buds belonging to the same journal head
707708 * @rb: link in the tree of all buds
709
+ * @log_hash: the log hash from the commit start node up to this bud
708710 */
709711 struct ubifs_bud {
710712 int lnum;
....@@ -712,6 +714,7 @@
712714 int jhead;
713715 struct list_head list;
714716 struct rb_node rb;
717
+ struct shash_desc *log_hash;
715718 };
716719
717720 /**
....@@ -719,6 +722,7 @@
719722 * @wbuf: head's write-buffer
720723 * @buds_list: list of bud LEBs belonging to this journal head
721724 * @grouped: non-zero if UBIFS groups nodes when writing to this journal head
725
+ * @log_hash: the log hash from the commit start node up to this journal head
722726 *
723727 * Note, the @buds list is protected by the @c->buds_lock.
724728 */
....@@ -726,6 +730,7 @@
726730 struct ubifs_wbuf wbuf;
727731 struct list_head buds_list;
728732 unsigned int grouped:1;
733
+ struct shash_desc *log_hash;
729734 };
730735
731736 /**
....@@ -735,6 +740,7 @@
735740 * @lnum: LEB number of the target node (indexing node or data node)
736741 * @offs: target node offset within @lnum
737742 * @len: target node length
743
+ * @hash: the hash of the target node
738744 */
739745 struct ubifs_zbranch {
740746 union ubifs_key key;
....@@ -745,12 +751,15 @@
745751 int lnum;
746752 int offs;
747753 int len;
754
+ u8 hash[UBIFS_HASH_ARR_SZ];
748755 };
749756
750757 /**
751758 * struct ubifs_znode - in-memory representation of an indexing node.
752759 * @parent: parent znode or NULL if it is the root
753760 * @cnext: next znode to commit
761
+ * @cparent: parent node for this commit
762
+ * @ciip: index in cparent's zbranch array
754763 * @flags: znode flags (%DIRTY_ZNODE, %COW_ZNODE or %OBSOLETE_ZNODE)
755764 * @time: last access time (seconds)
756765 * @level: level of the entry in the TNC tree
....@@ -768,6 +777,8 @@
768777 struct ubifs_znode {
769778 struct ubifs_znode *parent;
770779 struct ubifs_znode *cnext;
780
+ struct ubifs_znode *cparent;
781
+ int ciip;
771782 unsigned long flags;
772783 time64_t time;
773784 int level;
....@@ -903,6 +914,8 @@
903914 * @rb: rb-tree node of rb-tree of orphans sorted by inode number
904915 * @list: list head of list of orphans in order added
905916 * @new_list: list head of list of orphans added since the last commit
917
+ * @child_list: list of xattr childs if this orphan hosts xattrs, list head
918
+ * if this orphan is a xattr, not used otherwise.
906919 * @cnext: next orphan to commit
907920 * @dnext: next orphan to delete
908921 * @inum: inode number
....@@ -914,6 +927,7 @@
914927 struct rb_node rb;
915928 struct list_head list;
916929 struct list_head new_list;
930
+ struct list_head child_list;
917931 struct ubifs_orphan *cnext;
918932 struct ubifs_orphan *dnext;
919933 ino_t inum;
....@@ -982,6 +996,7 @@
982996 * struct ubifs_info - UBIFS file-system description data structure
983997 * (per-superblock).
984998 * @vfs_sb: VFS @struct super_block object
999
+ * @sup_node: The super block node as read from the device
9851000 *
9861001 * @highest_inum: highest used inode number
9871002 * @max_sqnum: current global sequence number
....@@ -1027,6 +1042,7 @@
10271042 * @default_compr: default compression algorithm (%UBIFS_COMPR_LZO, etc)
10281043 * @rw_incompat: the media is not R/W compatible
10291044 * @assert_action: action to take when a ubifs_assert() fails
1045
+ * @authenticated: flag indigating the FS is mounted in authenticated mode
10301046 *
10311047 * @tnc_mutex: protects the Tree Node Cache (TNC), @zroot, @cnext, @enext, and
10321048 * @calc_idx_sz
....@@ -1074,6 +1090,7 @@
10741090 * @key_hash: direntry key hash function
10751091 * @key_fmt: key format
10761092 * @key_len: key length
1093
+ * @hash_len: The length of the index node hashes
10771094 * @fanout: fanout of the index tree (number of links per indexing node)
10781095 *
10791096 * @min_io_size: minimal input/output unit size
....@@ -1089,7 +1106,6 @@
10891106 * used to store indexing nodes (@leb_size - @max_idx_node_sz)
10901107 * @leb_cnt: count of logical eraseblocks
10911108 * @max_leb_cnt: maximum count of logical eraseblocks
1092
- * @old_leb_cnt: count of logical eraseblocks before re-size
10931109 * @ro_media: the underlying UBI volume is read-only
10941110 * @ro_mount: the file-system was mounted as read-only
10951111 * @ro_error: UBIFS switched to R/O mode because an error happened
....@@ -1209,6 +1225,15 @@
12091225 * @rp_uid: reserved pool user ID
12101226 * @rp_gid: reserved pool group ID
12111227 *
1228
+ * @hash_tfm: the hash transformation used for hashing nodes
1229
+ * @hmac_tfm: the HMAC transformation for this filesystem
1230
+ * @hmac_desc_len: length of the HMAC used for authentication
1231
+ * @auth_key_name: the authentication key name
1232
+ * @auth_hash_name: the name of the hash algorithm used for authentication
1233
+ * @auth_hash_algo: the authentication hash used for this fs
1234
+ * @log_hash: the log hash from the commit start node up to the latest reference
1235
+ * node.
1236
+ *
12121237 * @empty: %1 if the UBI device is empty
12131238 * @need_recovery: %1 if the file-system needs recovery
12141239 * @replaying: %1 during journal replay
....@@ -1229,6 +1254,7 @@
12291254 */
12301255 struct ubifs_info {
12311256 struct super_block *vfs_sb;
1257
+ struct ubifs_sb_node *sup_node;
12321258
12331259 ino_t highest_inum;
12341260 unsigned long long max_sqnum;
....@@ -1269,6 +1295,8 @@
12691295 unsigned int default_compr:2;
12701296 unsigned int rw_incompat:1;
12711297 unsigned int assert_action:2;
1298
+ unsigned int authenticated:1;
1299
+ unsigned int superblock_need_write:1;
12721300
12731301 struct mutex tnc_mutex;
12741302 struct ubifs_zbranch zroot;
....@@ -1313,6 +1341,7 @@
13131341 uint32_t (*key_hash)(const char *str, int len);
13141342 int key_fmt;
13151343 int key_len;
1344
+ int hash_len;
13161345 int fanout;
13171346
13181347 int min_io_size;
....@@ -1325,7 +1354,6 @@
13251354 int idx_leb_size;
13261355 int leb_cnt;
13271356 int max_leb_cnt;
1328
- int old_leb_cnt;
13291357 unsigned int ro_media:1;
13301358 unsigned int ro_mount:1;
13311359 unsigned int ro_error:1;
....@@ -1440,6 +1468,15 @@
14401468 kuid_t rp_uid;
14411469 kgid_t rp_gid;
14421470
1471
+ struct crypto_shash *hash_tfm;
1472
+ struct crypto_shash *hmac_tfm;
1473
+ int hmac_desc_len;
1474
+ char *auth_key_name;
1475
+ char *auth_hash_name;
1476
+ enum hash_algo auth_hash_algo;
1477
+
1478
+ struct shash_desc *log_hash;
1479
+
14431480 /* The below fields are used only during mounting and re-mounting */
14441481 unsigned int empty:1;
14451482 unsigned int need_recovery:1;
....@@ -1469,6 +1506,204 @@
14691506 extern const struct inode_operations ubifs_dir_inode_operations;
14701507 extern const struct inode_operations ubifs_symlink_inode_operations;
14711508 extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
1509
+extern int ubifs_default_version;
1510
+
1511
+/* auth.c */
1512
+static inline int ubifs_authenticated(const struct ubifs_info *c)
1513
+{
1514
+ return (IS_ENABLED(CONFIG_UBIFS_FS_AUTHENTICATION)) && c->authenticated;
1515
+}
1516
+
1517
+struct shash_desc *__ubifs_hash_get_desc(const struct ubifs_info *c);
1518
+static inline struct shash_desc *ubifs_hash_get_desc(const struct ubifs_info *c)
1519
+{
1520
+ return ubifs_authenticated(c) ? __ubifs_hash_get_desc(c) : NULL;
1521
+}
1522
+
1523
+static inline int ubifs_shash_init(const struct ubifs_info *c,
1524
+ struct shash_desc *desc)
1525
+{
1526
+ if (ubifs_authenticated(c))
1527
+ return crypto_shash_init(desc);
1528
+ else
1529
+ return 0;
1530
+}
1531
+
1532
+static inline int ubifs_shash_update(const struct ubifs_info *c,
1533
+ struct shash_desc *desc, const void *buf,
1534
+ unsigned int len)
1535
+{
1536
+ int err = 0;
1537
+
1538
+ if (ubifs_authenticated(c)) {
1539
+ err = crypto_shash_update(desc, buf, len);
1540
+ if (err < 0)
1541
+ return err;
1542
+ }
1543
+
1544
+ return 0;
1545
+}
1546
+
1547
+static inline int ubifs_shash_final(const struct ubifs_info *c,
1548
+ struct shash_desc *desc, u8 *out)
1549
+{
1550
+ return ubifs_authenticated(c) ? crypto_shash_final(desc, out) : 0;
1551
+}
1552
+
1553
+int __ubifs_node_calc_hash(const struct ubifs_info *c, const void *buf,
1554
+ u8 *hash);
1555
+static inline int ubifs_node_calc_hash(const struct ubifs_info *c,
1556
+ const void *buf, u8 *hash)
1557
+{
1558
+ if (ubifs_authenticated(c))
1559
+ return __ubifs_node_calc_hash(c, buf, hash);
1560
+ else
1561
+ return 0;
1562
+}
1563
+
1564
+int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
1565
+ struct shash_desc *inhash);
1566
+
1567
+/**
1568
+ * ubifs_check_hash - compare two hashes
1569
+ * @c: UBIFS file-system description object
1570
+ * @expected: first hash
1571
+ * @got: second hash
1572
+ *
1573
+ * Compare two hashes @expected and @got. Returns 0 when they are equal, a
1574
+ * negative error code otherwise.
1575
+ */
1576
+static inline int ubifs_check_hash(const struct ubifs_info *c,
1577
+ const u8 *expected, const u8 *got)
1578
+{
1579
+ return crypto_memneq(expected, got, c->hash_len);
1580
+}
1581
+
1582
+/**
1583
+ * ubifs_check_hmac - compare two HMACs
1584
+ * @c: UBIFS file-system description object
1585
+ * @expected: first HMAC
1586
+ * @got: second HMAC
1587
+ *
1588
+ * Compare two hashes @expected and @got. Returns 0 when they are equal, a
1589
+ * negative error code otherwise.
1590
+ */
1591
+static inline int ubifs_check_hmac(const struct ubifs_info *c,
1592
+ const u8 *expected, const u8 *got)
1593
+{
1594
+ return crypto_memneq(expected, got, c->hmac_desc_len);
1595
+}
1596
+
1597
+#ifdef CONFIG_UBIFS_FS_AUTHENTICATION
1598
+void ubifs_bad_hash(const struct ubifs_info *c, const void *node,
1599
+ const u8 *hash, int lnum, int offs);
1600
+#else
1601
+static inline void ubifs_bad_hash(const struct ubifs_info *c, const void *node,
1602
+ const u8 *hash, int lnum, int offs) {};
1603
+#endif
1604
+
1605
+int __ubifs_node_check_hash(const struct ubifs_info *c, const void *buf,
1606
+ const u8 *expected);
1607
+static inline int ubifs_node_check_hash(const struct ubifs_info *c,
1608
+ const void *buf, const u8 *expected)
1609
+{
1610
+ if (ubifs_authenticated(c))
1611
+ return __ubifs_node_check_hash(c, buf, expected);
1612
+ else
1613
+ return 0;
1614
+}
1615
+
1616
+int ubifs_init_authentication(struct ubifs_info *c);
1617
+void __ubifs_exit_authentication(struct ubifs_info *c);
1618
+static inline void ubifs_exit_authentication(struct ubifs_info *c)
1619
+{
1620
+ if (ubifs_authenticated(c))
1621
+ __ubifs_exit_authentication(c);
1622
+}
1623
+
1624
+/**
1625
+ * ubifs_branch_hash - returns a pointer to the hash of a branch
1626
+ * @c: UBIFS file-system description object
1627
+ * @br: branch to get the hash from
1628
+ *
1629
+ * This returns a pointer to the hash of a branch. Since the key already is a
1630
+ * dynamically sized object we cannot use a struct member here.
1631
+ */
1632
+static inline u8 *ubifs_branch_hash(struct ubifs_info *c,
1633
+ struct ubifs_branch *br)
1634
+{
1635
+ return (void *)br + sizeof(*br) + c->key_len;
1636
+}
1637
+
1638
+/**
1639
+ * ubifs_copy_hash - copy a hash
1640
+ * @c: UBIFS file-system description object
1641
+ * @from: source hash
1642
+ * @to: destination hash
1643
+ *
1644
+ * With authentication this copies a hash, otherwise does nothing.
1645
+ */
1646
+static inline void ubifs_copy_hash(const struct ubifs_info *c, const u8 *from,
1647
+ u8 *to)
1648
+{
1649
+ if (ubifs_authenticated(c))
1650
+ memcpy(to, from, c->hash_len);
1651
+}
1652
+
1653
+int __ubifs_node_insert_hmac(const struct ubifs_info *c, void *buf,
1654
+ int len, int ofs_hmac);
1655
+static inline int ubifs_node_insert_hmac(const struct ubifs_info *c, void *buf,
1656
+ int len, int ofs_hmac)
1657
+{
1658
+ if (ubifs_authenticated(c))
1659
+ return __ubifs_node_insert_hmac(c, buf, len, ofs_hmac);
1660
+ else
1661
+ return 0;
1662
+}
1663
+
1664
+int __ubifs_node_verify_hmac(const struct ubifs_info *c, const void *buf,
1665
+ int len, int ofs_hmac);
1666
+static inline int ubifs_node_verify_hmac(const struct ubifs_info *c,
1667
+ const void *buf, int len, int ofs_hmac)
1668
+{
1669
+ if (ubifs_authenticated(c))
1670
+ return __ubifs_node_verify_hmac(c, buf, len, ofs_hmac);
1671
+ else
1672
+ return 0;
1673
+}
1674
+
1675
+/**
1676
+ * ubifs_auth_node_sz - returns the size of an authentication node
1677
+ * @c: UBIFS file-system description object
1678
+ *
1679
+ * This function returns the size of an authentication node which can
1680
+ * be 0 for unauthenticated filesystems or the real size of an auth node
1681
+ * authentication is enabled.
1682
+ */
1683
+static inline int ubifs_auth_node_sz(const struct ubifs_info *c)
1684
+{
1685
+ if (ubifs_authenticated(c))
1686
+ return sizeof(struct ubifs_auth_node) + c->hmac_desc_len;
1687
+ else
1688
+ return 0;
1689
+}
1690
+int ubifs_sb_verify_signature(struct ubifs_info *c,
1691
+ const struct ubifs_sb_node *sup);
1692
+bool ubifs_hmac_zero(struct ubifs_info *c, const u8 *hmac);
1693
+
1694
+int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac);
1695
+
1696
+int __ubifs_shash_copy_state(const struct ubifs_info *c, struct shash_desc *src,
1697
+ struct shash_desc *target);
1698
+static inline int ubifs_shash_copy_state(const struct ubifs_info *c,
1699
+ struct shash_desc *src,
1700
+ struct shash_desc *target)
1701
+{
1702
+ if (ubifs_authenticated(c))
1703
+ return __ubifs_shash_copy_state(c, src, target);
1704
+ else
1705
+ return 0;
1706
+}
14721707
14731708 /* io.c */
14741709 void ubifs_ro_mode(struct ubifs_info *c, int err);
....@@ -1489,9 +1724,15 @@
14891724 int lnum, int offs);
14901725 int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum,
14911726 int offs);
1727
+int ubifs_write_node_hmac(struct ubifs_info *c, void *buf, int len, int lnum,
1728
+ int offs, int hmac_offs);
14921729 int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
14931730 int offs, int quiet, int must_chk_crc);
1731
+void ubifs_init_node(struct ubifs_info *c, void *buf, int len, int pad);
1732
+void ubifs_crc_node(struct ubifs_info *c, void *buf, int len);
14941733 void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad);
1734
+int ubifs_prepare_node_hmac(struct ubifs_info *c, void *node, int len,
1735
+ int hmac_offs, int pad);
14951736 void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last);
14961737 int ubifs_io_init(struct ubifs_info *c);
14971738 void ubifs_pad(const struct ubifs_info *c, void *buf, int pad);
....@@ -1591,11 +1832,12 @@
15911832 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key,
15921833 void *node, int *lnum, int *offs);
15931834 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum,
1594
- int offs, int len);
1835
+ int offs, int len, const u8 *hash);
15951836 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key,
15961837 int old_lnum, int old_offs, int lnum, int offs, int len);
15971838 int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key,
1598
- int lnum, int offs, int len, const struct fscrypt_name *nm);
1839
+ int lnum, int offs, int len, const u8 *hash,
1840
+ const struct fscrypt_name *nm);
15991841 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key);
16001842 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key,
16011843 const struct fscrypt_name *nm);
....@@ -1658,12 +1900,12 @@
16581900 void ubifs_wait_for_commit(struct ubifs_info *c);
16591901
16601902 /* master.c */
1903
+int ubifs_compare_master_node(struct ubifs_info *c, void *m1, void *m2);
16611904 int ubifs_read_master(struct ubifs_info *c);
16621905 int ubifs_write_master(struct ubifs_info *c);
16631906
16641907 /* sb.c */
16651908 int ubifs_read_superblock(struct ubifs_info *c);
1666
-struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c);
16671909 int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup);
16681910 int ubifs_fixup_free_space(struct ubifs_info *c);
16691911 int ubifs_enable_encryption(struct ubifs_info *c);
....@@ -1692,7 +1934,7 @@
16921934 /* lpt.c */
16931935 int ubifs_calc_lpt_geom(struct ubifs_info *c);
16941936 int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first,
1695
- int *lpt_lebs, int *big_lpt);
1937
+ int *lpt_lebs, int *big_lpt, u8 *hash);
16961938 int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr);
16971939 struct ubifs_lprops *ubifs_lpt_lookup(struct ubifs_info *c, int lnum);
16981940 struct ubifs_lprops *ubifs_lpt_lookup_dirty(struct ubifs_info *c, int lnum);
....@@ -1711,6 +1953,7 @@
17111953 struct ubifs_nnode *parent, int iip);
17121954 struct ubifs_nnode *ubifs_get_nnode(struct ubifs_info *c,
17131955 struct ubifs_nnode *parent, int iip);
1956
+struct ubifs_pnode *ubifs_pnode_lookup(struct ubifs_info *c, int i);
17141957 int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip);
17151958 void ubifs_add_lpt_dirt(struct ubifs_info *c, int lnum, int dirty);
17161959 void ubifs_add_nnode_dirt(struct ubifs_info *c, struct ubifs_nnode *nnode);
....@@ -1719,6 +1962,7 @@
17191962 /* Needed only in debugging code in lpt_commit.c */
17201963 int ubifs_unpack_nnode(const struct ubifs_info *c, void *buf,
17211964 struct ubifs_nnode *nnode);
1965
+int ubifs_lpt_calc_hash(struct ubifs_info *c, u8 *hash);
17221966
17231967 /* lpt_commit.c */
17241968 int ubifs_lpt_start_commit(struct ubifs_info *c);
....@@ -1753,9 +1997,7 @@
17531997 /* file.c */
17541998 int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
17551999 int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
1756
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
17572000 int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags);
1758
-#endif
17592001
17602002 /* dir.c */
17612003 struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
....@@ -1774,9 +2016,14 @@
17742016
17752017 #ifdef CONFIG_UBIFS_FS_XATTR
17762018 void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum);
2019
+int ubifs_purge_xattrs(struct inode *host);
17772020 #else
17782021 static inline void ubifs_evict_xattr_inode(struct ubifs_info *c,
17792022 ino_t xattr_inum) { }
2023
+static inline int ubifs_purge_xattrs(struct inode *host)
2024
+{
2025
+ return 0;
2026
+}
17802027 #endif
17812028
17822029 #ifdef CONFIG_UBIFS_FS_SECURITY
....@@ -1806,7 +2053,7 @@
18062053 int ubifs_rcvry_gc_commit(struct ubifs_info *c);
18072054 int ubifs_recover_size_accum(struct ubifs_info *c, union ubifs_key *key,
18082055 int deletion, loff_t new_size);
1809
-int ubifs_recover_size(struct ubifs_info *c);
2056
+int ubifs_recover_size(struct ubifs_info *c, bool in_place);
18102057 void ubifs_destroy_size_tree(struct ubifs_info *c);
18112058
18122059 /* ioctl.c */
....@@ -1855,13 +2102,6 @@
18552102 #endif
18562103
18572104 extern const struct fscrypt_operations ubifs_crypt_operations;
1858
-
1859
-static inline bool ubifs_crypt_is_encrypted(const struct inode *inode)
1860
-{
1861
- const struct ubifs_inode *ui = ubifs_inode(inode);
1862
-
1863
- return ui->flags & UBIFS_CRYPT_FL;
1864
-}
18652105
18662106 /* Normal UBIFS messages */
18672107 __printf(2, 3)