📄 classfscli.h
字号:
// -*-c++-*-/* $Id: classfscli.h,v 1.10 2003/02/26 05:34:21 dm Exp $ *//* * * Copyright (C) 2001 David Mazieres (dm@uun.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, or (at * your option) any later version. * * 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 the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */#include "sfsconnect.h"#include "list.h"#define fattr3 fattr3exp/* * sfsuclnt allows you to access a remote SFS server as an NFS client. * The user must be running an sfsagent before you allocate this class * if you want to access the remote file system with more than * anonymous permissions. */class sfsuclnt : public virtual refcount {public: typedef callback<void, ptr<sfsuclnt>, str>::ref alloccb_t;private: bool authlock; u_int64_t seqno; void alloc_2 (u_int64_t devno, sfsuclnt::alloccb_t cb, str devdb); void alloc_1 (str path, alloccb_t cb, u_int64_t devno, str srv, str rpath); void connect_1 (alloccb_t::ptr cb, ptr<sfscon> sc, str err); void connect (str srvname); void setattrs (u_int32_t proc, void *resp, ref<ex_getattr3res> ap, ex_post_op_attr *poap, aclnt_cb cb, clnt_stat stat); void getreply (u_int32_t proc, ptr<nfs_fh3> fhp, void *resp, aclnt_cb cb, clnt_stat stat);protected: sfsuclnt (); ~sfsuclnt (); void eof (); void nfscbdispatch (svccb *sbp);public: ptr<sfscon> sc; nfs_fh3 rootfh; u_int32_t authno; AUTH *auth; ptr<aclnt> nfsc; ptr<aclnt> sfsc; ptr<asrv> nfscbs; list_entry<sfsuclnt> link; void setauth (u_int32_t authno); void doauth (alloccb_t::ptr cb); /* Make an NFS call to the SFS server */ void call (u_int32_t nfs_procno, const void *argp, void *resp, aclnt_cb cb); /* Allocate a new sfsuclnt structure. Alloc takes a callback with * two arguments. The first is a ptr<sfsuclnt>, which is NULL on a * failure. The second is a str with an error message, or NULL on * success. */ static void alloc (str path, alloccb_t cb);};/* * classmount creates an NFS mount pointpoint. * fd - the UDP socket your NFS server is listening on * fh - the file handle of the root of the file system * name - file system will pear as /classfs/name * cb - callback with int when mount is complete (0 ok, errno otherwise) */void classmount (int fd, const rpc_bytes<64> &fh, str name, cbi cb);/* The following code is commented out in this header file because it * also appears in nfstrans.h. However, it is highly relevant to the * assignment, and thus included here for your reference. */#if 0/* * nfs3_getattrinfo returns a vector of all the file attributes in an * NFS3 call result. It groups file attributes (fattr3 structures) * with file handles and associated pre-operation attributes * (wcc_attr), if they are present. * * Note that if optional attributes are not present in an NFS3 reply, * the fattr field will be NULL. If you wish to clear the * pre-operation attributes (for instance because you need to crrect * them based on the post-operation attributes, and fattr is NULL), * you can do this with: wdata->before.set_present (false); */struct attrinfo { nfs_fh3 *fh; fattr3 *fattr; wcc_attr *wattr; wcc_data *wdata; attrinfo (); void set_wcc (wcc_data *wd);};typedef vec<attrinfo, 2> attrvec;void nfs3_getattrinfo (attrvec *avp, u_int32_t proc, void *argp, void *resp);#endif /* 0 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -