/* * linux/fs/9p/vfs_inode.c * * This file contains vfs inode ops for the 9P2000 protocol. * * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to: * Free Software Foundation * 51 Franklin Street, Fifth Floor * Boston, MA 02111-1301 USA * */#include<linux/module.h>#include<linux/errno.h>#include<linux/fs.h>#include<linux/file.h>#include<linux/pagemap.h>#include<linux/stat.h>#include<linux/string.h>#include<linux/inet.h>#include<linux/namei.h>#include<linux/idr.h>#include<linux/sched.h>#include<net/9p/9p.h>#include<net/9p/client.h>#include"v9fs.h"#include"v9fs_vfs.h"#include"fid.h"#include"cache.h"staticconststructinode_operationsv9fs_dir_inode_operations;staticconststructinode_operationsv9fs_dir_inode_operations_ext;staticconststructinode_operationsv9fs_file_inode_operations;staticconststructinode_operationsv9fs_symlink_inode_operations;/** * unixmode2p9mode - convert unix mode bits to plan 9 * @v9ses: v9fs session information * @mode: mode to convert * */staticintunixmode2p9mode(structv9fs_session_info*v9ses,intmode){intres;res=mode&0777;if(S_ISDIR(mode))res|=P9_DMDIR;if(v9fs_extended(v9ses)){if(S_ISLNK(mode))res|=P9_DMSYMLINK;if(v9ses->nodev==0){if(S_ISSOCK(mode))res|=P9_DMSOCKET;if(S_ISFIFO(mode))res|=P9_DMNAMEDPIPE;if(S_ISBLK(mode))res|=P9_DMDEVICE;if(S_ISCHR(mode))res|=P9_DMDEVICE;}if((mode&S_ISUID)==S_ISUID)res|=P9_DMSETUID;if((mode&S_ISGID)==S_ISGID)res|=P9_DMSETGID;if((mode&S_ISVTX)==S_ISVTX)res|=P9_DMSETVTX;if((mode&P9_DMLINK))res|=P9_DMLINK;}returnres;}/** * p9mode2unixmode- convert plan9 mode bits to unix mode bits * @v9ses: v9fs session information * @mode: mode to convert * */staticintp9mode2unixmode(structv9fs_session_info*v9ses,intmode){intres;res=mode&0777;if((mode&P9_DMDIR)==P9_DMDIR)res|=S_IFDIR;elseif((mode&P9_DMSYMLINK)&&(v9fs_extended(v9ses)))res|=S_IFLNK;elseif((mode&