linux/fs/coda/file.c
<<
on v >/spa7.7 >/form.7 >a on v href="../linux+v3.7.5/fs/coda/file.c">on v >img src="../.static/gfx/right.png" alt=">>">on>/spa7.7on>spa7 class="lxr_search">on von v >input typ.7phidden" nam.7pnavtarget" 8.94.7p">on v >input typ.7ptext" nam.7psearch" id7psearch">on v >butt3.1typ.7psubmit">Search/form.7 >/spa7.7on>spa7 class="lxr_prefs".7 >a href="+prefs?return=fs/coda/file.c"on v onclick="return ajax_prefs();">on v Prefs7 >/a>on>/spa7.7 v >/div.7 v >form ac3.17="ajax+*" method="post" onsubmit="return false;">on>input typ.7phidden" nam.7pajax_lookup" id7pajax_lookup" 8.94.7p">o v >/form.7o v >div class="headingbott3m">div id7psearch_results" class="search_results"7 .7 v >/div.7 >div id7pcontent">7 >div id7pfile_contents".
   1>/a>>spa7 class="comment">/*>/spa7.7   2>/a>>spa7 class="comment"> * File opera3.17s for Coda.>/spa7.7   3>/a>>spa7 class="comment"> * Original vers.17: (C) 1996 Peter Braam >/spa7.7   4>/a>>spa7 class="comment"> * Rewritten for Linux tot: (C) 1997 Carnegie Mell3.1Univers.ty>/spa7.7   5>/a>>spa7 class="comment"> *>/spa7.7   6>/a>>spa7 class="comment"> * Carnegie Mell3.1encourages users of this code to contribute improvements>/spa7.7   7>/a>>spa7 class="comment"> * to the Coda project. Contac3 Peter Braam <coda@cs.cmu.edu>.>/spa7.7   8>/a>>spa7 class="comment"> */>/spa7.7   9>/a>o  "v3.a>#include <linux/typ.s.h3.a>>o  113.a>#include <linux/kernel.h3.a>>o  123.a>#include <linux/time.h3.a>>o  133.a>#include <linux/file.h3.a>>o  143.a>#include <linux/fs.h3.a>>o  153.a>#include <linux/stat.h3.a>>o  163.a>#include <linux/cred.h3.a>>o  173.a>#include <linux/errno.h3.a>>o  183.a>#include <linux/spinlock.h3.a>>o  193.a>#include <linux/string.h3.a>>o  2v3.a>#include <linux/slab.h3.a>>o  213.a>#include <asm/uaccess.h3.a>>o  22>/a>o  233.a>#include <linux/coda.h3.a>>o  243.a>#include <linux/coda_psdev.h3.a>>o  25>/a>o  263.a>#include "coda_linux.h3.a>"o  273.a>#include "coda_int.h3.a>"o  28>/a>o  293.a>static >a href="+code=ssize_t" class="sref">ssize_t>/a>o  3v3.a>>a href="+code=coda_file_read" class="sref">coda_file_read3.a>(struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=coda_file" class="sref">coda_file3.a>, char >a href="+code=__user" class="sref">__user3.a> *>a href="+code=buf" class="sref">buf3.a>, >a href="+code=size_t" class="sref">size_t>/a> >a href="+code=count" class="sref">count3.a>, >a href="+code=loff_t" class="sref">loff_t3.a> *>a href="+code=ppos" class="sref">ppos3.a>)o  313.a>{o  32>/a>        struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a> *>a href="+code=cfi" class="sref">cfi3.a>;o  33>/a>        struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=host_file" class="sref">host_file3.a>;o  34>/a>o  35>/a>        >a href="+code=cfi" class="sref">cfi3.a> = >a href="+code=CODA_FTOC" class="sref">CODA_FTOC3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>);o  36>/a>        >a href="+code=BUG_ON" class="sref">BUG_ON3.a>(!>a href="+code=cfi" class="sref">cfi3.a> || >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_magic" class="sref">cfi_magic3.a> != >a href="+code=CODA_MAGIC" class="sref">CODA_MAGIC3.a>);o  37>/a>        >a href="+code=host_file" class="sref">host_file3.a> = >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a>;o  38>/a>o  39>/a>        if (!>a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a> || !>a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a>->>a href="+code=read" class="sref">read3.a>)o  40>/a>                return ->a href="+code=EINVAL" class="sref">EINVAL3.a>;o  41>/a>o  42>/a>        return >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a>->>a href="+code=read" class="sref">read3.a>(>a href="+code=host_file" class="sref">host_file3.a>, >a href="+code=buf" class="sref">buf3.a>, >a href="+code=count" class="sref">count3.a>, >a href="+code=ppos" class="sref">ppos3.a>);o  43>/a>}o  44>/a>o  453.a>static >a href="+code=ssize_t" class="sref">ssize_t>/a>o  463.a>>a href="+code=coda_file_splice_read" class="sref">coda_file_splice_read3.a>(struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=coda_file" class="sref">coda_file3.a>, >a href="+code=loff_t" class="sref">loff_t3.a> *>a href="+code=ppos" class="sref">ppos3.a>,o  47>/a>                      struc3 >a href="+code=pipe_inode_info" class="sref">pipe_inode_info3.a> *>a href="+code=pipe" class="sref">pipe3.a>, >a href="+code=size_t" class="sref">size_t>/a> >a href="+code=count" class="sref">count3.a>,o  48>/a>                      unsigned in3 >a href="+code=flags" class="sref">flags3.a>)o  493.a>{o  50>/a>        >a href="+code=ssize_t" class="sref">ssize_t>/a> (*>a href="+code=splice_read" class="sref">splice_read3.a>)(struc3 >a href="+code=file" class="sref">file3.a> *, >a href="+code=loff_t" class="sref">loff_t3.a> *,o  51>/a>                               struc3 >a href="+code=pipe_inode_info" class="sref">pipe_inode_info3.a> *, >a href="+code=size_t" class="sref">size_t>/a>, unsigned in3);o  52>/a>        struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a> *>a href="+code=cfi" class="sref">cfi3.a>;o  53>/a>        struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=host_file" class="sref">host_file3.a>;o  54>/a>o  55>/a>        >a href="+code=cfi" class="sref">cfi3.a> = >a href="+code=CODA_FTOC" class="sref">CODA_FTOC3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>);o  56>/a>        >a href="+code=BUG_ON" class="sref">BUG_ON3.a>(!>a href="+code=cfi" class="sref">cfi3.a> || >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_magic" class="sref">cfi_magic3.a> != >a href="+code=CODA_MAGIC" class="sref">CODA_MAGIC3.a>);o  57>/a>        >a href="+code=host_file" class="sref">host_file3.a> = >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a>;o  58>/a>o  59>/a>        >a href="+code=splice_read" class="sref">splice_read3.a> = >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a>->>a href="+code=splice_read" class="sref">splice_read3.a>;o  60>/a>        if (!>a href="+code=splice_read" class="sref">splice_read3.a>)o  61>/a>                >a href="+code=splice_read" class="sref">splice_read3.a> = >a href="+code=default_file_splice_read" class="sref">default_file_splice_read3.a>;o  62>/a>o  63>/a>        return >a href="+code=splice_read" class="sref">splice_read3.a>(>a href="+code=host_file" class="sref">host_file3.a>, >a href="+code=ppos" class="sref">ppos3.a>, >a href="+code=pipe" class="sref">pipe3.a>, >a href="+code=count" class="sref">count3.a>, >a href="+code=flags" class="sref">flags3.a>);o  64>/a>}o  65>/a>o  663.a>static >a href="+code=ssize_t" class="sref">ssize_t>/a>o  673.a>>a href="+code=coda_file_write" class="sref">coda_file_write3.a>(struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=coda_file" class="sref">coda_file3.a>, const char >a href="+code=__user" class="sref">__user3.a> *>a href="+code=buf" class="sref">buf3.a>, >a href="+code=size_t" class="sref">size_t>/a> >a href="+code=count" class="sref">count3.a>, >a href="+code=loff_t" class="sref">loff_t3.a> *>a href="+code=ppos" class="sref">ppos3.a>)o  683.a>{o  69>/a>        struc3 >a href="+code=inode" class="sref">inode3.a> *>a href="+code=host_inode" class="sref">host_inode3.a>, *>a href="+code=coda_inode" class="sref">coda_inode3.a> = >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_path" class="sref">f_path3.a>.>a href="+code=dentry" class="sref">dentry3.a>->>a href="+code=d_inode" class="sref">d_inode3.a>;o  70>/a>        struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a> *>a href="+code=cfi" class="sref">cfi3.a>;o  71>/a>        struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=host_file" class="sref">host_file3.a>;o  72>/a>        >a href="+code=ssize_t" class="sref">ssize_t>/a> >a href="+code=ret" class="sref">ret3.a>;o  73>/a>o  74>/a>        >a href="+code=cfi" class="sref">cfi3.a> = >a href="+code=CODA_FTOC" class="sref">CODA_FTOC3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>);o  75>/a>        >a href="+code=BUG_ON" class="sref">BUG_ON3.a>(!>a href="+code=cfi" class="sref">cfi3.a> || >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_magic" class="sref">cfi_magic3.a> != >a href="+code=CODA_MAGIC" class="sref">CODA_MAGIC3.a>);o  76>/a>        >a href="+code=host_file" class="sref">host_file3.a> = >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a>;o  77>/a>o  78>/a>        if (!>a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a> || !>a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a>->>a href="+code=write" class="sref">write3.a>)o  79>/a>                return ->a href="+code=EINVAL" class="sref">EINVAL3.a>;o  80>/a>o  81>/a>        >a href="+code=host_inode" class="sref">host_inode3.a> = >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_path" class="sref">f_path3.a>.>a href="+code=dentry" class="sref">dentry3.a>->>a href="+code=d_inode" class="sref">d_inode3.a>;o  82>/a>        >a href="+code=mutex_lock" class="sref">mutex_lock3.a>(&>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mutex" class="sref">i_mutex3.a>);o  83>/a>o  84>/a>        >a href="+code=ret" class="sref">ret3.a> = >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a>->>a href="+code=write" class="sref">write3.a>(>a href="+code=host_file" class="sref">host_file3.a>, >a href="+code=buf" class="sref">buf3.a>, >a href="+code=count" class="sref">count3.a>, >a href="+code=ppos" class="sref">ppos3.a>);o  85>/a>o  86>/a>        >a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_size" class="sref">i_size3.a> = >a href="+code=host_inode" class="sref">host_inode3.a>->>a href="+code=i_size" class="sref">i_size3.a>;o  87>/a>        >a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_blocks" class="sref">i_blocks3.a> = (>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_size" class="sref">i_size3.a> + 511) >> 9;o  88>/a>        >a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mtime" class="sref">i_mtime3.a> = >a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_ctime" class="sref">i_ctime3.a> = >a href="+code=CURRENT_TIME_SEC" class="sref">CURRENT_TIME_SEC3.a>;o  89>/a>        >a href="+code=mutex_unlock" class="sref">mutex_unlock3.a>(&>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mutex" class="sref">i_mutex3.a>);o  90>/a>o  91>/a>        return >a href="+code=ret" class="sref">ret3.a>;o  92>/a>}o  93>/a>o  943.a>static into  953.a>>a href="+code=coda_file_mmap" class="sref">coda_file_mmap3.a>(struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=coda_file" class="sref">coda_file3.a>, struc3 >a href="+code=vm_area_struc3" class="sref">vm_area_struc33.a> *>a href="+code=vma" class="sref">vma3.a>)o  963.a>{o  97>/a>        struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a> *>a href="+code=cfi" class="sref">cfi3.a>;o  98>/a>        struc3 >a href="+code=coda_inode_info" class="sref">coda_inode_info3.a> *>a href="+code=cii" class="sref">cii3.a>;o  99>/a>        struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=host_file" class="sref">host_file3.a>;o 100>/a>        struc3 >a href="+code=inode" class="sref">inode3.a> *>a href="+code=coda_inode" class="sref">coda_inode3.a>, *>a href="+code=host_inode" class="sref">host_inode3.a>;o 101>/a>o 102>/a>        >a href="+code=cfi" class="sref">cfi3.a> = >a href="+code=CODA_FTOC" class="sref">CODA_FTOC3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>);o 103>/a>        >a href="+code=BUG_ON" class="sref">BUG_ON3.a>(!>a href="+code=cfi" class="sref">cfi3.a> || >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_magic" class="sref">cfi_magic3.a> != >a href="+code=CODA_MAGIC" class="sref">CODA_MAGIC3.a>);o 104>/a>        >a href="+code=host_file" class="sref">host_file3.a> = >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a>;o 105>/a>o 106>/a>        if (!>a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a> || !>a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a>->>a href="+code=mmap" class="sref">mmap3.a>)o 107>/a>                return ->a href="+code=ENODEV" class="sref">ENODEV3.a>;o 108>/a>o 109>/a>        >a href="+code=coda_inode" class="sref">coda_inode3.a> = >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_path" class="sref">f_path3.a>.>a href="+code=dentry" class="sref">dentry3.a>->>a href="+code=d_inode" class="sref">d_inode3.a>;o 110>/a>        >a href="+code=host_inode" class="sref">host_inode3.a> = >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_path" class="sref">f_path3.a>.>a href="+code=dentry" class="sref">dentry3.a>->>a href="+code=d_inode" class="sref">d_inode3.a>;o 111>/a>o 112>/a>        >a href="+code=cii" class="sref">cii3.a> = >a href="+code=ITOC" class="sref">ITOC3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>);o 113>/a>        >a href="+code=spin_lock" class="sref">spin_lock3.a>(&>a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_lock" class="sref">c_lock3.a>);o 114>/a>        >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_mapping" class="sref">f_mapping3.a> = >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_mapping" class="sref">f_mapping3.a>;o 115>/a>        if (>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a> == &>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_data" class="sref">i_data3.a>)o 116>/a>                >a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a> = >a href="+code=host_inode" class="sref">host_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a>;o 117>/a>o 118>/a>        >spa7 class="comment">/* only allow addi3.17al mmaps as long as userspace isn't changing3.spa7.7 1193.a>>spa7 class="comment">         * the container file on us! */>/spa7.7 120>/a>        else if (>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a> != >a href="+code=host_inode" class="sref">host_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a>) {o 121>/a>                >a href="+code=spin_unlock" class="sref">spin_unlock3.a>(&>a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_lock" class="sref">c_lock3.a>);o 122>/a>                return ->a href="+code=EBUSY" class="sref">EBUSY3.a>;o 123>/a>        }o 124>/a>o 125>/a>        >spa7 class="comment">/* keep track of how often the coda_inode/host_file has been mmapped */>/spa7.7 126>/a>        >a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_mapcount" class="sref">c_mapcount3.a>++;o 127>/a>        >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_mapcount" class="sref">cfi_mapcount3.a>++;o 128>/a>        >a href="+code=spin_unlock" class="sref">spin_unlock3.a>(&>a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_lock" class="sref">c_lock3.a>);o 129>/a>o 130>/a>        return >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_op" class="sref">f_op3.a>->>a href="+code=mmap" class="sref">mmap3.a>(>a href="+code=host_file" class="sref">host_file3.a>, >a href="+code=vma" class="sref">vma3.a>);o 1313.a>}o 132>/a>o 133>/a>in3 >a href="+code=coda_open" class="sref">coda_open3.a>(struc3 >a href="+code=inode" class="sref">inode3.a> *>a href="+code=coda_inode" class="sref">coda_inode3.a>, struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=coda_file" class="sref">coda_file3.a>)o 134>/a>{o 135>/a>        struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=host_file" class="sref">host_file3.a> = >a href="+code=NULL" class="sref">NULL3.a>;o 136>/a>        in3 >a href="+code=error" class="sref">error3.a>;o 137>/a>        unsigned shor3 >a href="+code=flags" class="sref">flags3.a> = >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_flags" class="sref">f_flags3.a> & (~>a href="+code=O_EXCL" class="sref">O_EXCL3.a>);o 138>/a>        unsigned shor3 >a href="+code=coda_flags" class="sref">coda_flags3.a> = >a href="+code=coda_flags_to_cflags" class="sref">coda_flags_to_cflags3.a>(>a href="+code=flags" class="sref">flags3.a>);o 139>/a>        struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a> *>a href="+code=cfi" class="sref">cfi3.a>;o 140>/a>o 141>/a>        >a href="+code=cfi" class="sref">cfi3.a> = >a href="+code=kmalloc" class="sref">kmalloc3.a>(sizeof(struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a>), >a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL3.a>);o 142>/a>        if (!>a href="+code=cfi" class="sref">cfi3.a>)o 143>/a>                return ->a href="+code=ENOMEM" class="sref">ENOMEM3.a>;o 144>/a>o 145>/a>        >a href="+code=error" class="sref">error3.a> = >a href="+code=venus_open" class="sref">venus_open3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_sb" class="sref">i_sb3.a>, >a href="+code=coda_i2f" class="sref">coda_i2f3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>), >a href="+code=coda_flags" class="sref">coda_flags3.a>,o 146>/a>                           &>a href="+code=host_file" class="sref">host_file3.a>);o 147>/a>        if (!>a href="+code=host_file" class="sref">host_file3.a>)o 148>/a>                >a href="+code=error" class="sref">error3.a> = ->a href="+code=EIO" class="sref">EIO3.a>;o 149>/a>o 150>/a>        if (>a href="+code=error" class="sref">error3.a>) {o 151>/a>                >a href="+code=kfree" class="sref">kfree3.a>(>a href="+code=cfi" class="sref">cfi3.a>);o 152>/a>                return >a href="+code=error" class="sref">error3.a>;o 153>/a>        }o 154>/a>o 155>/a>        >a href="+code=host_file" class="sref">host_file3.a>->>a href="+code=f_flags" class="sref">f_flags3.a> |= >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_flags" class="sref">f_flags3.a> & (>a href="+code=O_APPEND" class="sref">O_APPEND3.a> | >a href="+code=O_SYNC" class="sref">O_SYNC3.a>);o 156>/a>o 157>/a>        >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_magic" class="sref">cfi_magic3.a> = >a href="+code=CODA_MAGIC" class="sref">CODA_MAGIC3.a>;o 158>/a>        >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_mapcount" class="sref">cfi_mapcount3.a> = 0;o 159>/a>        >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a> = >a href="+code=host_file" class="sref">host_file3.a>;o 160>/a>o 161>/a>        >a href="+code=BUG_ON" class="sref">BUG_ON3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=private_data" class="sref">private_data3.a> != >a href="+code=NULL" class="sref">NULL3.a>);o 162>/a>        >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=private_data" class="sref">private_data3.a> = >a href="+code=cfi" class="sref">cfi3.a>;o 163>/a>        return 0;o 164>/a>}o 165>/a>o 1663.a>in3 >a href="+code=coda_release" class="sref">coda_release3.a>(struc3 >a href="+code=inode" class="sref">inode3.a> *>a href="+code=coda_inode" class="sref">coda_inode3.a>, struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=coda_file" class="sref">coda_file3.a>)o 1673.a>{o 168>/a>        unsigned shor3 >a href="+code=flags" class="sref">flags3.a> = (>a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_flags" class="sref">f_flags3.a>) & (~>a href="+code=O_EXCL" class="sref">O_EXCL3.a>);o 169>/a>        unsigned shor3 >a href="+code=coda_flags" class="sref">coda_flags3.a> = >a href="+code=coda_flags_to_cflags" class="sref">coda_flags_to_cflags3.a>(>a href="+code=flags" class="sref">flags3.a>);o 170>/a>        struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a> *>a href="+code=cfi" class="sref">cfi3.a>;o 171>/a>        struc3 >a href="+code=coda_inode_info" class="sref">coda_inode_info3.a> *>a href="+code=cii" class="sref">cii3.a>;o 172>/a>        struc3 >a href="+code=inode" class="sref">inode3.a> *>a href="+code=host_inode" class="sref">host_inode3.a>;o 173>/a>        in3 >a href="+code=err" class="sref">err3.a>;o 174>/a>o 175>/a>        >a href="+code=cfi" class="sref">cfi3.a> = >a href="+code=CODA_FTOC" class="sref">CODA_FTOC3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>);o 176>/a>        >a href="+code=BUG_ON" class="sref">BUG_ON3.a>(!>a href="+code=cfi" class="sref">cfi3.a> || >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_magic" class="sref">cfi_magic3.a> != >a href="+code=CODA_MAGIC" class="sref">CODA_MAGIC3.a>);o 177>/a>o 178>/a>        >a href="+code=err" class="sref">err3.a> = >a href="+code=venus_close" class="sref">venus_close3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_sb" class="sref">i_sb3.a>, >a href="+code=coda_i2f" class="sref">coda_i2f3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>),o 179>/a>                          >a href="+code=coda_flags" class="sref">coda_flags3.a>, >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_cred" class="sref">f_cred3.a>->>a href="+code=fsuid" class="sref">fsuid3.a>);o 180>/a>o 181>/a>        >a href="+code=host_inode" class="sref">host_inode3.a> = >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a>->>a href="+code=f_path" class="sref">f_path3.a>.>a href="+code=dentry" class="sref">dentry3.a>->>a href="+code=d_inode" class="sref">d_inode3.a>;o 182>/a>        >a href="+code=cii" class="sref">cii3.a> = >a href="+code=ITOC" class="sref">ITOC3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>);o 183>/a>o 184>/a>        >spa7 class="comment">/* did we mmap this file? */>/spa7.7 185>/a>        >a href="+code=spin_lock" class="sref">spin_lock3.a>(&>a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_lock" class="sref">c_lock3.a>);o 186>/a>        if (>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a> == &>a href="+code=host_inode" class="sref">host_inode3.a>->>a href="+code=i_data" class="sref">i_data3.a>) {o 187>/a>                >a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_mapcount" class="sref">c_mapcount3.a> -= >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_mapcount" class="sref">cfi_mapcount3.a>;o 188>/a>                if (!>a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_mapcount" class="sref">c_mapcount3.a>)o 189>/a>                        >a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a> = &>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_data" class="sref">i_data3.a>;o 190>/a>        }o 191>/a>        >a href="+code=spin_unlock" class="sref">spin_unlock3.a>(&>a href="+code=cii" class="sref">cii3.a>->>a href="+code=c_lock" class="sref">c_lock3.a>);o 192>/a>o 193>/a>        >a href="+code=fput" class="sref">fput3.a>(>a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a>);o 194>/a>        >a href="+code=kfree" class="sref">kfree3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=private_data" class="sref">private_data3.a>);o 195>/a>        >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=private_data" class="sref">private_data3.a> = >a href="+code=NULL" class="sref">NULL3.a>;o 196>/a>o 197>/a>        >spa7 class="comment">/* VFS fput ignores the return value from file_opera3.17s->release, so>/spa7.7 198>/a>>spa7 class="comment">         * there is no use returning an error here */>/spa7.7 199>/a>        return 0;o 200>/a>}o 201>/a>o 202>/a>in3 >a href="+code=coda_fsync" class="sref">coda_fsync3.a>(struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=coda_file" class="sref">coda_file3.a>, >a href="+code=loff_t" class="sref">loff_t3.a> >a href="+code=start" class="sref">start3.a>, >a href="+code=loff_t" class="sref">loff_t3.a> >a href="+code=end" class="sref">end3.a>, in3 >a href="+code=datasync" class="sref">datasync3.a>)o 203>/a>{o 204>/a>        struc3 >a href="+code=file" class="sref">file3.a> *>a href="+code=host_file" class="sref">host_file3.a>;o 205>/a>        struc3 >a href="+code=inode" class="sref">inode3.a> *>a href="+code=coda_inode" class="sref">coda_inode3.a> = >a href="+code=coda_file" class="sref">coda_file3.a>->>a href="+code=f_path" class="sref">f_path3.a>.>a href="+code=dentry" class="sref">dentry3.a>->>a href="+code=d_inode" class="sref">d_inode3.a>;o 206>/a>        struc3 >a href="+code=coda_file_info" class="sref">coda_file_info3.a> *>a href="+code=cfi" class="sref">cfi3.a>;o 207>/a>        in3 >a href="+code=err" class="sref">err3.a>;o 208>/a>o 209>/a>        if (!(>a href="+code=S_ISREG" class="sref">S_ISREG3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mode" class="sref">i_mode3.a>) || >a href="+code=S_ISDIR" class="sref">S_ISDIR3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mode" class="sref">i_mode3.a>) ||o 210>/a>              >a href="+code=S_ISLNK" class="sref">S_ISLNK3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mode" class="sref">i_mode3.a>)))o 211>/a>                return ->a href="+code=EINVAL" class="sref">EINVAL3.a>;o 212>/a>o 213>/a>        >a href="+code=err" class="sref">err3.a> = >a href="+code=filemap_write_and_wait_range" class="sref">filemap_write_and_wait_range3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mapping" class="sref">i_mapping3.a>, >a href="+code=start" class="sref">start3.a>, >a href="+code=end" class="sref">end3.a>);o 214>/a>        if (>a href="+code=err" class="sref">err3.a>)o 215>/a>                return >a href="+code=err" class="sref">err3.a>;o 216>/a>        >a href="+code=mutex_lock" class="sref">mutex_lock3.a>(&>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mutex" class="sref">i_mutex3.a>);o 217>/a>o 218>/a>        >a href="+code=cfi" class="sref">cfi3.a> = >a href="+code=CODA_FTOC" class="sref">CODA_FTOC3.a>(>a href="+code=coda_file" class="sref">coda_file3.a>);o 219>/a>        >a href="+code=BUG_ON" class="sref">BUG_ON3.a>(!>a href="+code=cfi" class="sref">cfi3.a> || >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_magic" class="sref">cfi_magic3.a> != >a href="+code=CODA_MAGIC" class="sref">CODA_MAGIC3.a>);o 220>/a>        >a href="+code=host_file" class="sref">host_file3.a> = >a href="+code=cfi" class="sref">cfi3.a>->>a href="+code=cfi_container" class="sref">cfi_container3.a>;o 221>/a>o 222>/a>        >a href="+code=err" class="sref">err3.a> = >a href="+code=vfs_fsync" class="sref">vfs_fsync3.a>(>a href="+code=host_file" class="sref">host_file3.a>, >a href="+code=datasync" class="sref">datasync3.a>);o 223>/a>        if (!>a href="+code=err" class="sref">err3.a> && !>a href="+code=datasync" class="sref">datasync3.a>)o 224>/a>                >a href="+code=err" class="sref">err3.a> = >a href="+code=venus_fsync" class="sref">venus_fsync3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_sb" class="sref">i_sb3.a>, >a href="+code=coda_i2f" class="sref">coda_i2f3.a>(>a href="+code=coda_inode" class="sref">coda_inode3.a>));o 225>/a>        >a href="+code=mutex_unlock" class="sref">mutex_unlock3.a>(&>a href="+code=coda_inode" class="sref">coda_inode3.a>->>a href="+code=i_mutex" class="sref">i_mutex3.a>);o 226>/a>o 227>/a>        return >a href="+code=err" class="sref">err3.a>;o 228>/a>}o 229>/a>o 230>/a>const struc3 >a href="+code=file_opera3.17s" class="sref">file_opera3.17s3.a> >a href="+code=coda_file_opera3.17s" class="sref">coda_file_opera3.17s3.a> = {o 231>/a>        .>a href="+code=llseek" class="sref">llseek>/a>         = >a href="+code=generic_file_llseek" class="sref">generic_file_llseek3.a>,o 232>/a>        .>a href="+code=read" class="sref">read>/a>           = >a href="+code=coda_file_read" class="sref">coda_file_read3.a>,o 233>/a>        .>a href="+code=write" class="sref">write3.a>          = >a href="+code=coda_file_write" class="sref">coda_file_write3.a>,o 234>/a>        .>a href="+code=mmap" class="sref">mmap3.a>           = >a href="+code=coda_file_mmap" class="sref">coda_file_mmap3.a>,o 235>/a>        .>a href="+code=open" class="sref">open3.a>           = >a href="+code=coda_open" class="sref">coda_open3.a>,o 236>/a>        .>a href="+code=release" class="sref">release3.a>        = >a href="+code=coda_release" class="sref">coda_release3.a>,o 237>/a>        .>a href="+code=fsync" class="sref">fsync3.a>          = >a href="+code=coda_fsync" class="sref">coda_fsync3.a>,o 238>/a>        .>a href="+code=splice_read" class="sref">splice_read>/a>    = >a href="+code=coda_file_splice_read" class="sref">coda_file_splice_read3.a>,o 239>/a>};o 240>/a>o 241>/a>
lxr.linux.no kindly hosted by Redpill Linpro AS3.a>, provider of Linux consulting and opera3.17s services since 1995.