ksmbd: opencode to remove FP_INODE macro
Opencode to remove FP_INODE macro. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
493fa2fbe4
commit
ab0b263b74
@ -1579,7 +1579,7 @@ void create_disk_id_rsp_buf(char *cc, __u64 file_id, __u64 vol_id)
|
|||||||
void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp)
|
void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp)
|
||||||
{
|
{
|
||||||
struct create_posix_rsp *buf;
|
struct create_posix_rsp *buf;
|
||||||
struct inode *inode = FP_INODE(fp);
|
struct inode *inode = file_inode(fp->filp);
|
||||||
|
|
||||||
buf = (struct create_posix_rsp *)cc;
|
buf = (struct create_posix_rsp *)cc;
|
||||||
memset(buf, 0, sizeof(struct create_posix_rsp));
|
memset(buf, 0, sizeof(struct create_posix_rsp));
|
||||||
|
@ -2908,7 +2908,7 @@ int smb2_open(struct ksmbd_work *work)
|
|||||||
if (!test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_OPLOCKS) ||
|
if (!test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_OPLOCKS) ||
|
||||||
(req_op_level == SMB2_OPLOCK_LEVEL_LEASE &&
|
(req_op_level == SMB2_OPLOCK_LEVEL_LEASE &&
|
||||||
!(conn->vals->capabilities & SMB2_GLOBAL_CAP_LEASING))) {
|
!(conn->vals->capabilities & SMB2_GLOBAL_CAP_LEASING))) {
|
||||||
if (share_ret < 0 && !S_ISDIR(FP_INODE(fp)->i_mode)) {
|
if (share_ret < 0 && !S_ISDIR(file_inode(fp->filp)->i_mode)) {
|
||||||
rc = share_ret;
|
rc = share_ret;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
@ -2995,7 +2995,7 @@ int smb2_open(struct ksmbd_work *work)
|
|||||||
|
|
||||||
memcpy(fp->client_guid, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
|
memcpy(fp->client_guid, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
|
||||||
|
|
||||||
generic_fillattr(&init_user_ns, FP_INODE(fp), &stat);
|
generic_fillattr(&init_user_ns, file_inode(fp->filp), &stat);
|
||||||
|
|
||||||
rsp->StructureSize = cpu_to_le16(89);
|
rsp->StructureSize = cpu_to_le16(89);
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
@ -4123,7 +4123,7 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
basic_info = (struct smb2_file_all_info *)rsp->Buffer;
|
basic_info = (struct smb2_file_all_info *)rsp->Buffer;
|
||||||
generic_fillattr(&init_user_ns, FP_INODE(fp), &stat);
|
generic_fillattr(&init_user_ns, file_inode(fp->filp), &stat);
|
||||||
basic_info->CreationTime = cpu_to_le64(fp->create_time);
|
basic_info->CreationTime = cpu_to_le64(fp->create_time);
|
||||||
time = ksmbd_UnixTimeToNT(stat.atime);
|
time = ksmbd_UnixTimeToNT(stat.atime);
|
||||||
basic_info->LastAccessTime = cpu_to_le64(time);
|
basic_info->LastAccessTime = cpu_to_le64(time);
|
||||||
@ -4163,7 +4163,7 @@ static void get_file_standard_info(struct smb2_query_info_rsp *rsp,
|
|||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
|
|
||||||
inode = FP_INODE(fp);
|
inode = file_inode(fp->filp);
|
||||||
generic_fillattr(&init_user_ns, inode, &stat);
|
generic_fillattr(&init_user_ns, inode, &stat);
|
||||||
|
|
||||||
sinfo = (struct smb2_file_standard_info *)rsp->Buffer;
|
sinfo = (struct smb2_file_standard_info *)rsp->Buffer;
|
||||||
@ -4218,7 +4218,7 @@ static int get_file_all_info(struct ksmbd_work *work,
|
|||||||
if (!filename)
|
if (!filename)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
inode = FP_INODE(fp);
|
inode = file_inode(fp->filp);
|
||||||
generic_fillattr(&init_user_ns, inode, &stat);
|
generic_fillattr(&init_user_ns, inode, &stat);
|
||||||
|
|
||||||
ksmbd_debug(SMB, "filename = %s\n", filename);
|
ksmbd_debug(SMB, "filename = %s\n", filename);
|
||||||
@ -4294,7 +4294,7 @@ static void get_file_stream_info(struct ksmbd_work *work,
|
|||||||
ssize_t xattr_list_len;
|
ssize_t xattr_list_len;
|
||||||
int nbytes = 0, streamlen, stream_name_len, next, idx = 0;
|
int nbytes = 0, streamlen, stream_name_len, next, idx = 0;
|
||||||
|
|
||||||
generic_fillattr(&init_user_ns, FP_INODE(fp), &stat);
|
generic_fillattr(&init_user_ns, file_inode(fp->filp), &stat);
|
||||||
file_info = (struct smb2_file_stream_info *)rsp->Buffer;
|
file_info = (struct smb2_file_stream_info *)rsp->Buffer;
|
||||||
|
|
||||||
xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list);
|
xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list);
|
||||||
@ -4373,7 +4373,7 @@ static void get_file_internal_info(struct smb2_query_info_rsp *rsp,
|
|||||||
struct smb2_file_internal_info *file_info;
|
struct smb2_file_internal_info *file_info;
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
|
|
||||||
generic_fillattr(&init_user_ns, FP_INODE(fp), &stat);
|
generic_fillattr(&init_user_ns, file_inode(fp->filp), &stat);
|
||||||
file_info = (struct smb2_file_internal_info *)rsp->Buffer;
|
file_info = (struct smb2_file_internal_info *)rsp->Buffer;
|
||||||
file_info->IndexNumber = cpu_to_le64(stat.ino);
|
file_info->IndexNumber = cpu_to_le64(stat.ino);
|
||||||
rsp->OutputBufferLength =
|
rsp->OutputBufferLength =
|
||||||
@ -4397,7 +4397,7 @@ static int get_file_network_open_info(struct smb2_query_info_rsp *rsp,
|
|||||||
|
|
||||||
file_info = (struct smb2_file_ntwrk_info *)rsp->Buffer;
|
file_info = (struct smb2_file_ntwrk_info *)rsp->Buffer;
|
||||||
|
|
||||||
inode = FP_INODE(fp);
|
inode = file_inode(fp->filp);
|
||||||
generic_fillattr(&init_user_ns, inode, &stat);
|
generic_fillattr(&init_user_ns, inode, &stat);
|
||||||
|
|
||||||
file_info->CreationTime = cpu_to_le64(fp->create_time);
|
file_info->CreationTime = cpu_to_le64(fp->create_time);
|
||||||
@ -4459,7 +4459,7 @@ static void get_file_compression_info(struct smb2_query_info_rsp *rsp,
|
|||||||
struct smb2_file_comp_info *file_info;
|
struct smb2_file_comp_info *file_info;
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
|
|
||||||
generic_fillattr(&init_user_ns, FP_INODE(fp), &stat);
|
generic_fillattr(&init_user_ns, file_inode(fp->filp), &stat);
|
||||||
|
|
||||||
file_info = (struct smb2_file_comp_info *)rsp->Buffer;
|
file_info = (struct smb2_file_comp_info *)rsp->Buffer;
|
||||||
file_info->CompressedFileSize = cpu_to_le64(stat.blocks << 9);
|
file_info->CompressedFileSize = cpu_to_le64(stat.blocks << 9);
|
||||||
@ -4498,7 +4498,7 @@ static int find_file_posix_info(struct smb2_query_info_rsp *rsp,
|
|||||||
struct ksmbd_file *fp, void *rsp_org)
|
struct ksmbd_file *fp, void *rsp_org)
|
||||||
{
|
{
|
||||||
struct smb311_posix_qinfo *file_info;
|
struct smb311_posix_qinfo *file_info;
|
||||||
struct inode *inode = FP_INODE(fp);
|
struct inode *inode = file_inode(fp->filp);
|
||||||
u64 time;
|
u64 time;
|
||||||
|
|
||||||
file_info = (struct smb311_posix_qinfo *)rsp->Buffer;
|
file_info = (struct smb311_posix_qinfo *)rsp->Buffer;
|
||||||
@ -4927,7 +4927,7 @@ static int smb2_get_info_sec(struct ksmbd_work *work,
|
|||||||
if (!fp)
|
if (!fp)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
inode = FP_INODE(fp);
|
inode = file_inode(fp->filp);
|
||||||
ksmbd_acls_fattr(&fattr, inode);
|
ksmbd_acls_fattr(&fattr, inode);
|
||||||
|
|
||||||
if (test_share_config_flag(work->tcon->share_conf,
|
if (test_share_config_flag(work->tcon->share_conf,
|
||||||
@ -5109,7 +5109,7 @@ int smb2_close(struct ksmbd_work *work)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
inode = FP_INODE(fp);
|
inode = file_inode(fp->filp);
|
||||||
rsp->Flags = SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB;
|
rsp->Flags = SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB;
|
||||||
rsp->AllocationSize = S_ISDIR(inode->i_mode) ? 0 :
|
rsp->AllocationSize = S_ISDIR(inode->i_mode) ? 0 :
|
||||||
cpu_to_le64(inode->i_blocks << 9);
|
cpu_to_le64(inode->i_blocks << 9);
|
||||||
@ -7397,7 +7397,7 @@ int smb2_ioctl(struct ksmbd_work *work)
|
|||||||
}
|
}
|
||||||
|
|
||||||
reparse_ptr->ReparseTag =
|
reparse_ptr->ReparseTag =
|
||||||
smb2_get_reparse_tag_special_file(FP_INODE(fp)->i_mode);
|
smb2_get_reparse_tag_special_file(file_inode(fp->filp)->i_mode);
|
||||||
reparse_ptr->ReparseDataLength = 0;
|
reparse_ptr->ReparseDataLength = 0;
|
||||||
ksmbd_fd_put(work, fp);
|
ksmbd_fd_put(work, fp);
|
||||||
nbytes = sizeof(struct reparse_data_buffer);
|
nbytes = sizeof(struct reparse_data_buffer);
|
||||||
|
@ -488,7 +488,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
|
|||||||
*/
|
*/
|
||||||
read_lock(&curr_fp->f_ci->m_lock);
|
read_lock(&curr_fp->f_ci->m_lock);
|
||||||
list_for_each_entry(prev_fp, &curr_fp->f_ci->m_fp_list, node) {
|
list_for_each_entry(prev_fp, &curr_fp->f_ci->m_fp_list, node) {
|
||||||
if (file_inode(filp) != FP_INODE(prev_fp))
|
if (file_inode(filp) != file_inode(prev_fp->filp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (filp == prev_fp->filp)
|
if (filp == prev_fp->filp)
|
||||||
|
@ -1024,7 +1024,7 @@ int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,
|
|||||||
int in_count, int *out_count)
|
int in_count, int *out_count)
|
||||||
{
|
{
|
||||||
struct file *f = fp->filp;
|
struct file *f = fp->filp;
|
||||||
struct inode *inode = FP_INODE(fp);
|
struct inode *inode = file_inode(fp->filp);
|
||||||
loff_t maxbytes = (u64)inode->i_sb->s_maxbytes, end;
|
loff_t maxbytes = (u64)inode->i_sb->s_maxbytes, end;
|
||||||
loff_t extent_start, extent_end;
|
loff_t extent_start, extent_end;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -83,7 +83,7 @@ static struct ksmbd_inode *__ksmbd_inode_lookup(struct inode *inode)
|
|||||||
|
|
||||||
static struct ksmbd_inode *ksmbd_inode_lookup(struct ksmbd_file *fp)
|
static struct ksmbd_inode *ksmbd_inode_lookup(struct ksmbd_file *fp)
|
||||||
{
|
{
|
||||||
return __ksmbd_inode_lookup(FP_INODE(fp));
|
return __ksmbd_inode_lookup(file_inode(fp->filp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ksmbd_inode *ksmbd_inode_lookup_by_vfsinode(struct inode *inode)
|
static struct ksmbd_inode *ksmbd_inode_lookup_by_vfsinode(struct inode *inode)
|
||||||
@ -156,7 +156,7 @@ static void ksmbd_inode_unhash(struct ksmbd_inode *ci)
|
|||||||
|
|
||||||
static int ksmbd_inode_init(struct ksmbd_inode *ci, struct ksmbd_file *fp)
|
static int ksmbd_inode_init(struct ksmbd_inode *ci, struct ksmbd_file *fp)
|
||||||
{
|
{
|
||||||
ci->m_inode = FP_INODE(fp);
|
ci->m_inode = file_inode(fp->filp);
|
||||||
atomic_set(&ci->m_count, 1);
|
atomic_set(&ci->m_count, 1);
|
||||||
atomic_set(&ci->op_count, 0);
|
atomic_set(&ci->op_count, 0);
|
||||||
atomic_set(&ci->sop_count, 0);
|
atomic_set(&ci->sop_count, 0);
|
||||||
@ -479,7 +479,7 @@ struct ksmbd_file *ksmbd_lookup_fd_inode(struct inode *inode)
|
|||||||
|
|
||||||
read_lock(&ci->m_lock);
|
read_lock(&ci->m_lock);
|
||||||
list_for_each_entry(lfp, &ci->m_fp_list, node) {
|
list_for_each_entry(lfp, &ci->m_fp_list, node) {
|
||||||
if (inode == FP_INODE(lfp)) {
|
if (inode == file_inode(lfp->filp)) {
|
||||||
atomic_dec(&ci->m_count);
|
atomic_dec(&ci->m_count);
|
||||||
read_unlock(&ci->m_lock);
|
read_unlock(&ci->m_lock);
|
||||||
return lfp;
|
return lfp;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#define KSMBD_NO_FID (UINT_MAX)
|
#define KSMBD_NO_FID (UINT_MAX)
|
||||||
#define SMB2_NO_FID (0xFFFFFFFFFFFFFFFFULL)
|
#define SMB2_NO_FID (0xFFFFFFFFFFFFFFFFULL)
|
||||||
|
|
||||||
#define FP_INODE(fp) d_inode((fp)->filp->f_path.dentry)
|
|
||||||
#define PARENT_INODE(fp) d_inode((fp)->filp->f_path.dentry->d_parent)
|
#define PARENT_INODE(fp) d_inode((fp)->filp->f_path.dentry->d_parent)
|
||||||
|
|
||||||
#define ATTR_FP(fp) ((fp)->attrib_only && \
|
#define ATTR_FP(fp) ((fp)->attrib_only && \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user