ANDROID: Incremental fs: Separate pseudo-file code
Also fixed two bugs in the process: is_pseudo_filename was not previously checking for .log, so an attempt to create a .log would succeed. All ioctls could be called on all files. ioctls now set on the correct files. Bug: 162856396 Test: incfs_test passes Signed-off-by: Paul Lawrence <paullawrence@google.com> Change-Id: I3f1e87d018836f51a97897880dd70181db4f7169
This commit is contained in:
@@ -6,4 +6,5 @@ incrementalfs-y := \
|
|||||||
format.o \
|
format.o \
|
||||||
integrity.o \
|
integrity.o \
|
||||||
main.o \
|
main.o \
|
||||||
|
pseudo_files.o \
|
||||||
vfs.o
|
vfs.o
|
||||||
|
|||||||
1063
fs/incfs/pseudo_files.c
Normal file
1063
fs/incfs/pseudo_files.c
Normal file
File diff suppressed because it is too large
Load Diff
15
fs/incfs/pseudo_files.h
Normal file
15
fs/incfs/pseudo_files.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Copyright 2020 Google LLC
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCFS_PSEUDO_FILES_H
|
||||||
|
#define _INCFS_PSEUDO_FILES_H
|
||||||
|
|
||||||
|
#define PSEUDO_FILE_COUNT 2
|
||||||
|
#define INCFS_START_INO_RANGE 10
|
||||||
|
|
||||||
|
int dir_lookup_pseudo_files(struct super_block *sb, struct dentry *dentry);
|
||||||
|
int emit_pseudo_files(struct dir_context *ctx);
|
||||||
|
|
||||||
|
#endif
|
||||||
1140
fs/incfs/vfs.c
1140
fs/incfs/vfs.c
File diff suppressed because it is too large
Load Diff
@@ -6,8 +6,33 @@
|
|||||||
#ifndef _INCFS_VFS_H
|
#ifndef _INCFS_VFS_H
|
||||||
#define _INCFS_VFS_H
|
#define _INCFS_VFS_H
|
||||||
|
|
||||||
|
enum FILL_PERMISSION {
|
||||||
|
CANT_FILL = 0,
|
||||||
|
CAN_FILL = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const struct file_operations incfs_file_ops;
|
||||||
|
extern const struct inode_operations incfs_file_inode_ops;
|
||||||
|
|
||||||
void incfs_kill_sb(struct super_block *sb);
|
void incfs_kill_sb(struct super_block *sb);
|
||||||
struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
|
struct dentry *incfs_mount_fs(struct file_system_type *type, int flags,
|
||||||
const char *dev_name, void *data);
|
const char *dev_name, void *data);
|
||||||
|
int incfs_link(struct dentry *what, struct dentry *where);
|
||||||
|
int incfs_unlink(struct dentry *dentry);
|
||||||
|
|
||||||
|
static inline struct mount_info *get_mount_info(struct super_block *sb)
|
||||||
|
{
|
||||||
|
struct mount_info *result = sb->s_fs_info;
|
||||||
|
|
||||||
|
WARN_ON(!result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct super_block *file_superblock(struct file *f)
|
||||||
|
{
|
||||||
|
struct inode *inode = file_inode(f);
|
||||||
|
|
||||||
|
return inode->i_sb;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -227,8 +227,7 @@ int open_file_by_id(const char *mnt_dir, incfs_uuid_t id, bool use_ioctl)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, INCFS_IOC_PERMIT_FILL, &permit_fill) != -1 ||
|
if (ioctl(fd, INCFS_IOC_PERMIT_FILL, &permit_fill) != -1) {
|
||||||
errno != EPERM) {
|
|
||||||
print_error(
|
print_error(
|
||||||
"Successfully called PERMIT_FILL on non pending_read file");
|
"Successfully called PERMIT_FILL on non pending_read file");
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|||||||
Reference in New Issue
Block a user