| .. | .. | 
|---|
 | 1 | +/* SPDX-License-Identifier: GPL-2.0-only */  | 
|---|
| 1 | 2 |  /* | 
|---|
| 2 | 3 |   * This file is part of UBIFS. | 
|---|
| 3 | 4 |   * | 
|---|
| 4 | 5 |   * 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  | 
|---|
| 18 | 6 |   * | 
|---|
| 19 | 7 |   * Authors: Artem Bityutskiy (Битюцкий Артём) | 
|---|
| 20 | 8 |   *          Adrian Hunter | 
|---|
| .. | .. | 
|---|
| 133 | 121 |   * ubifs_wbuf_sync - synchronize write-buffer. | 
|---|
| 134 | 122 |   * @wbuf: write-buffer to synchronize | 
|---|
| 135 | 123 |   * | 
|---|
| 136 |  | - * This is the same as as 'ubifs_wbuf_sync_nolock()' but it does not assume  | 
|---|
 | 124 | + * This is the same as 'ubifs_wbuf_sync_nolock()' but it does not assume  | 
|---|
| 137 | 125 |   * that the write-buffer is already locked. | 
|---|
| 138 | 126 |   */ | 
|---|
| 139 | 127 |  static inline int ubifs_wbuf_sync(struct ubifs_wbuf *wbuf) | 
|---|
| .. | .. | 
|---|
| 197 | 185 |   */ | 
|---|
| 198 | 186 |  static inline int ubifs_idx_node_sz(const struct ubifs_info *c, int child_cnt) | 
|---|
| 199 | 187 |  { | 
|---|
| 200 |  | -	return UBIFS_IDX_NODE_SZ + (UBIFS_BRANCH_SZ + c->key_len) * child_cnt;  | 
|---|
 | 188 | +	return UBIFS_IDX_NODE_SZ + (UBIFS_BRANCH_SZ + c->key_len + c->hash_len)  | 
|---|
 | 189 | +				   * child_cnt;  | 
|---|
| 201 | 190 |  } | 
|---|
| 202 | 191 |   | 
|---|
| 203 | 192 |  /** | 
|---|
| .. | .. | 
|---|
| 212 | 201 |  				      int bnum) | 
|---|
| 213 | 202 |  { | 
|---|
| 214 | 203 |  	return (struct ubifs_branch *)((void *)idx->branches + | 
|---|
| 215 |  | -				       (UBIFS_BRANCH_SZ + c->key_len) * bnum);  | 
|---|
 | 204 | +			(UBIFS_BRANCH_SZ + c->key_len + c->hash_len) * bnum);  | 
|---|
| 216 | 205 |  } | 
|---|
| 217 | 206 |   | 
|---|
| 218 | 207 |  /** | 
|---|
| .. | .. | 
|---|
| 287 | 276 |  	return lnum; | 
|---|
| 288 | 277 |  } | 
|---|
| 289 | 278 |   | 
|---|
 | 279 | +static inline int ubifs_xattr_max_cnt(struct ubifs_info *c)  | 
|---|
 | 280 | +{  | 
|---|
 | 281 | +	int max_xattrs = (c->leb_size / 2) / UBIFS_INO_NODE_SZ;  | 
|---|
 | 282 | +  | 
|---|
 | 283 | +	ubifs_assert(c, max_xattrs < c->max_orphans);  | 
|---|
 | 284 | +	return max_xattrs;  | 
|---|
 | 285 | +}  | 
|---|
 | 286 | +  | 
|---|
| 290 | 287 |  const char *ubifs_assert_action_name(struct ubifs_info *c); | 
|---|
| 291 | 288 |   | 
|---|
| 292 | 289 |  #endif /* __UBIFS_MISC_H__ */ | 
|---|