mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 19:41:00 +07:00
e8edc6e03a
First thing mm.h does is including sched.h solely for can_do_mlock() inline function which has "current" dereference inside. By dealing with can_do_mlock() mm.h can be detached from sched.h which is good. See below, why. This patch a) removes unconditional inclusion of sched.h from mm.h b) makes can_do_mlock() normal function in mm/mlock.c c) exports can_do_mlock() to not break compilation d) adds sched.h inclusions back to files that were getting it indirectly. e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were getting them indirectly Net result is: a) mm.h users would get less code to open, read, preprocess, parse, ... if they don't need sched.h b) sched.h stops being dependency for significant number of files: on x86_64 allmodconfig touching sched.h results in recompile of 4083 files, after patch it's only 3744 (-8.3%). Cross-compile tested on all arm defconfigs, all mips defconfigs, all powerpc defconfigs, alpha alpha-up arm i386 i386-up i386-defconfig i386-allnoconfig ia64 ia64-up m68k mips parisc parisc-up powerpc powerpc-up s390 s390-up sparc sparc-up sparc64 sparc64-up um-x86_64 x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig as well as my two usual configs. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
159 lines
4.5 KiB
C
159 lines
4.5 KiB
C
/*
|
|
* smb_fs.h
|
|
*
|
|
* Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
|
|
* Copyright (C) 1997 by Volker Lendecke
|
|
*
|
|
*/
|
|
|
|
#ifndef _LINUX_SMB_FS_H
|
|
#define _LINUX_SMB_FS_H
|
|
|
|
#include <linux/jiffies.h>
|
|
#include <linux/smb.h>
|
|
|
|
/*
|
|
* ioctl commands
|
|
*/
|
|
#define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_old_uid_t)
|
|
#define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt)
|
|
|
|
/* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */
|
|
#define SMB_IOC_GETMOUNTUID32 _IOR('u', 3, __kernel_uid32_t)
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
#include <linux/smb_fs_i.h>
|
|
#include <linux/smb_fs_sb.h>
|
|
|
|
#include <linux/fs.h>
|
|
#include <linux/pagemap.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <linux/smb_mount.h>
|
|
#include <asm/unaligned.h>
|
|
|
|
static inline struct smb_sb_info *SMB_SB(struct super_block *sb)
|
|
{
|
|
return sb->s_fs_info;
|
|
}
|
|
|
|
static inline struct smb_inode_info *SMB_I(struct inode *inode)
|
|
{
|
|
return container_of(inode, struct smb_inode_info, vfs_inode);
|
|
}
|
|
|
|
/* macro names are short for word, double-word, long value (?) */
|
|
#define WVAL(buf,pos) \
|
|
(le16_to_cpu(get_unaligned((__le16 *)((u8 *)(buf) + (pos)))))
|
|
#define DVAL(buf,pos) \
|
|
(le32_to_cpu(get_unaligned((__le32 *)((u8 *)(buf) + (pos)))))
|
|
#define LVAL(buf,pos) \
|
|
(le64_to_cpu(get_unaligned((__le64 *)((u8 *)(buf) + (pos)))))
|
|
#define WSET(buf,pos,val) \
|
|
put_unaligned(cpu_to_le16((u16)(val)), (__le16 *)((u8 *)(buf) + (pos)))
|
|
#define DSET(buf,pos,val) \
|
|
put_unaligned(cpu_to_le32((u32)(val)), (__le32 *)((u8 *)(buf) + (pos)))
|
|
#define LSET(buf,pos,val) \
|
|
put_unaligned(cpu_to_le64((u64)(val)), (__le64 *)((u8 *)(buf) + (pos)))
|
|
|
|
/* where to find the base of the SMB packet proper */
|
|
#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4))
|
|
|
|
/*
|
|
* Flags for the in-memory inode
|
|
*/
|
|
#define SMB_F_LOCALWRITE 0x02 /* file modified locally */
|
|
|
|
|
|
/* NT1 protocol capability bits */
|
|
#define SMB_CAP_RAW_MODE 0x00000001
|
|
#define SMB_CAP_MPX_MODE 0x00000002
|
|
#define SMB_CAP_UNICODE 0x00000004
|
|
#define SMB_CAP_LARGE_FILES 0x00000008
|
|
#define SMB_CAP_NT_SMBS 0x00000010
|
|
#define SMB_CAP_RPC_REMOTE_APIS 0x00000020
|
|
#define SMB_CAP_STATUS32 0x00000040
|
|
#define SMB_CAP_LEVEL_II_OPLOCKS 0x00000080
|
|
#define SMB_CAP_LOCK_AND_READ 0x00000100
|
|
#define SMB_CAP_NT_FIND 0x00000200
|
|
#define SMB_CAP_DFS 0x00001000
|
|
#define SMB_CAP_LARGE_READX 0x00004000
|
|
#define SMB_CAP_LARGE_WRITEX 0x00008000
|
|
#define SMB_CAP_UNIX 0x00800000 /* unofficial ... */
|
|
|
|
|
|
/*
|
|
* This is the time we allow an inode, dentry or dir cache to live. It is bad
|
|
* for performance to have shorter ttl on an inode than on the cache. It can
|
|
* cause refresh on each inode for a dir listing ... one-by-one
|
|
*/
|
|
#define SMB_MAX_AGE(server) (((server)->mnt->ttl * HZ) / 1000)
|
|
|
|
static inline void
|
|
smb_age_dentry(struct smb_sb_info *server, struct dentry *dentry)
|
|
{
|
|
dentry->d_time = jiffies - SMB_MAX_AGE(server);
|
|
}
|
|
|
|
struct smb_cache_head {
|
|
time_t mtime; /* unused */
|
|
unsigned long time; /* cache age */
|
|
unsigned long end; /* last valid fpos in cache */
|
|
int eof;
|
|
};
|
|
|
|
#define SMB_DIRCACHE_SIZE ((int)(PAGE_CACHE_SIZE/sizeof(struct dentry *)))
|
|
union smb_dir_cache {
|
|
struct smb_cache_head head;
|
|
struct dentry *dentry[SMB_DIRCACHE_SIZE];
|
|
};
|
|
|
|
#define SMB_FIRSTCACHE_SIZE ((int)((SMB_DIRCACHE_SIZE * \
|
|
sizeof(struct dentry *) - sizeof(struct smb_cache_head)) / \
|
|
sizeof(struct dentry *)))
|
|
|
|
#define SMB_DIRCACHE_START (SMB_DIRCACHE_SIZE - SMB_FIRSTCACHE_SIZE)
|
|
|
|
struct smb_cache_control {
|
|
struct smb_cache_head head;
|
|
struct page *page;
|
|
union smb_dir_cache *cache;
|
|
unsigned long fpos, ofs;
|
|
int filled, valid, idx;
|
|
};
|
|
|
|
#define SMB_OPS_NUM_STATIC 5
|
|
struct smb_ops {
|
|
int (*read)(struct inode *inode, loff_t offset, int count,
|
|
char *data);
|
|
int (*write)(struct inode *inode, loff_t offset, int count, const
|
|
char *data);
|
|
int (*readdir)(struct file *filp, void *dirent, filldir_t filldir,
|
|
struct smb_cache_control *ctl);
|
|
|
|
int (*getattr)(struct smb_sb_info *server, struct dentry *dir,
|
|
struct smb_fattr *fattr);
|
|
/* int (*setattr)(...); */ /* setattr is really icky! */
|
|
|
|
int (*truncate)(struct inode *inode, loff_t length);
|
|
|
|
|
|
/* --- --- --- end of "static" entries --- --- --- */
|
|
|
|
int (*convert)(unsigned char *output, int olen,
|
|
const unsigned char *input, int ilen,
|
|
struct nls_table *nls_from,
|
|
struct nls_table *nls_to);
|
|
};
|
|
|
|
static inline int
|
|
smb_is_open(struct inode *i)
|
|
{
|
|
return (SMB_I(i)->open == server_from_inode(i)->generation);
|
|
}
|
|
|
|
extern void smb_install_null_ops(struct smb_ops *);
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* _LINUX_SMB_FS_H */
|