ubifs.h (5d8dfaa71d87f742c53309b95cb6a8b274119027) ubifs.h (2e3cbf425804fb44a005e252f88f93dff108c911)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * This file is part of UBIFS.
4 *
5 * Copyright (C) 2006-2008 Nokia Corporation
6 *
7 * Authors: Artem Bityutskiy (Битюцкий Артём)
8 * Adrian Hunter

--- 13 unchanged lines hidden (view full) ---

22#include <linux/mutex.h>
23#include <linux/rwsem.h>
24#include <linux/mtd/ubi.h>
25#include <linux/pagemap.h>
26#include <linux/backing-dev.h>
27#include <linux/security.h>
28#include <linux/xattr.h>
29#include <linux/random.h>
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * This file is part of UBIFS.
4 *
5 * Copyright (C) 2006-2008 Nokia Corporation
6 *
7 * Authors: Artem Bityutskiy (Битюцкий Артём)
8 * Adrian Hunter

--- 13 unchanged lines hidden (view full) ---

22#include <linux/mutex.h>
23#include <linux/rwsem.h>
24#include <linux/mtd/ubi.h>
25#include <linux/pagemap.h>
26#include <linux/backing-dev.h>
27#include <linux/security.h>
28#include <linux/xattr.h>
29#include <linux/random.h>
30#include <linux/sysfs.h>
31#include <linux/completion.h>
30#include <crypto/hash_info.h>
31#include <crypto/hash.h>
32#include <crypto/algapi.h>
33
34#include <linux/fscrypt.h>
35
36#include "ubifs-media.h"
37

--- 113 unchanged lines hidden (view full) ---

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
157
158/*
32#include <crypto/hash_info.h>
33#include <crypto/hash.h>
34#include <crypto/algapi.h>
35
36#include <linux/fscrypt.h>
37
38#include "ubifs-media.h"
39

--- 113 unchanged lines hidden (view full) ---

153#define UBIFS_HASH_ARR_SZ UBIFS_MAX_HASH_LEN
154#define UBIFS_HMAC_ARR_SZ UBIFS_MAX_HMAC_LEN
155#else
156#define UBIFS_HASH_ARR_SZ 0
157#define UBIFS_HMAC_ARR_SZ 0
158#endif
159
160/*
161 * The UBIFS sysfs directory name pattern and maximum name length (3 for "ubi"
162 * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte.
163 */
164#define UBIFS_DFS_DIR_NAME "ubi%d_%d"
165#define UBIFS_DFS_DIR_LEN (3 + 1 + 2*2 + 1)
166
167/*
159 * Lockdep classes for UBIFS inode @ui_mutex.
160 */
161enum {
162 WB_MUTEX_1 = 0,
163 WB_MUTEX_2 = 1,
164 WB_MUTEX_3 = 2,
165 WB_MUTEX_4 = 3,
166};

--- 818 unchanged lines hidden (view full) ---

985 int min_idx_lebs;
986 unsigned int nospace:1;
987 unsigned int nospace_rp:1;
988 int page_budget;
989 int inode_budget;
990 int dent_budget;
991};
992
168 * Lockdep classes for UBIFS inode @ui_mutex.
169 */
170enum {
171 WB_MUTEX_1 = 0,
172 WB_MUTEX_2 = 1,
173 WB_MUTEX_3 = 2,
174 WB_MUTEX_4 = 3,
175};

--- 818 unchanged lines hidden (view full) ---

994 int min_idx_lebs;
995 unsigned int nospace:1;
996 unsigned int nospace_rp:1;
997 int page_budget;
998 int inode_budget;
999 int dent_budget;
1000};
1001
1002/**
1003 * ubifs_stats_info - per-FS statistics information.
1004 * @magic_errors: number of bad magic numbers (will be reset with a new mount).
1005 * @node_errors: number of bad nodes (will be reset with a new mount).
1006 * @crc_errors: number of bad crcs (will be reset with a new mount).
1007 */
1008struct ubifs_stats_info {
1009 unsigned int magic_errors;
1010 unsigned int node_errors;
1011 unsigned int crc_errors;
1012};
1013
993struct ubifs_debug_info;
994
995/**
996 * struct ubifs_info - UBIFS file-system description data structure
997 * (per-superblock).
998 * @vfs_sb: VFS @struct super_block object
999 * @sup_node: The super block node as read from the device
1000 *

--- 245 unchanged lines hidden (view full) ---

1246 * @unclean_leb_list: LEBs to recover when re-mounting R/O mounted FS to R/W
1247 * mode
1248 * @rcvrd_mst_node: recovered master node to write when re-mounting R/O mounted
1249 * FS to R/W mode
1250 * @size_tree: inode size information for recovery
1251 * @mount_opts: UBIFS-specific mount options
1252 *
1253 * @dbg: debugging-related information
1014struct ubifs_debug_info;
1015
1016/**
1017 * struct ubifs_info - UBIFS file-system description data structure
1018 * (per-superblock).
1019 * @vfs_sb: VFS @struct super_block object
1020 * @sup_node: The super block node as read from the device
1021 *

--- 245 unchanged lines hidden (view full) ---

1267 * @unclean_leb_list: LEBs to recover when re-mounting R/O mounted FS to R/W
1268 * mode
1269 * @rcvrd_mst_node: recovered master node to write when re-mounting R/O mounted
1270 * FS to R/W mode
1271 * @size_tree: inode size information for recovery
1272 * @mount_opts: UBIFS-specific mount options
1273 *
1274 * @dbg: debugging-related information
1275 * @stats: statistics exported over sysfs
1276 *
1277 * @kobj: kobject for /sys/fs/ubifs/
1278 * @kobj_unregister: completion to unregister sysfs kobject
1254 */
1255struct ubifs_info {
1256 struct super_block *vfs_sb;
1257 struct ubifs_sb_node *sup_node;
1258
1259 ino_t highest_inum;
1260 unsigned long long max_sqnum;
1261 unsigned long long cmt_no;

--- 19 unchanged lines hidden (view full) ---

1281 struct list_head old_buds;
1282 int max_bud_cnt;
1283
1284 struct rw_semaphore commit_sem;
1285 int cmt_state;
1286 spinlock_t cs_lock;
1287 wait_queue_head_t cmt_wq;
1288
1279 */
1280struct ubifs_info {
1281 struct super_block *vfs_sb;
1282 struct ubifs_sb_node *sup_node;
1283
1284 ino_t highest_inum;
1285 unsigned long long max_sqnum;
1286 unsigned long long cmt_no;

--- 19 unchanged lines hidden (view full) ---

1306 struct list_head old_buds;
1307 int max_bud_cnt;
1308
1309 struct rw_semaphore commit_sem;
1310 int cmt_state;
1311 spinlock_t cs_lock;
1312 wait_queue_head_t cmt_wq;
1313
1314 struct kobject kobj;
1315 struct completion kobj_unregister;
1316
1289 unsigned int big_lpt:1;
1290 unsigned int space_fixup:1;
1291 unsigned int double_hash:1;
1292 unsigned int encrypted:1;
1293 unsigned int no_chk_data_crc:1;
1294 unsigned int bulk_read:1;
1295 unsigned int default_compr:2;
1296 unsigned int rw_incompat:1;

--- 191 unchanged lines hidden (view full) ---

1488 struct list_head replay_buds;
1489 unsigned long long cs_sqnum;
1490 struct list_head unclean_leb_list;
1491 struct ubifs_mst_node *rcvrd_mst_node;
1492 struct rb_root size_tree;
1493 struct ubifs_mount_opts mount_opts;
1494
1495 struct ubifs_debug_info *dbg;
1317 unsigned int big_lpt:1;
1318 unsigned int space_fixup:1;
1319 unsigned int double_hash:1;
1320 unsigned int encrypted:1;
1321 unsigned int no_chk_data_crc:1;
1322 unsigned int bulk_read:1;
1323 unsigned int default_compr:2;
1324 unsigned int rw_incompat:1;

--- 191 unchanged lines hidden (view full) ---

1516 struct list_head replay_buds;
1517 unsigned long long cs_sqnum;
1518 struct list_head unclean_leb_list;
1519 struct ubifs_mst_node *rcvrd_mst_node;
1520 struct rb_root size_tree;
1521 struct ubifs_mount_opts mount_opts;
1522
1523 struct ubifs_debug_info *dbg;
1524 struct ubifs_stats_info *stats;
1496};
1497
1498extern struct list_head ubifs_infos;
1499extern spinlock_t ubifs_infos_lock;
1500extern atomic_long_t ubifs_clean_zn_cnt;
1501extern const struct super_operations ubifs_super_operations;
1502extern const struct address_space_operations ubifs_file_address_operations;
1503extern const struct file_operations ubifs_file_operations;

--- 563 unchanged lines hidden (view full) ---

2067/* compressor.c */
2068int __init ubifs_compressors_init(void);
2069void ubifs_compressors_exit(void);
2070void ubifs_compress(const struct ubifs_info *c, const void *in_buf, int in_len,
2071 void *out_buf, int *out_len, int *compr_type);
2072int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len,
2073 void *out, int *out_len, int compr_type);
2074
1525};
1526
1527extern struct list_head ubifs_infos;
1528extern spinlock_t ubifs_infos_lock;
1529extern atomic_long_t ubifs_clean_zn_cnt;
1530extern const struct super_operations ubifs_super_operations;
1531extern const struct address_space_operations ubifs_file_address_operations;
1532extern const struct file_operations ubifs_file_operations;

--- 563 unchanged lines hidden (view full) ---

2096/* compressor.c */
2097int __init ubifs_compressors_init(void);
2098void ubifs_compressors_exit(void);
2099void ubifs_compress(const struct ubifs_info *c, const void *in_buf, int in_len,
2100 void *out_buf, int *out_len, int *compr_type);
2101int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len,
2102 void *out, int *out_len, int compr_type);
2103
2104/* sysfs.c */
2105int ubifs_sysfs_init(void);
2106void ubifs_sysfs_exit(void);
2107int ubifs_sysfs_register(struct ubifs_info *c);
2108void ubifs_sysfs_unregister(struct ubifs_info *c);
2109
2075#include "debug.h"
2076#include "misc.h"
2077#include "key.h"
2078
2079#ifndef CONFIG_FS_ENCRYPTION
2080static inline int ubifs_encrypt(const struct inode *inode,
2081 struct ubifs_data_node *dn,
2082 unsigned int in_len, unsigned int *out_len,

--- 42 unchanged lines hidden ---
2110#include "debug.h"
2111#include "misc.h"
2112#include "key.h"
2113
2114#ifndef CONFIG_FS_ENCRYPTION
2115static inline int ubifs_encrypt(const struct inode *inode,
2116 struct ubifs_data_node *dn,
2117 unsigned int in_len, unsigned int *out_len,

--- 42 unchanged lines hidden ---