⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ndmp.api

📁 网络数据管理协议的开发
💻 API
📖 第 1 页 / 共 2 页
字号:
fileStat is the file attribute data returned by the stat() function.fh_info specifies the location of the file data within the backupdata stream. It is used by recover modules that support fast fileretrieval by seeking directly to the data stream position of the file data.If not supported, fh_info should be set to 0.A 0 is returned if the message is successfully sent to the NDMP client.Otherwise, -1 is returned.-------------------------typedef intNdmpdFileHistoryDirFunc(void            *daemonCookie,                        char            *name,                        u_long          node,                        u_long          parent);This function is used to send file history directory entries to the NDMP client.Backup modules that do inode based backup should use this function inconjunction with NdmpdFileHistoryNodeFunc for reporting file history.daemonCookie is the daemonCookie from the module params structures passedto the ModuleStartFunc.name the path component name of the inode.node is the inode number.parent is the parent inode number of node.A 0 is returned if the message is successfully sent to the NDMP client.Otherwise, -1 is returned.-------------------------typedef intNdmpdFileHistoryNodeFunc(void           *daemonCookie,                         u_long         node,                         struct stat    *fileStat,                         u_longlong_t   fh_info);This function is used to send file history node entries to the NDMP client.Backup modules that do inode based backup should use this function inconjunction with NdmpdFileHistoryDirFunc for reporting file history.daemonCookie is the daemonCookie from the module params structures passedto the ModuleStartFunc.node is the inode number. This must match the node from a priorNdmpdFileHistoryDirFunc.fileStat is the file attribute data returned by the stat() function.fh_info specifies the location of the file data within the backupdata stream. It is used by recover modules that support fast fileretrieval by seeking directly to the data stream position of the file data.If not supported, fh_info should be set to 0.A 0 is returned if the message is successfully sent to the NDMP client.Otherwise, -1 is returned.-------------------------typedef intNdmpdSeekFunc(void*                     daemonCookie,              u_longlong_t              offset,              u_longlong_t              length);This function is used to seek to a specific data stream position and inform the daemon to initiate a read for the specified length of data.A large length should be specified if the module desires to read theentire data stream.daemonCookie is the daemonCookie from the module params structures passedto the ModuleStartFunc.noffset is the data stream position to be seeked to.length is the length of the read that the mover should initiate.-------------------------typedef intNdmpdReadFunc(void*                     daemonCookie,              char*                     data,              u_long                    length);This function is used to read data from the data stream. data is returnedfrom the current data stream position.daemonCookie is the daemonCookie from the module params structures passedto the ModuleStartFunc.data is the location to store the read data.length is the amount of data to read.-------------------------typedef intNdmpdFileRecoveredFunc(void*            daemonCookie,                       char*            name,                       u_short          ssid,                       int              error);This function is used to notify the NDMP client that a file has or has notbeen successfully recovered.daemonCookie is the daemonCookie from the module params structures passedto the ModuleStartFunc.name is the name of the file that was (was not) recovered.ssid is the selection set id of the file for modules that supportselection set id. If not supported, 0 should be returned.If the file was successfully recovered, error should be set to 0.Otherwise, error should be set to a unix errno value that indicateswhy the file was not recovered. ENOENT should be used to indicate that thefile was not found on the tape.A 0 is returned if the message is successfully sent to the NDMP client.Otherwise, -1 is returned.Module function specification:typedef struct NdmpdModuleStats{    u_longlong_t    bytesProcessed;    u_longlong_t    estBytesRemaining;    u_long          estTimeRemaining;} NdmpdModuleStats;/* * Parameter structure passed to module start function. */typedef struct  NdmpdModuleParams{    void*                       daemonCookie;    void**                      moduleCookie;    u_short                     protocolVersion;    ndmp_data_operation         operation;    NdmpdModuleStats*           stats;    NdmpdGetEnvFunc*            getEnvFunc;    NdmpdAddEnvFunc*            addEnvFunc;    NdmpdGetNameFunc*           getNameFunc;    NdmpdDispatchFunc*          dispatchFunc;    NdmpdDoneFunc*              doneFunc;    NdmpdLogFunc*               logFunc;    NdmpdWriteFunc*             writeFunc;    NdmpdFileHistoryPathFunc*   fileHistoryPathFunc;    NdmpdFileHistoryDirFunc*    fileHistoryDirFunc;    NdmpdFileHistoryNodeFunc*   fileHistoryNodeFunc;    NdmpdReadFunc*              readFunc;    NdmpdSeekFunc*              seekFunc;    NdmpdFileRecoveredFunc*     fileRecoveredFunc;} NdmpdModuleParams;The daemonCookie is passed back to the daemon as a parameter to each of thedaemon API functions. This cookie is used by the daemon to determine whichmodule it is being called by.The moduleCookie should be initialized by the module to a location thatcontains module specific data. This cookie is passed to the module asa parameter to the ModuleAbortFunc.protocolVersion is the protocol version being used between the NDMP client andserver. Protocol features vary between versions. The module should utilizeprotocolVersion to determine what features are available for use duringthe data operation. Example: direct access functionality (via ndmpdSeek())is not available in protocol version 1.operation indicates whether the operation is a backup or recover operation.During a backup/recover operation, the module should periodicallyupdate the stats structure. This is an optional feature. If not supported,modules should simply initialize all stats to 0.The stats data is returned to the client in response to a data_get_staterequest.The remaining members are pointers to the daemon provided API functions.Depending on the operation, some of the pointers may be 0./* * Module function prototypes. */typedef int ModuleStartFunc(NdmpdModuleParams*      params);typedef int ModuleAbortFunc(void*                   moduleCookie);typedef int ModuleGetAttrsFunc(u_long*              attributes);    ModuleGetAttrsThis function is used by the NDMP daemon to determine the attributessupported by the backup/recover module.It is called upon receipt of a data_get_butype_attr request.The module is expected to return a mask of attributes. Refer to theprotocol spec or ndmp.x file for the defined attributes.    ModuleStartFuncThis function is used by the NDMP daemon to start a backup or recoveroperation. The parameter structure argument configures the operation andcontains the pointers to the NDMP daemon provided module API functions.It is called upon receipt of data_start_backup and data_start_recoverrequests.The function should return a unix errno value if the function is unable tocall the doneFunc. Otherwise, 0 should be returned.If the module conforms to the sequential model, this function should notreturn until after the backup/recover operation has completed andNdmpdDoneFunc has been called.If the module conforms to the concurrent model, this function shouldreturn immediately after starting the backup/recover operation.    ModuleAbortFuncThis function is used by the NDMP daemon to stop a backup or recoveroperation. The argument is the cookie from the params structure passed to the ModuleStartFunc. The ModuleStartFunc should initialize thecookie pointer to the address of any module specific data neededby ModuleAbortFunc.If the module conforms to the sequential model, this function will becalled from the context of NdmpdDispatchFunc. In this case, a flag should simply be set that is checked upon return from NdmpdDispatchFunc.Upon detecting abort, the module should perform any necessary cleanupand then call NdmpdDoneFunc with an error code of EINTR.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -