forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
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,199 @@
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
+void ubifs_bad_hash(const struct ubifs_info *c, const void *node,
1598
+ const u8 *hash, int lnum, int offs);
1599
+
1600
+int __ubifs_node_check_hash(const struct ubifs_info *c, const void *buf,
1601
+ const u8 *expected);
1602
+static inline int ubifs_node_check_hash(const struct ubifs_info *c,
1603
+ const void *buf, const u8 *expected)
1604
+{
1605
+ if (ubifs_authenticated(c))
1606
+ return __ubifs_node_check_hash(c, buf, expected);
1607
+ else
1608
+ return 0;
1609
+}
1610
+
1611
+int ubifs_init_authentication(struct ubifs_info *c);
1612
+void __ubifs_exit_authentication(struct ubifs_info *c);
1613
+static inline void ubifs_exit_authentication(struct ubifs_info *c)
1614
+{
1615
+ if (ubifs_authenticated(c))
1616
+ __ubifs_exit_authentication(c);
1617
+}
1618
+
1619
+/**
1620
+ * ubifs_branch_hash - returns a pointer to the hash of a branch
1621
+ * @c: UBIFS file-system description object
1622
+ * @br: branch to get the hash from
1623
+ *
1624
+ * This returns a pointer to the hash of a branch. Since the key already is a
1625
+ * dynamically sized object we cannot use a struct member here.
1626
+ */
1627
+static inline u8 *ubifs_branch_hash(struct ubifs_info *c,
1628
+ struct ubifs_branch *br)
1629
+{
1630
+ return (void *)br + sizeof(*br) + c->key_len;
1631
+}
1632
+
1633
+/**
1634
+ * ubifs_copy_hash - copy a hash
1635
+ * @c: UBIFS file-system description object
1636
+ * @from: source hash
1637
+ * @to: destination hash
1638
+ *
1639
+ * With authentication this copies a hash, otherwise does nothing.
1640
+ */
1641
+static inline void ubifs_copy_hash(const struct ubifs_info *c, const u8 *from,
1642
+ u8 *to)
1643
+{
1644
+ if (ubifs_authenticated(c))
1645
+ memcpy(to, from, c->hash_len);
1646
+}
1647
+
1648
+int __ubifs_node_insert_hmac(const struct ubifs_info *c, void *buf,
1649
+ int len, int ofs_hmac);
1650
+static inline int ubifs_node_insert_hmac(const struct ubifs_info *c, void *buf,
1651
+ int len, int ofs_hmac)
1652
+{
1653
+ if (ubifs_authenticated(c))
1654
+ return __ubifs_node_insert_hmac(c, buf, len, ofs_hmac);
1655
+ else
1656
+ return 0;
1657
+}
1658
+
1659
+int __ubifs_node_verify_hmac(const struct ubifs_info *c, const void *buf,
1660
+ int len, int ofs_hmac);
1661
+static inline int ubifs_node_verify_hmac(const struct ubifs_info *c,
1662
+ const void *buf, int len, int ofs_hmac)
1663
+{
1664
+ if (ubifs_authenticated(c))
1665
+ return __ubifs_node_verify_hmac(c, buf, len, ofs_hmac);
1666
+ else
1667
+ return 0;
1668
+}
1669
+
1670
+/**
1671
+ * ubifs_auth_node_sz - returns the size of an authentication node
1672
+ * @c: UBIFS file-system description object
1673
+ *
1674
+ * This function returns the size of an authentication node which can
1675
+ * be 0 for unauthenticated filesystems or the real size of an auth node
1676
+ * authentication is enabled.
1677
+ */
1678
+static inline int ubifs_auth_node_sz(const struct ubifs_info *c)
1679
+{
1680
+ if (ubifs_authenticated(c))
1681
+ return sizeof(struct ubifs_auth_node) + c->hmac_desc_len;
1682
+ else
1683
+ return 0;
1684
+}
1685
+int ubifs_sb_verify_signature(struct ubifs_info *c,
1686
+ const struct ubifs_sb_node *sup);
1687
+bool ubifs_hmac_zero(struct ubifs_info *c, const u8 *hmac);
1688
+
1689
+int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac);
1690
+
1691
+int __ubifs_shash_copy_state(const struct ubifs_info *c, struct shash_desc *src,
1692
+ struct shash_desc *target);
1693
+static inline int ubifs_shash_copy_state(const struct ubifs_info *c,
1694
+ struct shash_desc *src,
1695
+ struct shash_desc *target)
1696
+{
1697
+ if (ubifs_authenticated(c))
1698
+ return __ubifs_shash_copy_state(c, src, target);
1699
+ else
1700
+ return 0;
1701
+}
14721702
14731703 /* io.c */
14741704 void ubifs_ro_mode(struct ubifs_info *c, int err);
....@@ -1489,9 +1719,15 @@
14891719 int lnum, int offs);
14901720 int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum,
14911721 int offs);
1722
+int ubifs_write_node_hmac(struct ubifs_info *c, void *buf, int len, int lnum,
1723
+ int offs, int hmac_offs);
14921724 int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
14931725 int offs, int quiet, int must_chk_crc);
1726
+void ubifs_init_node(struct ubifs_info *c, void *buf, int len, int pad);
1727
+void ubifs_crc_node(struct ubifs_info *c, void *buf, int len);
14941728 void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad);
1729
+int ubifs_prepare_node_hmac(struct ubifs_info *c, void *node, int len,
1730
+ int hmac_offs, int pad);
14951731 void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last);
14961732 int ubifs_io_init(struct ubifs_info *c);
14971733 void ubifs_pad(const struct ubifs_info *c, void *buf, int pad);
....@@ -1591,11 +1827,12 @@
15911827 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key,
15921828 void *node, int *lnum, int *offs);
15931829 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum,
1594
- int offs, int len);
1830
+ int offs, int len, const u8 *hash);
15951831 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key,
15961832 int old_lnum, int old_offs, int lnum, int offs, int len);
15971833 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);
1834
+ int lnum, int offs, int len, const u8 *hash,
1835
+ const struct fscrypt_name *nm);
15991836 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key);
16001837 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key,
16011838 const struct fscrypt_name *nm);
....@@ -1658,12 +1895,12 @@
16581895 void ubifs_wait_for_commit(struct ubifs_info *c);
16591896
16601897 /* master.c */
1898
+int ubifs_compare_master_node(struct ubifs_info *c, void *m1, void *m2);
16611899 int ubifs_read_master(struct ubifs_info *c);
16621900 int ubifs_write_master(struct ubifs_info *c);
16631901
16641902 /* sb.c */
16651903 int ubifs_read_superblock(struct ubifs_info *c);
1666
-struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c);
16671904 int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup);
16681905 int ubifs_fixup_free_space(struct ubifs_info *c);
16691906 int ubifs_enable_encryption(struct ubifs_info *c);
....@@ -1692,7 +1929,7 @@
16921929 /* lpt.c */
16931930 int ubifs_calc_lpt_geom(struct ubifs_info *c);
16941931 int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first,
1695
- int *lpt_lebs, int *big_lpt);
1932
+ int *lpt_lebs, int *big_lpt, u8 *hash);
16961933 int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr);
16971934 struct ubifs_lprops *ubifs_lpt_lookup(struct ubifs_info *c, int lnum);
16981935 struct ubifs_lprops *ubifs_lpt_lookup_dirty(struct ubifs_info *c, int lnum);
....@@ -1711,6 +1948,7 @@
17111948 struct ubifs_nnode *parent, int iip);
17121949 struct ubifs_nnode *ubifs_get_nnode(struct ubifs_info *c,
17131950 struct ubifs_nnode *parent, int iip);
1951
+struct ubifs_pnode *ubifs_pnode_lookup(struct ubifs_info *c, int i);
17141952 int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip);
17151953 void ubifs_add_lpt_dirt(struct ubifs_info *c, int lnum, int dirty);
17161954 void ubifs_add_nnode_dirt(struct ubifs_info *c, struct ubifs_nnode *nnode);
....@@ -1719,6 +1957,7 @@
17191957 /* Needed only in debugging code in lpt_commit.c */
17201958 int ubifs_unpack_nnode(const struct ubifs_info *c, void *buf,
17211959 struct ubifs_nnode *nnode);
1960
+int ubifs_lpt_calc_hash(struct ubifs_info *c, u8 *hash);
17221961
17231962 /* lpt_commit.c */
17241963 int ubifs_lpt_start_commit(struct ubifs_info *c);
....@@ -1753,9 +1992,7 @@
17531992 /* file.c */
17541993 int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
17551994 int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
1756
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
17571995 int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags);
1758
-#endif
17591996
17601997 /* dir.c */
17611998 struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
....@@ -1774,9 +2011,14 @@
17742011
17752012 #ifdef CONFIG_UBIFS_FS_XATTR
17762013 void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum);
2014
+int ubifs_purge_xattrs(struct inode *host);
17772015 #else
17782016 static inline void ubifs_evict_xattr_inode(struct ubifs_info *c,
17792017 ino_t xattr_inum) { }
2018
+static inline int ubifs_purge_xattrs(struct inode *host)
2019
+{
2020
+ return 0;
2021
+}
17802022 #endif
17812023
17822024 #ifdef CONFIG_UBIFS_FS_SECURITY
....@@ -1806,7 +2048,7 @@
18062048 int ubifs_rcvry_gc_commit(struct ubifs_info *c);
18072049 int ubifs_recover_size_accum(struct ubifs_info *c, union ubifs_key *key,
18082050 int deletion, loff_t new_size);
1809
-int ubifs_recover_size(struct ubifs_info *c);
2051
+int ubifs_recover_size(struct ubifs_info *c, bool in_place);
18102052 void ubifs_destroy_size_tree(struct ubifs_info *c);
18112053
18122054 /* ioctl.c */
....@@ -1855,13 +2097,6 @@
18552097 #endif
18562098
18572099 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
-}
18652100
18662101 /* Normal UBIFS messages */
18672102 __printf(2, 3)