|
libdsm
0.0.4-11-g223c1ba
Minimalist and read-only SMB client lib
|
File operations. More...
#include "bdsm/smb_session.h"Functions | |
| smb_fd | smb_fopen (smb_session *s, smb_tid tid, const char *path, uint32_t mod) |
| Open a file on a share. More... | |
| void | smb_fclose (smb_session *s, smb_fd fd) |
| Close an open file. More... | |
| ssize_t | smb_fread (smb_session *s, smb_fd fd, void *buf, size_t buf_size) |
| Read from an open file. More... | |
| ssize_t | smb_fseek (smb_session *s, smb_fd fd, ssize_t offset, int whence) |
| Sets/Moves/Get the read pointer for a given file. More... | |
File operations.
| void smb_fclose | ( | smb_session * | s, |
| smb_fd | fd | ||
| ) |
Close an open file.
The smb_fd is invalidated and MUST not be use it anymore. You can give it the 0 value.
| s | The session object |
| fd | The SMB file descriptor |
| smb_fd smb_fopen | ( | smb_session * | s, |
| smb_tid | tid, | ||
| const char * | path, | ||
| uint32_t | mod | ||
| ) |
Open a file on a share.
Use this function to obtain an smb_fd, necesary for file operations
| s | The session object |
| tid | The tid of the share the file is in, obtained via smb_tree_connect() |
| path | The path of the file to open |
| mod | The access modes requested (example: SMB_MOD_RO) |
| ssize_t smb_fread | ( | smb_session * | s, |
| smb_fd | fd, | ||
| void * | buf, | ||
| size_t | buf_size | ||
| ) |
Read from an open file.
The semantics is basically the same that the unix read() one. At most 'buf_size' bytes are read from the current seek offset and copied into the memory pointed by 'buf' from the open file represented by the smb file descriptor 'fd'.
| [in] | s | The session object |
| [in] | fd | [description] |
| [out] | buf | [description] |
| [in] | buf_size | [description] |
| ssize_t smb_fseek | ( | smb_session * | s, |
| smb_fd | fd, | ||
| ssize_t | offset, | ||
| int | whence | ||
| ) |
Sets/Moves/Get the read pointer for a given file.
The behavior of this function is the same as the Unix fseek() function, except the SEEK_END argument isn't supported.
This functions adjust the read the read pointer depending on the value of offset and whence.
| s | The session object |
| fd | The file descriptors for which the read pointer is to be adjusted |
| offset | Set/Adjust quantity |
| whence | Which action to perform. Supported operations are SMB_SEEK_SET and SMB_SEEK_CUR |
1.8.8