summaryrefslogtreecommitdiffstats
path: root/fs/squashfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/squashfs')
-rw-r--r--fs/squashfs/Kconfig2
-rw-r--r--fs/squashfs/Makefile2
-rw-r--r--fs/squashfs/inode.c24
-rw-r--r--fs/squashfs/squashfs.c35
-rw-r--r--fs/squashfs/squashfs.h7
-rw-r--r--fs/squashfs/squashfs_fs_sb.h2
-rw-r--r--fs/squashfs/super.c5
7 files changed, 33 insertions, 44 deletions
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 19b8297af6..af187a2a8a 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
menuconfig FS_SQUASHFS
bool
prompt "squashfs support"
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 81fc7e570d..59a78a24b0 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
obj-y += squashfs.o
obj-y += block.o
obj-y += cache.o
diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index 470536e589..f702f6c0a2 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -44,22 +44,6 @@
#include "squashfs_fs_i.h"
#include "squashfs.h"
-struct inode *iget_locked_squashfs(struct super_block *sb, unsigned long ino)
-{
- struct inode *inode;
- struct squashfs_inode_info *ei;
-
- ei = malloc(sizeof(struct squashfs_inode_info));
- inode = &ei->vfs_inode;
- if (inode) {
- inode->i_ino = ino;
- inode->i_sb = sb;
- inode->i_state = I_SYNC | I_NEW;
- }
-
- return inode;
-}
-
/*
* Initialise VFS inode with the base inode information common to all
* Squashfs inode types. Sqsh_ino contains the unswapped base inode
@@ -94,7 +78,7 @@ static int squashfs_new_inode(struct super_block *sb, struct inode *inode,
struct inode *squashfs_iget(struct super_block *sb, long long ino,
unsigned int ino_number)
{
- struct inode *inode = iget_locked_squashfs(sb, ino_number);
+ struct inode *inode = iget_locked(sb, ino_number);
int err;
TRACE("Entered squashfs_iget\n");
@@ -124,7 +108,6 @@ int squashfs_read_inode(struct inode *inode, long long ino)
int err, type, offset = SQUASHFS_INODE_OFFSET(ino);
union squashfs_inode squashfs_ino;
struct squashfs_base_inode *sqshb_ino = &squashfs_ino.base;
- int xattr_id = SQUASHFS_INVALID_XATTR;
TRACE("Entered squashfs_read_inode: %lld\n", ino);
@@ -213,7 +196,6 @@ int squashfs_read_inode(struct inode *inode, long long ino)
frag_offset = 0;
}
- xattr_id = le32_to_cpu(sqsh_ino->xattr);
inode->i_size = le64_to_cpu(sqsh_ino->file_size);
inode->i_op = &squashfs_inode_ops;
inode->i_mode |= S_IFREG;
@@ -265,7 +247,6 @@ int squashfs_read_inode(struct inode *inode, long long ino)
if (err < 0)
goto failed_read;
- xattr_id = le32_to_cpu(sqsh_ino->xattr);
inode->i_size = le32_to_cpu(sqsh_ino->file_size);
inode->i_op = &squashfs_dir_inode_ops;
inode->i_fop = &squashfs_dir_ops;
@@ -310,7 +291,6 @@ int squashfs_read_inode(struct inode *inode, long long ino)
&offset, sizeof(xattr));
if (err < 0)
goto failed_read;
- xattr_id = le32_to_cpu(xattr);
}
TRACE("Symbolic link inode %x:%x, start_block %llx, offset "
@@ -354,7 +334,6 @@ int squashfs_read_inode(struct inode *inode, long long ino)
inode->i_mode |= S_IFCHR;
else
inode->i_mode |= S_IFBLK;
- xattr_id = le32_to_cpu(sqsh_ino->xattr);
rdev = le32_to_cpu(sqsh_ino->rdev);
TRACE("Device inode %x:%x, rdev %x\n",
@@ -391,7 +370,6 @@ int squashfs_read_inode(struct inode *inode, long long ino)
inode->i_mode |= S_IFIFO;
else
inode->i_mode |= S_IFSOCK;
- xattr_id = le32_to_cpu(sqsh_ino->xattr);
break;
}
default:
diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index 38aff6d5b8..f2e5769a19 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
#include <common.h>
#include <malloc.h>
#include <driver.h>
@@ -39,7 +41,7 @@ char *squashfs_devread(struct squashfs_sb_info *fs, int byte_offset,
return buf;
}
-static void squashfs_set_rootarg(struct fs_device_d *fsdev)
+static void squashfs_set_rootarg(struct fs_device *fsdev)
{
struct ubi_volume_desc *ubi_vol;
struct ubi_volume_info vi = {};
@@ -76,13 +78,21 @@ static struct inode *squashfs_alloc_inode(struct super_block *sb)
return &node->vfs_inode;
}
+static void squashfs_destroy_inode(struct inode *inode)
+{
+ struct squashfs_inode_info *node = squashfs_i(inode);
+
+ free(node);
+}
+
static const struct super_operations squashfs_super_ops = {
- .alloc_inode = squashfs_alloc_inode,
+ .alloc_inode = squashfs_alloc_inode,
+ .destroy_inode = squashfs_destroy_inode,
};
-static int squashfs_probe(struct device_d *dev)
+static int squashfs_probe(struct device *dev)
{
- struct fs_device_d *fsdev;
+ struct fs_device *fsdev;
int ret;
struct super_block *sb;
@@ -93,6 +103,7 @@ static int squashfs_probe(struct device_d *dev)
if (ret)
goto err_out;
+ sb->s_op = &squashfs_super_ops;
ret = squashfs_mount(fsdev, 0);
if (ret) {
@@ -102,8 +113,6 @@ static int squashfs_probe(struct device_d *dev)
squashfs_set_rootarg(fsdev);
- sb->s_op = &squashfs_super_ops;
-
return 0;
err_out:
@@ -111,9 +120,9 @@ err_out:
return ret;
}
-static void squashfs_remove(struct device_d *dev)
+static void squashfs_remove(struct device *dev)
{
- struct fs_device_d *fsdev;
+ struct fs_device *fsdev;
struct super_block *sb;
fsdev = dev_to_fs_device(dev);
@@ -122,7 +131,7 @@ static void squashfs_remove(struct device_d *dev)
squashfs_put_super(sb);
}
-static int squashfs_open(struct device_d *dev, FILE *file, const char *filename)
+static int squashfs_open(struct device *dev, FILE *file, const char *filename)
{
struct inode *inode = file->f_inode;
struct squashfs_page *page;
@@ -156,7 +165,7 @@ error:
return -ENOMEM;
}
-static int squashfs_close(struct device_d *dev, FILE *f)
+static int squashfs_close(struct device *dev, FILE *f)
{
struct squashfs_page *page = f->priv;
int i;
@@ -188,8 +197,8 @@ static int squashfs_read_buf(struct squashfs_page *page, int pos, void **buf)
return 0;
}
-static int squashfs_read(struct device_d *_dev, FILE *f, void *buf,
- size_t insize)
+static int squashfs_read(struct device *_dev, FILE *f, void *buf,
+ size_t insize)
{
unsigned int size = insize;
unsigned int pos = f->pos;
@@ -242,7 +251,7 @@ struct squashfs_dir {
char root_d_name[256];
};
-static struct fs_driver_d squashfs_driver = {
+static struct fs_driver squashfs_driver = {
.open = squashfs_open,
.close = squashfs_close,
.read = squashfs_read,
diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h
index 31c9bc454e..d22e83dc3c 100644
--- a/fs/squashfs/squashfs.h
+++ b/fs/squashfs/squashfs.h
@@ -17,7 +17,7 @@
* squashfs.h
*/
-#include <printk.h>
+#include <linux/printk.h>
#include <fs.h>
#include <linux/fs.h>
#include <linux/kernel.h>
@@ -52,11 +52,10 @@ static inline struct squashfs_page *squashfs_page(struct page *page)
#define WARNING(s, args...) pr_warn("SQUASHFS: "s, ## args)
-struct inode *iget_locked_squashfs(struct super_block *sb, unsigned long ino);
char *squashfs_devread(struct squashfs_sb_info *fs, int byte_offset,
int byte_len);
-extern int squashfs_mount(struct fs_device_d *fsdev,
- int silent);
+extern int squashfs_mount(struct fs_device *fsdev,
+ int silent);
extern void squashfs_put_super(struct super_block *sb);
/* block.c */
diff --git a/fs/squashfs/squashfs_fs_sb.h b/fs/squashfs/squashfs_fs_sb.h
index 2b6f81d33a..c6fc37d48f 100644
--- a/fs/squashfs/squashfs_fs_sb.h
+++ b/fs/squashfs/squashfs_fs_sb.h
@@ -77,6 +77,6 @@ struct squashfs_sb_info {
unsigned int inodes;
int xattr_ids;
struct cdev *cdev;
- struct device_d *dev;
+ struct device *dev;
};
#endif
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index e2b7b8d5a1..2e34c0e540 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -83,7 +83,6 @@ void squashfs_put_super(struct super_block *sb)
}
if (sb->s_root) {
- kfree(squashfs_i(sb->s_root->d_inode));
kfree(sb->s_root);
sb->s_root = NULL;
}
@@ -92,7 +91,7 @@ void squashfs_put_super(struct super_block *sb)
static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct squashfs_sb_info *msblk;
- struct fs_device_d *fsdev = (struct fs_device_d *)data;
+ struct fs_device *fsdev = (struct fs_device *)data;
struct squashfs_super_block *sblk = NULL;
struct inode *root;
long long root_inode;
@@ -322,7 +321,7 @@ failed_mount:
}
-int squashfs_mount(struct fs_device_d *fsdev, int silent)
+int squashfs_mount(struct fs_device *fsdev, int silent)
{
struct super_block *sb = &fsdev->sb;