📄 libsmbclient.h
字号:
* - EINVAL offset did not refer to a valid dirent or * smbc_init not called. * * @see smbc_telldir() * * * @todo In what does the reture and errno values mean? */int smbc_lseekdir(int fd, off_t offset);/**@ingroup directory * Create a directory. * * @param durl The url of the directory to create * * @param mode Specifies the permissions to use. It is modified * by the process's umask in the usual way: the * permissions of the created file are (mode & ~umask). * * @return 0 on success, < 0 on error with errno set: * - EEXIST directory url already exists * - EACCES The parent directory does not allow write * permission to the process, or one of the directories * - ENOENT A directory component in pathname does not * exist. * - EINVAL NULL durl passed or smbc_init not called. * - ENOMEM Insufficient memory was available. * * @see smbc_rmdir() * */int smbc_mkdir(const char *durl, mode_t mode);/**@ingroup directory * Remove a directory. * * @param durl The smb url of the directory to remove * * @return 0 on success, < 0 on error with errno set: * - EACCES or EPERM Write access to the directory * containing pathname was not allowed. * - EINVAL durl is NULL or smbc_init not called. * - ENOENT A directory component in pathname does not * exist. * - ENOTEMPTY directory contains entries. * - ENOMEM Insufficient kernel memory was available. * * @see smbc_mkdir(), smbc_unlink() * * @todo Are errno values complete and correct? */int smbc_rmdir(const char *durl);/**@ingroup attribute * Get information about a file or directory. * * @param url The smb url to get information for * * @param st pointer to a buffer that will be filled with * standard Unix struct stat information. * * @return 0 on success, < 0 on error with errno set: * - ENOENT A component of the path file_name does not * exist. * - EINVAL a NULL url was passed or smbc_init not called. * - EACCES Permission denied. * - ENOMEM Out of memory * - ENOTDIR The target dir, url, is not a directory. * * @see Unix stat() * */int smbc_stat(const char *url, struct stat *st);/**@ingroup attribute * Get file information via an file descriptor. * * @param fd Open file handle from smbc_open() or smbc_creat() * * @param st pointer to a buffer that will be filled with * standard Unix struct stat information. * * @return EBADF filedes is bad. * - EACCES Permission denied. * - EBADF fd is not a valid file descriptor * - EINVAL Problems occurred in the underlying routines * or smbc_init not called. * - ENOMEM Out of memory * * @see smbc_stat(), Unix stat() * */int smbc_fstat(int fd, struct stat *st);/**@ingroup attribue * Change the ownership of a file or directory. * * @param url The smb url of the file or directory to change * ownership of. * * @param owner I have no idea? * * @param group I have not idea? * * @return 0 on success, < 0 on error with errno set: * - EPERM The effective UID does not match the owner * of the file, and is not zero; or the owner or group * were specified incorrectly. * - ENOENT The file does not exist. * - ENOMEM Insufficient was available. * - ENOENT file or directory does not exist * * @todo Are we actually going to be able to implement this function * * @todo How do we abstract owner and group uid and gid? * */int smbc_chown(const char *url, uid_t owner, gid_t group);/**@ingroup attribute * Change the permissions of a file. * * @param url The smb url of the file or directory to change * permissions of * * @param mode The permissions to set: * - Put good explaination of permissions here! * * @return 0 on success, < 0 on error with errno set: * - EPERM The effective UID does not match the owner * of the file, and is not zero * - ENOENT The file does not exist. * - ENOMEM Insufficient was available. * - ENOENT file or directory does not exist * * @todo Actually implement this fuction? * * @todo Are errno values complete and correct? */int smbc_chmod(const char *url, mode_t mode);/**@ingroup attribute * Change the last modification time on a file * * @param url The smb url of the file or directory to change * the modification time of * * @param tbuf A timeval structure which contains the desired * modification time. NOTE: Only the tv_sec field is * used. The tv_usec (microseconds) portion is ignored. * * @return 0 on success, < 0 on error with errno set: * - EINVAL The client library is not properly initialized * - EPERM Permission was denied. * */int smbc_utimes(const char *url, struct timeval *tbuf);#ifdef HAVE_UTIME_H/**@ingroup attribute * Change the last modification time on a file * * @param url The smb url of the file or directory to change * the modification time of * * @param utbuf A utimebuf structure which contains the desired * modification time. NOTE: Although the structure contains * an access time as well, the access time value is ignored. * * @return 0 on success, < 0 on error with errno set: * - EINVAL The client library is not properly initialized * - ENOMEM No memory was available for internal needs * - EPERM Permission was denied. * */int smbc_utime(const char *fname, struct utimbuf *utbuf);#endif/**@ingroup attribute * Set extended attributes for a file. This is used for modifying a file's * security descriptor (i.e. owner, group, and access control list) * * @param url The smb url of the file or directory to set extended * attributes for. * * @param name The name of an attribute to be changed. Names are of * one of the following forms: * * system.nt_sec_desc.<attribute name> * system.nt_sec_desc.* * system.nt_sec_desc.*+ * * where <attribute name> is one of: * * revision * owner * owner+ * group * group+ * acl:<name or sid> * acl+:<name or sid> * * In the forms "system.nt_sec_desc.*" and * "system.nt_sec_desc.*+", the asterisk and plus signs are * literal, i.e. the string is provided exactly as shown, and * the value parameter should contain a complete security * descriptor with name:value pairs separated by tabs, * commas, or newlines (not spaces!). * * The plus sign ('+') indicates that SIDs should be mapped * to names. Without the plus sign, SIDs are not mapped; * rather they are simply converted to a string format. * * @param value The value to be assigned to the specified attribute name. * This buffer should contain only the attribute value if the * name was of the "system.nt_sec_desc.<attribute_name>" * form. If the name was of the "system.nt_sec_desc.*" form * then a complete security descriptor, with name:value pairs * separated by tabs, commas, or newlines (not spaces!), * should be provided in this value buffer. A complete * security descriptor will contain one or more entries * selected from the following: * * REVISION:<revision number> * OWNER:<sid or name> * GROUP:<sid or name> * ACL:<sid or name>:<type>/<flags>/<mask> * * The revision of the ACL specifies the internal Windows NT * ACL revision for the security descriptor. If not specified * it defaults to 1. Using values other than 1 may cause * strange behaviour. * * The owner and group specify the owner and group sids for * the object. If the attribute name (either '*+' with a * complete security descriptor, or individual 'owner+' or * 'group+' attribute names) ended with a plus sign, the * specified name is resolved to a SID value, using the * server on which the file or directory resides. Otherwise, * the value should be provided in SID-printable format as * S-1-x-y-z, and is used directly. The <sid or name> * associated with the ACL: attribute should be provided * similarly. * * @param size The number of the bytes of data in the value buffer * * @param flags A bit-wise OR of zero or more of the following: * SMBC_XATTR_FLAG_CREATE - * fail if the named attribute already exists * SMBC_XATTR_FLAG_REPLACE - * fail if the attribute does not already exist * * If neither flag is specified, the specified attributes * will be added or replace existing attributes of the same * name, as necessary. * * @return 0 on success, < 0 on error with errno set: * - EINVAL The client library is not properly initialized * or one of the parameters is not of a correct * form * - ENOMEM No memory was available for internal needs * - EEXIST If the attribute already exists and the flag * SMBC_XATTR_FLAG_CREAT was specified * - ENOATTR If the attribute does not exist and the flag * SMBC_XATTR_FLAG_REPLACE was specified * - EPERM Permission was denied. * - ENOTSUP The referenced file system does not support * extended attributes * * @note Attribute names are compared in a case-insensitive * fashion. All of the following are equivalent, although * the all-lower-case name is the preferred format: * system.nt_sec_desc.owner * SYSTEM.NT_SEC_DESC.OWNER * sYsTeM.nt_sEc_desc.owNER * */int smbc_setxattr(const char *url, const char *name, const void *value, size_t size, int flags);/**@ingroup attribute * Set extended attributes for a file. This is used for modifying a file's * security descriptor (i.e. owner, group, and access control list). The * POSIX function which this maps to would act on a symbolic link rather than * acting on what the symbolic link points to, but with no symbolic links in * SMB file systems, this function is functionally identical to * smbc_setxattr(). * * @param url The smb url of the file or directory to set extended * attributes for. * * @param name The name of an attribute to be changed. Names are of * one of the following forms: * * system.nt_sec_desc.<attribute name> * system.nt_sec_desc.* * system.nt_sec_desc.*+ * * where <attribute name> is one of: * * revision * owner * owner+ * group * group+ * acl:<name or sid> * acl+:<name or sid> * * In the forms "system.nt_sec_desc.*" and * "system.nt_sec_desc.*+", the asterisk and plus signs are * literal, i.e. the string is provided exactly as shown, and * the value parameter should contain a complete security * descriptor with name:value pairs separated by tabs, * commas, or newlines (not spaces!). * * The plus sign ('+') indicates that SIDs should be mapped * to names. Without the plus sign, SIDs are not mapped; * rather they are simply converted to a string format. * * @param value The value to be assigned to the specified attribute name. * This buffer should contain only the attribute value if the * name was of the "system.nt_sec_desc.<attribute_name>" * form. If the name was of the "system.nt_sec_desc.*" form * then a complete security descriptor, with name:value pairs * separated by tabs, commas, or newlines (not spaces!), * should be provided in this value buffer. A complete * security descriptor will contain one or more entries
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -