13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15 #include <linux/capability.h>
16 #include <linux/kernel.h>
17 #include <linux/sched.h>
19 #include <linux/list.h>
22 #include <linux/slab.h>
37 unsigned char *mdata =
NULL;
53 mdatalen = jffs2_encode_dev(&dev, inode->
i_rdev);
55 jffs2_dbg(1,
"%s(): Writing %d bytes of kdev_t\n",
72 jffs2_dbg(1,
"%s(): Writing %d bytes of symlink target\n",
126 }
else if (ivalid & ATTR_SIZE && !iattr->
ia_size) {
141 if (IS_ERR(new_metadata)) {
145 return PTR_ERR(new_metadata);
259 jffs2_dbg(1,
"%s(): ino == %lu\n", __func__, ino);
270 jffs2_init_inode_info(f);
308 if (inode->
i_ino == 1)
327 pr_notice(
"Device node has strange size %d\n",
331 jffs2_dbg(1,
"Reading device numbers from flash\n");
335 pr_notice(
"Read device numbers for inode %lu failed\n",
336 (
unsigned long)inode->
i_ino);
351 pr_warn(
"%s(): Bogus i_mode %o for ino %lu\n",
352 __func__, inode->
i_mode, (
unsigned long)inode->
i_ino);
357 jffs2_dbg(1,
"jffs2_read_inode() returning\n");
375 jffs2_dbg(2,
"%s(): not calling setattr() for ino #%lu\n",
376 __func__, inode->
i_ino);
380 jffs2_dbg(1,
"%s(): calling setattr() for ino #%lu\n",
381 __func__, inode->
i_ino);
429 jffs2_dbg(1,
"%s(): dir_i %ld, mode 0x%x\n",
430 __func__, dir_i->
i_ino, mode);
440 jffs2_init_inode_info(f);
443 memset(ri, 0,
sizeof(*ri));
489 static int calculate_inocache_hashsize(
uint32_t flash_size)
498 int size_mb = flash_size / 1024 / 1024;
499 int hashsize = (size_mb * 2) & ~0x3f;
512 struct inode *root_i;
518 #ifndef CONFIG_JFFS2_FS_WRITEBUFFER
520 pr_err(
"Cannot operate on NAND flash unless jffs2 NAND support is compiled in\n");
524 pr_err(
"Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in\n");
538 pr_info(
"Flash size not aligned to erasesize, reducing to %dKiB\n",
543 pr_err(
"Too few erase blocks (%d)\n",
551 ret = jffs2_flash_setup(c);
567 jffs2_dbg(1,
"%s(): Getting root inode\n", __func__);
569 if (IS_ERR(root_i)) {
571 ret = PTR_ERR(root_i);
577 jffs2_dbg(1,
"%s(): d_make_root()\n", __func__);
593 if (jffs2_blocks_use_vmalloc(c))
613 int inum,
int unlinked)
635 jffs2_dbg(1,
"ilookup() failed for ino #%u; inode is probably deleted.\n",
641 jffs2_dbg(1,
"Inode cache for ino #%u is gone\n",
648 jffs2_dbg(1,
"Waiting for ino #%u in state %d\n",
664 return ERR_CAST(inode);
667 pr_notice(
"Eep. read_inode() failed for ino #%u. unlinked %d\n",
671 return ERR_PTR(-
EIO);
690 *priv = (
unsigned long)pg;
698 struct page *
pg = (
void *)*priv;