ports/sysutils/fusefs-smbnetfs/files/patch-3
Mikhail Teterin 1f567f88c6 Actually add the patch advertized earlier.
Reported by:	tijl
2018-01-31 20:44:29 +00:00

117 lines
4.1 KiB
Text

Part of the:
https://sourceforge.net/p/smbnetfs/patches/3/
--- src/samba.h 2018-01-04 20:59:38.000000000 +0000
+++ src/samba.h 2018-01-31 14:48:19.375119000 +0000
@@ -16,6 +16,6 @@
samba_fd samba_open (const char *url, int flags, mode_t mode);
samba_fd samba_creat (const char *url, mode_t mode);
-ssize_t samba_read (samba_fd fd, off_t offset, void *buf, size_t bufsize);
-ssize_t samba_write (samba_fd fd, off_t offset, void *buf, size_t bufsize);
+ssize_t samba_read (samba_fd fd, off_t offset, char *buf, size_t bufsize);
+ssize_t samba_write (samba_fd fd, off_t offset, const char *buf, size_t bufsize);
int samba_close (samba_fd fd);
int samba_unlink (const char *url);
--- src/samba.c 2018-01-04 20:59:38.000000000 +0000
+++ src/samba.c 2018-01-31 14:49:26.546183000 +0000
@@ -255,5 +255,5 @@
}
-ssize_t samba_read(samba_fd fd, off_t offset, void *buf, size_t bufsize){
+ssize_t samba_read(samba_fd fd, off_t offset, char *buf, size_t bufsize){
ssize_t result = 0;
@@ -278,5 +278,5 @@
}
-ssize_t samba_write(samba_fd fd, off_t offset, void *buf, size_t bufsize){
+ssize_t samba_write(samba_fd fd, off_t offset, const char *buf, size_t bufsize){
ssize_t result = 0;
Constify the writing and reduce the number of calls to time().
-mi
--- src/smb_conn.h 2018-01-04 20:59:38
+++ src/smb_conn.h 2018-01-31 14:55:24
@@ -46,5 +46,5 @@
ssize_t smb_conn_write(struct smb_conn_ctx *ctx,
smb_conn_fd fd, off_t offset,
- void *buf, size_t bufsize);
+ const void *buf, size_t bufsize);
int smb_conn_close(struct smb_conn_ctx *ctx,
smb_conn_fd fd);
--- src/smb_conn.c 2018-01-04 20:59:38
+++ src/smb_conn.c 2018-01-31 14:54:37
@@ -630,6 +630,5 @@
pthread_mutex_lock(&ctx->mutex);
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
error = smb_conn_process_query(
ctx, OPEN,
@@ -676,6 +675,5 @@
pthread_mutex_lock(&ctx->mutex);
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
error = smb_conn_process_query(
ctx, CREAT,
@@ -719,6 +717,5 @@
pthread_mutex_lock(&ctx->mutex);
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
error = smb_conn_process_fd_query(
ctx, READ, file,
@@ -740,5 +737,5 @@
ssize_t smb_conn_write(struct smb_conn_ctx *ctx,
smb_conn_fd fd, off_t offset,
- void *buf, size_t bufsize){
+ const void *buf, size_t bufsize){
int error;
@@ -762,6 +759,5 @@
pthread_mutex_lock(&ctx->mutex);
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
memcpy(ctx->shmem_ptr, buf, bufsize);
msync(ctx->shmem_ptr, bufsize, MS_SYNC);
@@ -886,6 +882,5 @@
pthread_mutex_lock(&ctx->mutex);
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
error = smb_conn_process_query(
ctx, OPENDIR,
@@ -964,6 +959,5 @@
pthread_mutex_lock(&ctx->mutex);
if ((file->reopen_cmd == OPENDIR) && (file->ctx == ctx)){
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
/* we cant reopen directory with non-zero offset, so use */
@@ -1104,6 +1098,5 @@
pthread_mutex_lock(&ctx->mutex);
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
error = smb_conn_process_fd_query(
ctx, FSTAT, file,
@@ -1141,6 +1134,5 @@
pthread_mutex_lock(&ctx->mutex);
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){
- ctx->access_time = time(NULL);
- file->access_time = time(NULL);
+ ctx->access_time = file->access_time = time(NULL);
error = smb_conn_process_fd_query(
ctx, FTRUNCATE, file,