int setup_faf_file_if_needed(struct file *file) { int r = 0; /* Check if the file is already a FAF file */ if (file->f_flags & (O_FAF_CLT | O_FAF_SRV)) goto exit; /* Check if we can re-open the file */ if (file->f_dentry) { umode_t i_mode = file->f_dentry->d_inode->i_mode; unsigned long s_magic = file->f_dentry->d_sb->s_magic; if (((s_magic == PROC_SUPER_MAGIC) || (s_magic == NFS_SUPER_MAGIC) || (s_magic == OCFS2_SUPER_MAGIC)) && (S_ISREG(i_mode) || S_ISDIR(i_mode) || S_ISLNK(i_mode))) goto exit; } /* Ok, so, we cannot do something better then using the FAF. * Let's do it ! */ r = setup_faf_file(file); exit: return r; }
int send_faf_file_desc(struct rpc_desc *desc, struct file *file) { int r; if (!file->f_objid) { r = create_kddm_file_object(file); if (r) goto out; } if (!(file->f_flags & (O_FAF_SRV|O_FAF_CLT))) { r = setup_faf_file(file); if (r && r != -EALREADY) goto out; } r = __send_faf_file_desc(desc, file); out: return r; }