Skip to content

Commit

Permalink
fs: Remove weird export restrictions
Browse files Browse the repository at this point in the history
This prevents external file system (like ZFS for me) from being built, roughly automated like this:

$ git ls-files | xargs ag -l ANDROID_GKI_VFS > files
$ cat files | xargs sed -i '/MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);/d'
$ cat files | xargs sed -i 's/EXPORT_SYMBOL_NS(\(.*\), ANDROID_GKI_VFS_EXPORT_ONLY)/EXPORT_SYMBOL(\1)/g'
  • Loading branch information
simonswine committed Jan 21, 2024
1 parent bc60600 commit 4592125
Show file tree
Hide file tree
Showing 88 changed files with 79 additions and 150 deletions.
1 change: 0 additions & 1 deletion fs/9p/v9fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,4 +738,3 @@ MODULE_AUTHOR("Latchesar Ionkov <[email protected]>");
MODULE_AUTHOR("Eric Van Hensbergen <[email protected]>");
MODULE_AUTHOR("Ron Minnich <[email protected]>");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
2 changes: 0 additions & 2 deletions fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# Rewritten to use lists instead of if-statements.
#

subdir-ccflags-y += -DANDROID_GKI_VFS_EXPORT_ONLY=VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver

obj-y := open.o read_write.o file_table.o super.o \
char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
ioctl.o readdir.o select.o dcache.o inode.o \
Expand Down
1 change: 0 additions & 1 deletion fs/adfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,3 @@ static void __exit exit_adfs_fs(void)
module_init(init_adfs_fs)
module_exit(exit_adfs_fs)
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
1 change: 0 additions & 1 deletion fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,6 @@ static void __exit exit_affs_fs(void)

MODULE_DESCRIPTION("Amiga filesystem support for Linux");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);

module_init(init_affs_fs)
module_exit(exit_affs_fs)
1 change: 0 additions & 1 deletion fs/afs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
MODULE_DESCRIPTION("AFS Client File System");
MODULE_AUTHOR("Red Hat, Inc.");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);

unsigned afs_debug;
module_param_named(debug, afs_debug, uint, S_IWUSR | S_IRUGO);
Expand Down
6 changes: 3 additions & 3 deletions fs/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int setattr_prepare(struct dentry *dentry, struct iattr *attr)

return 0;
}
EXPORT_SYMBOL_NS(setattr_prepare, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(setattr_prepare);

/**
* inode_newsize_ok - may this inode be truncated to a given size
Expand Down Expand Up @@ -160,7 +160,7 @@ int inode_newsize_ok(const struct inode *inode, loff_t offset)
out_big:
return -EFBIG;
}
EXPORT_SYMBOL_NS(inode_newsize_ok, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(inode_newsize_ok);

/**
* setattr_copy - copy simple metadata updates into the generic inode
Expand Down Expand Up @@ -347,4 +347,4 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de

return error;
}
EXPORT_SYMBOL_NS(notify_change, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(notify_change);
1 change: 0 additions & 1 deletion fs/autofs/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ static void __exit exit_autofs_fs(void)
module_init(init_autofs_fs)
module_exit(exit_autofs_fs)
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
4 changes: 2 additions & 2 deletions fs/bad_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void make_bad_inode(struct inode *inode)
inode->i_opflags &= ~IOP_XATTR;
inode->i_fop = &bad_file_ops;
}
EXPORT_SYMBOL_NS(make_bad_inode, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(make_bad_inode);

/*
* This tests whether an inode has been flagged as bad. The test uses
Expand All @@ -227,7 +227,7 @@ bool is_bad_inode(struct inode *inode)
return (inode->i_op == &bad_inode_ops);
}

EXPORT_SYMBOL_NS(is_bad_inode, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(is_bad_inode);

/**
* iget_failed - Mark an under-construction inode as dead and release it
Expand Down
1 change: 0 additions & 1 deletion fs/befs/linuxvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
MODULE_DESCRIPTION("BeOS File System (BeFS) driver");
MODULE_AUTHOR("Will Dyson");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);

/* The units the vfs expects inode->i_blocks to be in */
#define VFS_BLOCK_SIZE 512
Expand Down
1 change: 0 additions & 1 deletion fs/bfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
MODULE_AUTHOR("Tigran Aivazian <[email protected]>");
MODULE_DESCRIPTION("SCO UnixWare BFS filesystem for Linux");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);

#undef DEBUG

Expand Down
1 change: 0 additions & 1 deletion fs/binfmt_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,4 +832,3 @@ static void __exit exit_misc_binfmt(void)
core_initcall(init_misc_binfmt);
module_exit(exit_misc_binfmt);
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
4 changes: 2 additions & 2 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ int sb_set_blocksize(struct super_block *sb, int size)
return sb->s_blocksize;
}

EXPORT_SYMBOL_NS(sb_set_blocksize, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(sb_set_blocksize);

int sb_min_blocksize(struct super_block *sb, int size)
{
Expand All @@ -196,7 +196,7 @@ int sb_min_blocksize(struct super_block *sb, int size)
return sb_set_blocksize(sb, size);
}

EXPORT_SYMBOL_NS(sb_min_blocksize, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(sb_min_blocksize);

static int
blkdev_get_block(struct inode *inode, sector_t iblock,
Expand Down
1 change: 0 additions & 1 deletion fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,6 @@ late_initcall(init_btrfs_fs);
module_exit(exit_btrfs_fs)

MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
MODULE_SOFTDEP("pre: crc32c");
MODULE_SOFTDEP("pre: xxhash64");
MODULE_SOFTDEP("pre: sha256");
Expand Down
32 changes: 16 additions & 16 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate)
unlock_buffer(bh);
put_bh(bh);
}
EXPORT_SYMBOL_NS(end_buffer_write_sync, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(end_buffer_write_sync);

/*
* Various filesystems appear to want __find_get_block to be non-blocking.
Expand Down Expand Up @@ -419,7 +419,7 @@ void mark_buffer_async_write(struct buffer_head *bh)
{
mark_buffer_async_write_endio(bh, end_buffer_async_write);
}
EXPORT_SYMBOL_NS(mark_buffer_async_write, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(mark_buffer_async_write);


/*
Expand Down Expand Up @@ -674,7 +674,7 @@ int __set_page_dirty_buffers(struct page *page)

return newly_dirty;
}
EXPORT_SYMBOL_NS(__set_page_dirty_buffers, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(__set_page_dirty_buffers);

/*
* Write out and wait upon a list of buffers.
Expand Down Expand Up @@ -1141,7 +1141,7 @@ void mark_buffer_dirty(struct buffer_head *bh)
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
}
}
EXPORT_SYMBOL_NS(mark_buffer_dirty, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(mark_buffer_dirty);

void mark_buffer_write_io_error(struct buffer_head *bh)
{
Expand All @@ -1159,7 +1159,7 @@ void mark_buffer_write_io_error(struct buffer_head *bh)
errseq_set(&sb->s_wb_err, -EIO);
rcu_read_unlock();
}
EXPORT_SYMBOL_NS(mark_buffer_write_io_error, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(mark_buffer_write_io_error);

/*
* Decrement a buffer_head's reference count. If all buffers against a page
Expand All @@ -1176,7 +1176,7 @@ void __brelse(struct buffer_head * buf)
}
WARN(1, KERN_ERR "VFS: brelse: Trying to free free buffer\n");
}
EXPORT_SYMBOL_NS(__brelse, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(__brelse);

/*
* bforget() is like brelse(), except it discards any
Expand All @@ -1195,7 +1195,7 @@ void __bforget(struct buffer_head *bh)
}
__brelse(bh);
}
EXPORT_SYMBOL_NS(__bforget, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(__bforget);

static struct buffer_head *__bread_slow(struct buffer_head *bh)
{
Expand Down Expand Up @@ -1376,7 +1376,7 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
brelse(bh);
}
}
EXPORT_SYMBOL_NS(__breadahead, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(__breadahead);

void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size,
gfp_t gfp)
Expand Down Expand Up @@ -1411,7 +1411,7 @@ __bread_gfp(struct block_device *bdev, sector_t block,
bh = __bread_slow(bh);
return bh;
}
EXPORT_SYMBOL_NS(__bread_gfp, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(__bread_gfp);

static void __invalidate_bh_lrus(struct bh_lru *b)
{
Expand Down Expand Up @@ -1573,7 +1573,7 @@ void block_invalidatepage(struct page *page, unsigned int offset,
out:
return;
}
EXPORT_SYMBOL_NS(block_invalidatepage, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(block_invalidatepage);


/*
Expand Down Expand Up @@ -1609,7 +1609,7 @@ void create_empty_buffers(struct page *page,
attach_page_private(page, head);
spin_unlock(&page->mapping->private_lock);
}
EXPORT_SYMBOL_NS(create_empty_buffers, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(create_empty_buffers);

/**
* clean_bdev_aliases: clean a range of buffers in block device
Expand Down Expand Up @@ -1683,7 +1683,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
break;
}
}
EXPORT_SYMBOL_NS(clean_bdev_aliases, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(clean_bdev_aliases);

/*
* Size is a power-of-two in the range 512..PAGE_SIZE,
Expand Down Expand Up @@ -1941,7 +1941,7 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to)
bh = bh->b_this_page;
} while (bh != head);
}
EXPORT_SYMBOL_NS(page_zero_new_buffers, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(page_zero_new_buffers);

static void
iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
Expand Down Expand Up @@ -2275,7 +2275,7 @@ int block_is_partially_uptodate(struct page *page, unsigned long from,

return ret;
}
EXPORT_SYMBOL_NS(block_is_partially_uptodate, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(block_is_partially_uptodate);

/*
* Generic "read page" function for block devices that have the normal
Expand Down Expand Up @@ -3142,7 +3142,7 @@ void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[])
unlock_buffer(bh);
}
}
EXPORT_SYMBOL_NS(ll_rw_block, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(ll_rw_block);

void write_dirty_buffer(struct buffer_head *bh, int op_flags)
{
Expand Down Expand Up @@ -3195,7 +3195,7 @@ int sync_dirty_buffer(struct buffer_head *bh)
{
return __sync_dirty_buffer(bh, REQ_SYNC);
}
EXPORT_SYMBOL_NS(sync_dirty_buffer, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(sync_dirty_buffer);

/*
* try_to_free_buffers() checks if all the buffers on this particular page
Expand Down
1 change: 0 additions & 1 deletion fs/cachefiles/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ MODULE_PARM_DESC(cachefiles_debug, "CacheFiles debugging mask");
MODULE_DESCRIPTION("Mounted-filesystem based cache");
MODULE_AUTHOR("Red Hat, Inc.");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);

struct kmem_cache *cachefiles_object_jar;

Expand Down
1 change: 0 additions & 1 deletion fs/ceph/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,4 +1335,3 @@ MODULE_AUTHOR("Yehuda Sadeh <[email protected]>");
MODULE_AUTHOR("Patience Warnick <[email protected]>");
MODULE_DESCRIPTION("Ceph filesystem for Linux");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
1 change: 0 additions & 1 deletion fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,6 @@ exit_cifs(void)

MODULE_AUTHOR("Steve French");
MODULE_LICENSE("GPL"); /* combination of LGPL + GPL source behaves as GPL */
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
MODULE_DESCRIPTION
("VFS to access SMB3 servers e.g. Samba, Macs, Azure and Windows (and "
"also older servers complying with the SNIA CIFS Specification)");
Expand Down
1 change: 0 additions & 1 deletion fs/coda/psdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ MODULE_AUTHOR("Jan Harkes, Peter J. Braam");
MODULE_DESCRIPTION("Coda Distributed File System VFS interface");
MODULE_ALIAS_CHARDEV_MAJOR(CODA_PSDEV_MAJOR);
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
MODULE_VERSION("7.0");

static int __init init_coda(void)
Expand Down
1 change: 0 additions & 1 deletion fs/cramfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,4 +1010,3 @@ static void __exit exit_cramfs_fs(void)
module_init(init_cramfs_fs)
module_exit(exit_cramfs_fs)
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
2 changes: 0 additions & 2 deletions fs/crypto/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_FS_ENCRYPTION) += fscrypto.o

ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=ANDROID_GKI_VFS_EXPORT_ONLY

fscrypto-y := crypto.o \
fname.o \
hkdf.o \
Expand Down
6 changes: 3 additions & 3 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ struct dentry *d_obtain_alias(struct inode *inode)
{
return __d_obtain_alias(inode, true);
}
EXPORT_SYMBOL_NS(d_obtain_alias, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(d_obtain_alias);

/**
* d_obtain_root - find or allocate a dentry for a given inode
Expand Down Expand Up @@ -2184,7 +2184,7 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
}
return found;
}
EXPORT_SYMBOL_NS(d_add_ci, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(d_add_ci);


static inline bool d_same_name(const struct dentry *dentry,
Expand Down Expand Up @@ -3065,7 +3065,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
__d_add(dentry, inode);
return NULL;
}
EXPORT_SYMBOL_NS(d_splice_alias, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(d_splice_alias);

/*
* Test whether new_dentry is a subdirectory of old_dentry.
Expand Down
2 changes: 1 addition & 1 deletion fs/direct-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
end_io, submit_io, flags);
}

EXPORT_SYMBOL_NS(__blockdev_direct_IO, ANDROID_GKI_VFS_EXPORT_ONLY);
EXPORT_SYMBOL(__blockdev_direct_IO);

static __init int dio_init(void)
{
Expand Down
1 change: 0 additions & 1 deletion fs/ecryptfs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,6 @@ MODULE_AUTHOR("Michael A. Halcrow <[email protected]>");
MODULE_DESCRIPTION("eCryptfs");

MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);

module_init(ecryptfs_init)
module_exit(ecryptfs_exit)
1 change: 0 additions & 1 deletion fs/efivarfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ static __exit void efivarfs_exit(void)
MODULE_AUTHOR("Matthew Garrett, Jeremy Kerr");
MODULE_DESCRIPTION("EFI Variable Filesystem");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
MODULE_ALIAS_FS("efivarfs");

module_init(efivarfs_init);
Expand Down
1 change: 0 additions & 1 deletion fs/efs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,3 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
}

MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
1 change: 0 additions & 1 deletion fs/erofs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,5 +807,4 @@ module_exit(erofs_module_exit);
MODULE_DESCRIPTION("Enhanced ROM File System");
MODULE_AUTHOR("Gao Xiang, Chao Yu, Miao Xie, CONSUMER BG, HUAWEI Inc.");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);

1 change: 0 additions & 1 deletion fs/exfat/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,5 @@ module_exit(exit_exfat_fs);

MODULE_ALIAS_FS("exfat");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
MODULE_DESCRIPTION("exFAT filesystem support");
MODULE_AUTHOR("Samsung Electronics Co., Ltd.");
1 change: 0 additions & 1 deletion fs/ext2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,5 @@ static void __exit exit_ext2_fs(void)
MODULE_AUTHOR("Remy Card and others");
MODULE_DESCRIPTION("Second Extended Filesystem");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY);
module_init(init_ext2_fs)
module_exit(exit_ext2_fs)
Loading

0 comments on commit 4592125

Please sign in to comment.