Removed
Link Here
|
1 |
Part of the: |
2 |
|
3 |
https://sourceforge.net/p/smbnetfs/patches/3/ |
4 |
|
5 |
--- src/samba.h 2018-01-04 20:59:38.000000000 +0000 |
6 |
+++ src/samba.h 2018-01-31 14:48:19.375119000 +0000 |
7 |
@@ -16,6 +16,6 @@ |
8 |
samba_fd samba_open (const char *url, int flags, mode_t mode); |
9 |
samba_fd samba_creat (const char *url, mode_t mode); |
10 |
-ssize_t samba_read (samba_fd fd, off_t offset, void *buf, size_t bufsize); |
11 |
-ssize_t samba_write (samba_fd fd, off_t offset, void *buf, size_t bufsize); |
12 |
+ssize_t samba_read (samba_fd fd, off_t offset, char *buf, size_t bufsize); |
13 |
+ssize_t samba_write (samba_fd fd, off_t offset, const char *buf, size_t bufsize); |
14 |
int samba_close (samba_fd fd); |
15 |
int samba_unlink (const char *url); |
16 |
--- src/samba.c 2018-01-04 20:59:38.000000000 +0000 |
17 |
+++ src/samba.c 2018-01-31 14:49:26.546183000 +0000 |
18 |
@@ -255,5 +255,5 @@ |
19 |
} |
20 |
|
21 |
-ssize_t samba_read(samba_fd fd, off_t offset, void *buf, size_t bufsize){ |
22 |
+ssize_t samba_read(samba_fd fd, off_t offset, char *buf, size_t bufsize){ |
23 |
ssize_t result = 0; |
24 |
|
25 |
@@ -278,5 +278,5 @@ |
26 |
} |
27 |
|
28 |
-ssize_t samba_write(samba_fd fd, off_t offset, void *buf, size_t bufsize){ |
29 |
+ssize_t samba_write(samba_fd fd, off_t offset, const char *buf, size_t bufsize){ |
30 |
ssize_t result = 0; |
31 |
|
32 |
Constify the writing and reduce the number of calls to time(). |
33 |
|
34 |
-mi |
35 |
|
36 |
--- src/smb_conn.h 2018-01-04 20:59:38 |
37 |
+++ src/smb_conn.h 2018-01-31 14:55:24 |
38 |
@@ -46,5 +46,5 @@ |
39 |
ssize_t smb_conn_write(struct smb_conn_ctx *ctx, |
40 |
smb_conn_fd fd, off_t offset, |
41 |
- void *buf, size_t bufsize); |
42 |
+ const void *buf, size_t bufsize); |
43 |
int smb_conn_close(struct smb_conn_ctx *ctx, |
44 |
smb_conn_fd fd); |
45 |
--- src/smb_conn.c 2018-01-04 20:59:38 |
46 |
+++ src/smb_conn.c 2018-01-31 14:54:37 |
47 |
@@ -630,6 +630,5 @@ |
48 |
|
49 |
pthread_mutex_lock(&ctx->mutex); |
50 |
- ctx->access_time = time(NULL); |
51 |
- file->access_time = time(NULL); |
52 |
+ ctx->access_time = file->access_time = time(NULL); |
53 |
error = smb_conn_process_query( |
54 |
ctx, OPEN, |
55 |
@@ -676,6 +675,5 @@ |
56 |
|
57 |
pthread_mutex_lock(&ctx->mutex); |
58 |
- ctx->access_time = time(NULL); |
59 |
- file->access_time = time(NULL); |
60 |
+ ctx->access_time = file->access_time = time(NULL); |
61 |
error = smb_conn_process_query( |
62 |
ctx, CREAT, |
63 |
@@ -719,6 +717,5 @@ |
64 |
pthread_mutex_lock(&ctx->mutex); |
65 |
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){ |
66 |
- ctx->access_time = time(NULL); |
67 |
- file->access_time = time(NULL); |
68 |
+ ctx->access_time = file->access_time = time(NULL); |
69 |
error = smb_conn_process_fd_query( |
70 |
ctx, READ, file, |
71 |
@@ -740,5 +737,5 @@ |
72 |
ssize_t smb_conn_write(struct smb_conn_ctx *ctx, |
73 |
smb_conn_fd fd, off_t offset, |
74 |
- void *buf, size_t bufsize){ |
75 |
+ const void *buf, size_t bufsize){ |
76 |
|
77 |
int error; |
78 |
@@ -762,6 +759,5 @@ |
79 |
pthread_mutex_lock(&ctx->mutex); |
80 |
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){ |
81 |
- ctx->access_time = time(NULL); |
82 |
- file->access_time = time(NULL); |
83 |
+ ctx->access_time = file->access_time = time(NULL); |
84 |
memcpy(ctx->shmem_ptr, buf, bufsize); |
85 |
msync(ctx->shmem_ptr, bufsize, MS_SYNC); |
86 |
@@ -886,6 +882,5 @@ |
87 |
|
88 |
pthread_mutex_lock(&ctx->mutex); |
89 |
- ctx->access_time = time(NULL); |
90 |
- file->access_time = time(NULL); |
91 |
+ ctx->access_time = file->access_time = time(NULL); |
92 |
error = smb_conn_process_query( |
93 |
ctx, OPENDIR, |
94 |
@@ -964,6 +959,5 @@ |
95 |
pthread_mutex_lock(&ctx->mutex); |
96 |
if ((file->reopen_cmd == OPENDIR) && (file->ctx == ctx)){ |
97 |
- ctx->access_time = time(NULL); |
98 |
- file->access_time = time(NULL); |
99 |
+ ctx->access_time = file->access_time = time(NULL); |
100 |
|
101 |
/* we cant reopen directory with non-zero offset, so use */ |
102 |
@@ -1104,6 +1098,5 @@ |
103 |
pthread_mutex_lock(&ctx->mutex); |
104 |
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){ |
105 |
- ctx->access_time = time(NULL); |
106 |
- file->access_time = time(NULL); |
107 |
+ ctx->access_time = file->access_time = time(NULL); |
108 |
error = smb_conn_process_fd_query( |
109 |
ctx, FSTAT, file, |
110 |
@@ -1141,6 +1134,5 @@ |
111 |
pthread_mutex_lock(&ctx->mutex); |
112 |
if ((file->reopen_cmd == OPEN) && (file->ctx == ctx)){ |
113 |
- ctx->access_time = time(NULL); |
114 |
- file->access_time = time(NULL); |
115 |
+ ctx->access_time = file->access_time = time(NULL); |
116 |
error = smb_conn_process_fd_query( |
117 |
ctx, FTRUNCATE, file, |