📄 freebsd-3.2.il-kernel.patch
字号:
+ ek[x[j][0]] |= x[j][1];+ x += 15;+ }+ }+ }diff -N -c -r /usr/src/sys/9fs/9fs.h ./9fs/9fs.h*** /usr/src/sys/9fs/9fs.h Wed Dec 31 19:00:00 1969--- ./9fs/9fs.h Mon May 22 11:31:29 2000****************** 0 ****--- 1,294 ----+ /*+ * Copyright (c) 1989, 1993, 1995+ * The Regents of the University of California. All rights reserved.+ *+ * This code is derived from software contributed to Berkeley by+ * Rick Macklem at The University of Guelph.+ *+ * Redistribution and use in source and binary forms, with or without+ * modification, are permitted provided that the following conditions+ * are met:+ * 1. Redistributions of source code must retain the above copyright+ * notice, this list of conditions and the following disclaimer.+ * 2. Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the following disclaimer in the+ * documentation and/or other materials provided with the distribution.+ * 3. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed by the University of+ * California, Berkeley and its contributors.+ * 4. Neither the name of the University nor the names of its contributors+ * may be used to endorse or promote products derived from this software+ * without specific prior written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ * SUCH DAMAGE.+ *+ * @(#)nfs.h 8.4 (Berkeley) 5/1/95+ * $Id: nfs.h,v 1.44 1998/09/07 05:42:15 bde Exp $+ */+ + #ifndef _9FS_H_+ #define _9FS_H_+ + #ifdef KERNEL+ #include "opt_u9fs.h"+ #endif+ + #define U9FS_FABLKSIZE 512+ #define U9FS_PORT 17008+ + /*+ * The set of signals the interrupt an I/O in progress for U9FSMNT_INT mounts.+ * What should be in this set is open to debate, but I believe that since+ * I/O system calls on ufs are never interrupted by signals the set should+ * be minimal. My reasoning is that many current programs that use signals+ * such as SIGALRM will not expect file I/O system calls to be interrupted+ * by them and break.+ */+ #define U9FSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \+ sigmask(SIGHUP)|sigmask(SIGQUIT))+ + /*+ * U9FS mount option flags+ */+ #define U9FSMNT_SOFT 0x00000001 /* soft mount (hard is default) */+ #define U9FSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */+ #define U9FSMNT_INT 0x00000040 /* allow interrupts on hard mount */+ #define U9FSMNT_KERB 0x00000400 /* Use Kerberos authentication */+ #define U9FSMNT_READAHEAD 0x00002000 /* set read ahead */+ + #define U9FSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */+ #define U9FSSTA_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */+ #define U9FSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */+ #define U9FSSTA_MNTD 0x00200000 /* Mnt server for mnt point */+ #define U9FSSTA_DISMINPROG 0x00400000 /* Dismount in progress */+ #define U9FSSTA_DISMNT 0x00800000 /* Dismounted */+ #define U9FSSTA_SNDLOCK 0x01000000 /* Send socket lock */+ #define U9FSSTA_WANTSND 0x02000000 /* Want above */+ #define U9FSSTA_RCVLOCK 0x04000000 /* Rcv socket lock */+ #define U9FSSTA_WANTRCV 0x08000000 /* Want above */+ #define U9FSSTA_WAITAUTH 0x10000000 /* Wait for authentication */+ #define U9FSSTA_HASAUTH 0x20000000 /* Has authenticator */+ #define U9FSSTA_WANTAUTH 0x40000000 /* Wants an authenticator */+ #define U9FSSTA_AUTHERR 0x80000000 /* Authentication error */+ + #define U9FSNOHASH(fhsum) (&u9fsnodehashtbl[(fhsum) % u9fsnodehash])+ + /*+ * Arguments to mount 9FS+ */+ #define U9FS_ARGSVERSION 1 /* change when nfs_args changes */+ struct u9fs_args {+ int version; /* args structure version number */+ struct sockaddr *addr; /* file server address */+ int addrlen; /* length of address */+ int sotype; /* Socket type */+ int proto; /* and Protocol */+ int fhsize; /* Size, in bytes, of fh */+ int flags; /* flags */+ int wsize; /* write size in bytes */+ int rsize; /* read size in bytes */+ int readdirsize; /* readdir size in bytes */+ char *hostname; /* server's name */+ + struct sockaddr * authaddr;+ int authaddrlen;+ int authsotype;+ int authsoproto;+ + int nusers;+ char user[U9FS_NAMELEN];+ char key[U9AUTH_DESKEYLEN];+ struct p9user {+ uid_t p9_uid;+ char p9_name[U9FS_NAMELEN];+ } * users;+ };+ + #define U9FS_USER_HASHSIZE 512+ + struct u9fsuser {+ LIST_ENTRY(u9fsuser) u_hash;+ uid_t u_uid;+ char u_name[U9FS_NAMELEN];+ char u_ckey[U9AUTH_DESKEYLEN]; /* user key */+ char u_skey[U9AUTH_DESKEYLEN]; /* session key */+ };+ + /*+ * The u9fsnode is the u9fs equivalent to ufs's inode. Any similarity+ * is purely coincidental.+ * There is a unique u9fsnode allocated for each active file,+ * each current directory, each mounted-on file, text file, and the root.+ * An u9fsnode is 'named' by its file handle. (nget/u9fs_node.c)+ * If this structure exceeds 256 bytes (it is currently 256 using 4.4BSD-Lite+ * type definitions), file handles of > 32 bytes should probably be split out+ * into a separate MALLOC()'d data structure. (Reduce the size of u9fsfh_t by+ * changing the definition in u9fsproto.h of U9FS_SMALLFH.)+ * NB: Hopefully the current order of the fields is such that everything will+ * be well aligned and, therefore, tightly packed.+ */+ struct u9fsnode {+ LIST_ENTRY(u9fsnode) n_hash; /* Hash chain */+ u_quad_t n_size; /* Current size of file */+ struct vattr n_vattr; /* Vnode attribute cache */+ time_t n_attrstamp; /* Attr. cache timestamp */+ u_int32_t n_mode; /* ACCESS mode cache */+ uid_t n_modeuid; /* credentials having mode */+ time_t n_modestamp; /* mode cache timestamp */+ time_t n_mtime; /* Prev modify time. */+ time_t n_ctime; /* Prev create time. */+ struct u9fs_qid n_qid;+ u_short n_fid; /* U9FS FID */+ u_short n_rdfid; + u_short n_wrfid; + struct vnode *n_vnode; /* associated vnode */+ struct lockf *n_lockf; /* Locking record of file */+ int n_error; /* Save write error value */+ struct u9fsdir n_dir;+ short n_flag; /* Flag for locking.. */+ int n_opens; /* number of opens */+ };+ + #define n_atim n_un1.nf_atim+ #define n_mtim n_un2.nf_mtim+ #define n_sillyrename n_un3.nf_silly+ #define n_cookieverf n_un1.nd_cookieverf+ #define n_direofoffset n_un2.nd_direof+ #define n_cookies n_un3.nd_cook+ + /*+ * Flags for n_flag+ */+ #define NFLUSHWANT 0x0001 /* Want wakeup from a flush in prog. */+ #define NFLUSHINPROG 0x0002 /* Avoid multiple calls to vinvalbuf() */+ #define NMODIFIED 0x0004 /* Might have a modified buffer in bio */+ #define NWRITEERR 0x0008 /* Flag write errors so close will know */+ #define NQU9FSNONCACHE 0x0020 /* Non-cachable lease */+ #define NQU9FSWRITE 0x0040 /* Write lease */+ #define NQU9FSEVICTED 0x0080 /* Has been evicted */+ #define NACC 0x0100 /* Special file accessed */+ #define NUPD 0x0200 /* Special file updated */+ #define NCHG 0x0400 /* Special file times changed */+ #define NLOCKED 0x0800 /* node is locked */+ #define NWANTED 0x0100 /* someone wants to lock */+ + /*+ * Convert between u9fsnode pointers and vnode pointers+ */+ #define VTOU9FS(vp) ((struct u9fsnode *)(vp)->v_data)+ #define U9FSTOV(np) ((struct vnode *)(np)->n_vnode)+ + /*+ * Mount structure.+ * One allocated on every U9FS mount.+ * Holds U9FS specific information for mount.+ */+ struct u9fsmount {+ int nm_flag; /* Flags for soft/hard... */+ int nm_state; /* Internal state flags */+ struct mount *nm_mountp; /* Vfs structure for this filesystem */+ int nm_numgrps; /* Max. size of groupslist */+ u9fsfh_t nm_fh; /* qid.path */+ u_short nm_fid; /* fid of root dir */+ struct socket *nm_so; /* Rpc socket */+ int nm_sotype; /* Type of socket */+ int nm_soproto; /* and protocol */+ int nm_soflags; /* pr_flags for socket protocol */+ struct sockaddr *nm_nam; /* Addr of server */+ int nm_sent; /* Request send count */+ int nm_cwnd; /* Request send window */+ int nm_rsize; /* Max size of read rpc */+ int nm_wsize; /* Max size of write rpc */+ int nm_readdirsize; /* Size of a readdir rpc */+ + struct lock nm_lock; /* lock for tag/fid freelist */+ bitstr_t * nm_tags;+ bitstr_t * nm_fids;+ TAILQ_HEAD(u9fs_reqq, u9fsreq) nm_reqq;+ + uid_t nm_authuid; /* Uid for authenticator */+ #if 0+ struct vnode *nm_inprog; /* Vnode in prog by nqu9fs_clientd() */+ uid_t nm_authuid; /* Uid for authenticator */+ int nm_authtype; /* Authenticator type */+ int nm_authlen; /* and length */+ char *nm_authstr; /* Authenticator string */+ char *nm_verfstr; /* and the verifier */+ int nm_verflen;+ u_char nm_verf[U9FSX_V3WRITEVERF]; /* V3 write verifier */+ U9FSKERBKEY_T nm_key; /* and the session key */+ int nm_numuids; /* Number of u9fsuid mappings */+ TAILQ_HEAD(, u9fsuid) nm_uidlruhead; /* Lists of u9fsuid mappings */+ LIST_HEAD(, u9fsuid) nm_uidhashtbl[U9FS_MUIDHASHSIZ];+ TAILQ_HEAD(, buf) nm_bufq; /* async io buffer queue */+ short nm_bufqlen; /* number of buffers in queue */+ short nm_bufqwant; /* process wants to add to the queue */+ int nm_bufqiods; /* number of iods processing queue */+ #endif+ u_int64_t nm_maxfilesize; /* maximum file size */+ };+ + #ifdef KERNEL+ + #ifdef MALLOC_DECLARE+ MALLOC_DECLARE(M_U9FSHASH);+ MALLOC_DECLARE(M_U9FSBITS);+ + extern vop_t **u9fs_vnodeop_p;+ + /* u9fs_node.c */+ void u9fs_nhinit __P((void));+ int u9fs_nget __P((struct mount *mntp, u9fsfh_t fh, struct u9fsnode **npp, struct proc * p));+ + /* u9fs_subr.c */+ void u9fs_id_init __P((bitstr_t ** bits));+ u_short u9fs_id_new __P((bitstr_t * bits));+ void u9fs_id_free __P((bitstr_t * bits, u_short v));+ void u9fs_uhinit __P((void));+ uid_t u9fs_name2uid __P((char * name));+ struct u9fsuser * u9fs_finduser __P((uid_t uid));+ void u9fs_hashuser __P((uid_t uid, char *name));+ int u9fs_mbuftouio __P((struct mbuf *m, struct uio *uiop, int siz));+ int u9fs_uiotombuf __P((struct uio *uiop, struct mbuf **mq, int siz));+ + /* u9fs_vnopes.c */+ int u9fs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));+ int u9fs_readrpc __P((struct vnode *vp, struct uio *uiop, struct ucred *cred));+ int u9fs_writerpc __P((struct vnode *vp, struct uio *uiop, struct ucred *cred));+ + /* u9fs_bio.c */+ int u9fs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,int));+ int u9fs_biowrite __P((struct vnode *, struct uio *, int ioflag, struct ucred *));+ int u9fs_doio __P((struct buf *, struct ucred *, struct proc *));+ int u9fs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *, int));+ + + /* u9fs_socket.c */+ int u9fs_sigintr __P((struct u9fsmount *nmp, struct proc *p));+ void u9fs_disconnect __P((struct socket *));+ int u9fs_connect __P((struct socket ** sop, struct sockaddr * saddr, int sotype, int soproto, struct proc * p));+ int u9fs_connect_9fs __P((struct u9fsmount *));+ int u9fs_connect_9auth __P((struct u9fsmount *, struct u9fs_args *, struct socket **));+ int u9fs_request __P((struct u9fsreq * req, struct u9fsreq * rep, int relm));+ + #endif+ + /*+ * Convert mount ptr to u9fsmount ptr.+ */+ #define VFSTOU9FS(mp) ((struct u9fsmount *)((mp)->mnt_data))+ + #endif /* KERNEL */+ + #endifdiff -N -c -r /usr/src/sys/9fs/9fs_bio.c ./9fs/9fs_bio.c*** /usr/src/sys/9fs/9fs_bio.c Wed Dec 31 19:00:00 1969--- ./9fs/9fs_bio.c Fri Nov 26 12:28:50 1999****************** 0 ****--- 1,550 ----+ #include <sys/param.h>+ #include <sys/sockio.h>+ #include <sys/proc.h>+ #include <sys/vnode.h>+ #include <sys/kernel.h>+ #include <sys/sysctl.h>+ #include <sys/malloc.h>+ #include <sys/mount.h>+ #include <sys/mbuf.h>+ #include <sys/socket.h>+ #include <sys/socketvar.h>+ #include <sys/systm.h>+ #include <sys/protosw.h>+ #include <sys/syslog.h>+ + #include <netinet/in.h>+ #include <netinet/tcp.h>+ + #include <vm/vm.h>+ #include <vm/vm_extern.h>+ #include <vm/vm_zone.h>+ #include <vm/vm_prot.h>+ #include <vm/vm_page.h>+ #include <vm/vm_object.h>+ #include <vm/vm_pager.h>+ #include <vm/vnode_pager.h>+ + #include <net/if.h>+ #include <net/route.h>+ #include <netinet/in.h>+ + #include <9fs/bitstring.h>+ #include <9fs/9p.h>+ #include <9fs/9auth.h>+ #include <9fs/9fs.h>+ + static struct buf *u9fs_getcacheblk __P((struct vnode *vp, daddr_t bn, int size, struct proc *p));+ static void u9fs_prot_buf __P((struct buf *bp, int off, int n));+ + /*+ * Vnode op for read using bio+ */+ int+ u9fs_bioread(vp, uio, ioflag, cred, getpages)+ register struct vnode *vp;+ register struct uio *uio;+ int ioflag;+ struct ucred *cred;+ int getpages;+ {+ register struct u9fsnode *np = VTOU9FS(vp);+ register int biosize;+ off_t diff;+ struct buf *bp = 0;+ struct proc *p;+ struct u9fsmount *nmp = VFSTOU9FS(vp->v_mount);+ daddr_t lbn;+ int error = 0, n = 0, on = 0, bufsize, not_readin;+ + if (uio->uio_resid == 0)+ return (0);+ if (uio->uio_offset < 0)+ return (EINVAL);+ p = uio->uio_procp;+ if (vp->v_type != VDIR &&+ (uio->uio_offset + uio->uio_resid) > nmp->nm_maxfilesize)+ return (EFBIG);+ biosize = vp->v_mount->mnt_stat.f_iosize;+ #if 0+ if( np->n_qid.vers ) { /* in cache, check revision */+ error = VOP_GETATTR(vp, &vattr, cred, p);+ if( error )+ return error;+ if( np->n_qid.vers != np->n_dir.dir_qid.vers ) {+ /* content changed */+ u9fs_vinvalbuf(vp, V_SAVE, cred, p, 1);+ }+ }+ #endif+ do {+ switch (vp->v_type) {+ case VREG:+ lbn = uio->uio_offset / biosize;+ on = uio->uio_offset & (biosize - 1);+ not_readin = 1;+ + #if 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -