関数 | |
| int | smbc_open (const char *furl, int flags, mode_t mode) |
| Open a file on an SMB server. | |
| int | smbc_creat (const char *furl, mode_t mode) |
| Create a file on an SMB server. | |
| ssize_t | smbc_read (int fd, void *buf, size_t bufsize) |
| Read from a file using an opened file handle. | |
| ssize_t | smbc_write (int fd, void *buf, size_t bufsize) |
| Write to a file using an opened file handle. | |
| off_t | smbc_lseek (int fd, off_t offset, int whence) |
| Seek to a specific location in a file. | |
| int | smbc_close (int fd) |
| Close an open file handle. | |
| int smbc_open | ( | const char * | furl, | |
| int | flags, | |||
| mode_t | mode | |||
| ) |
Open a file on an SMB server.
| furl | The smb url of the file to be opened. | |
| flags | Is one of O_RDONLY, O_WRONLY or O_RDWR which request opening the file read-only,write-only or read/write. flags may also be bitwise-or'd with one or more of the following: O_CREAT - If the file does not exist it will be created. O_EXCL - When used with O_CREAT, if the file already exists it is an error and the open will fail. O_TRUNC - If the file already exists it will be truncated. O_APPEND The file is opened in append mode | |
| mode | mode specifies the permissions to use if a new file is created. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask) |
libsmb_compat.c の 155 行で定義されています。
参照先 add_fd()・_SMBCCTX::close_fn・fd・smbc_compat_fdlist::file・_SMBCCTX::open・statcont.
参照元 do_get()・do_put()・smb_download_file().
00156 { 00157 SMBCFILE * file; 00158 int fd; 00159 00160 file = (statcont->open)(statcont, furl, flags, mode); 00161 if (!file) 00162 return -1; 00163 00164 fd = add_fd(file); 00165 if (fd == -1) 00166 (statcont->close_fn)(statcont, file); 00167 return fd; 00168 }
| int smbc_creat | ( | const char * | furl, | |
| mode_t | mode | |||
| ) |
Create a file on an SMB server.
Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC
| furl | The smb url of the file to be created | |
| mode | mode specifies the permissions to use if a new file is created. It is modified by the process's umask in the usual way: the permissions of the created file are (mode & ~umask) |
libsmb_compat.c の 171 行で定義されています。
参照先 add_fd()・_SMBCCTX::close_fn・_SMBCCTX::creat・fd・smbc_compat_fdlist::file・statcont・_SMBCCTX::unlink.
参照元 do_put().
00172 { 00173 SMBCFILE * file; 00174 int fd; 00175 00176 file = (statcont->creat)(statcont, furl, mode); 00177 if (!file) 00178 return -1; 00179 00180 fd = add_fd(file); 00181 if (fd == -1) { 00182 /* Hmm... should we delete the file too ? I guess we could try */ 00183 (statcont->close_fn)(statcont, file); 00184 (statcont->unlink)(statcont, furl); 00185 } 00186 return fd; 00187 }
| ssize_t smbc_read | ( | int | fd, | |
| void * | buf, | |||
| size_t | bufsize | |||
| ) |
Read from a file using an opened file handle.
| fd | Open file handle from smbc_open() or smbc_creat() | |
| buf | Pointer to buffer to recieve read data | |
| bufsize | Size of buf in bytes |
libsmb_compat.c の 190 行で定義されています。
参照先 smbc_compat_fdlist::file・find_fd()・_SMBCCTX::read・statcont.
参照元 do_get()・smb_download_file().
00191 { 00192 SMBCFILE * file = find_fd(fd); 00193 return (statcont->read)(statcont, file, buf, bufsize); 00194 }
| ssize_t smbc_write | ( | int | fd, | |
| void * | buf, | |||
| size_t | bufsize | |||
| ) |
Write to a file using an opened file handle.
| fd | Open file handle from smbc_open() or smbc_creat() | |
| buf | Pointer to buffer to recieve read data | |
| bufsize | Size of buf in bytes |
libsmb_compat.c の 196 行で定義されています。
参照先 smbc_compat_fdlist::file・find_fd()・statcont・_SMBCCTX::write.
参照元 do_put().
00197 { 00198 SMBCFILE * file = find_fd(fd); 00199 return (statcont->write)(statcont, file, buf, bufsize); 00200 }
| off_t smbc_lseek | ( | int | fd, | |
| off_t | offset, | |||
| int | whence | |||
| ) |
Seek to a specific location in a file.
| fd | Open file handle from smbc_open() or smbc_creat() | |
| offset | Offset in bytes from whence | |
| whence | A location in the file:
|
libsmb_compat.c の 202 行で定義されています。
参照先 smbc_compat_fdlist::file・find_fd()・_SMBCCTX::lseek・statcont.
参照元 do_get()・do_put()・smb_download_file().
00203 { 00204 SMBCFILE * file = find_fd(fd); 00205 return (statcont->lseek)(statcont, file, offset, whence); 00206 }
| int smbc_close | ( | int | fd | ) |
Close an open file handle.
| fd | The file handle to close |
libsmb_compat.c の 208 行で定義されています。
参照先 _SMBCCTX::close_fn・del_fd()・smbc_compat_fdlist::file・find_fd()・statcont.
参照元 do_get()・do_put()・smb_download_file().
00209 { 00210 SMBCFILE * file = find_fd(fd); 00211 del_fd(fd); 00212 return (statcont->close_fn)(statcont, file); 00213 }
1.4.7