[803699]: src / function.c Maximize Restore History

Download this file

function.c    685 lines (575 with data), 19.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <errno.h>
#include <fcntl.h>
#include <dirent.h>
#include <sys/statvfs.h>
#include <time.h>
#include <pthread.h>
#include <libsmbclient.h>
#ifdef HAVE_SETXATTR
#include <sys/xattr.h>
#endif
#include "common.h"
#include "smbitem.h"
#include "samba.h"
#include "function.h"
size_t function_free_space_size = 0;
int function_quiet_flag = 1;
int function_show_dollar_shares = 0;
int function_show_hidden_hosts = 0;
int function_kde_workaround_depth = 3;
pthread_mutex_t m_function = PTHREAD_MUTEX_INITIALIZER;
int function_set_free_space_size(size_t blocks_count){
DPRINTF(7, "blocks_count=%d\n", (int) blocks_count);
pthread_mutex_lock(&m_function);
function_free_space_size = blocks_count;
pthread_mutex_unlock(&m_function);
return 1;
}
size_t function_get_free_space_size(void){
size_t blocks_count;
pthread_mutex_lock(&m_function);
blocks_count = function_free_space_size;
pthread_mutex_unlock(&m_function);
DPRINTF(7, "blocks_count=%d\n", (int) blocks_count);
return blocks_count;
}
int function_set_quiet_flag(int flag){
DPRINTF(7, "flag=%d\n", flag);
pthread_mutex_lock(&m_function);
function_quiet_flag = flag;
pthread_mutex_unlock(&m_function);
return 1;
}
int function_get_quiet_flag(void){
int flag;
pthread_mutex_lock(&m_function);
flag = function_quiet_flag;
pthread_mutex_unlock(&m_function);
DPRINTF(7, "flag=%d\n", flag);
return flag;
}
int function_set_dollar_share_visibility(int flag){
DPRINTF(7, "flag=%d\n", flag);
pthread_mutex_lock(&m_function);
function_show_dollar_shares = flag;
pthread_mutex_unlock(&m_function);
return 1;
}
int function_get_dollar_share_visibility(void){
int flag;
pthread_mutex_lock(&m_function);
flag = function_show_dollar_shares;
pthread_mutex_unlock(&m_function);
DPRINTF(7, "flag=%d\n", flag);
return flag;
}
int function_set_hidden_hosts_visibility(int flag){
DPRINTF(7, "flag=%d\n", flag);
pthread_mutex_lock(&m_function);
function_show_hidden_hosts = flag;
pthread_mutex_unlock(&m_function);
return 1;
}
int function_get_hidden_hosts_visibility(void){
int flag;
pthread_mutex_lock(&m_function);
flag = function_show_hidden_hosts;
pthread_mutex_unlock(&m_function);
DPRINTF(7, "flag=%d\n", flag);
return flag;
}
int function_set_kde_workaround_depth(int depth){
if (depth < -1) return 0;
DPRINTF(7, "depth=%d\n", depth);
pthread_mutex_lock(&m_function);
function_kde_workaround_depth = depth;
pthread_mutex_unlock(&m_function);
return 1;
}
int function_get_kde_workaround_depth(void){
int depth;
pthread_mutex_lock(&m_function);
depth = function_kde_workaround_depth;
pthread_mutex_unlock(&m_function);
DPRINTF(7, "depth=%d\n", depth);
return depth;
}
int function_is_kde_workaround(const char *path){
const char *kde_dir_name = ".directory";
const ssize_t kde_dir_len = strlen(kde_dir_name);
int i, depth = function_get_kde_workaround_depth();
const char *path_end;
for(i = 0; (i < depth) || (depth == -1); i++){
while(*path == '/') path++;
if (*path == '\0') break;
path_end = path;
while((*path_end != '/') && (*path_end != '\0')) path_end++;
if ((path_end - path == kde_dir_len) &&
(strncmp(path, kde_dir_name, kde_dir_len) == 0)) return 1;
path = path_end;
}
return 0;
}
inline samba_fd function_get_fd(struct fuse_file_info *fi){
return (samba_fd) fi->fh;
}
inline void function_store_fd(struct fuse_file_info *fi, samba_fd fd){
fi->fh = (uint64_t) fd;
}
static int function_open(const char *path, struct fuse_file_info *fi){
samba_fd fd;
DPRINTF(5, "(%s, flags=%o, fh=%llx)\n", path, fi->flags, (long long) fi->fh);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if ((fd = samba_open(path, fi->flags, 0777)) == NULL) return -errno;
function_store_fd(fi, fd);
return 0;
}
static int function_creat(const char *path, mode_t mode,
struct fuse_file_info *fi){
samba_fd fd;
DPRINTF(5, "(%s, mode=%0x, flags=%o, fh=%llx)\n", path, mode,
fi->flags, (long long) fi->fh);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if ((fd = samba_creat(path, fi->flags)) == NULL) return -errno;
function_store_fd(fi, fd);
return 0;
}
static int function_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi){
int result;
samba_fd fd;
DPRINTF(5, "(%s, %d, fh=%llx, offset=%lld, flags=%o)\n", path, (int) size,
(long long) fi->fh, (long long) offset, fi->flags);
if ((fd = function_get_fd(fi)) == NULL) return -EBADF;
result = samba_read(fd, offset, buf, size);
if (result == (ssize_t) (-1)) return -errno;
return result;
}
static int function_write(const char *path, const char *buf, size_t size,
off_t offset, struct fuse_file_info *fi){
int result;
samba_fd fd;
DPRINTF(5, "(%s, %d, fh=%llx, offset=%lld, flags=%o)\n", path, (int) size,
(long long) fi->fh, (long long) offset, fi->flags);
if ((fd = function_get_fd(fi)) == NULL) return -EBADF;
result = samba_write(fd, offset, (char *) buf, size);
if (result == (ssize_t) (-1)) return -errno;
return result;
}
static int function_close(const char *path, struct fuse_file_info *fi){
samba_fd fd;
DPRINTF(5, "(%s, fh=%llx, flags=%o)\n", path, (long long) fi->fh, fi->flags);
if ((fd = function_get_fd(fi)) == NULL) return -EBADF;
if (samba_close(fd) != 0) return -errno;
return 0;
}
static int function_unlink(const char *path){
DPRINTF(5, "(%s)\n", path);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_unlink(path) != 0) return -errno;
return 0;
}
static int function_rename(const char *from, const char *to){
DPRINTF(5, "(%s, %s)\n", from, to);
if (smbitem_what_is(from) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (smbitem_what_is(to) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_rename(from, to) != 0) return -errno;
return 0;
}
static int function_opendir(const char *path, struct fuse_file_info *fi){
samba_fd fd;
DPRINTF(5, "(%s, flags=%o, fh=%llx)\n", path, fi->flags, (long long) fi->fh);
switch(smbitem_what_is(path)){
case SMBITEM_SMBNETFS_DIR:
function_store_fd(fi, (samba_fd) (-1));
return 0;
case SMBITEM_SMB_NAME:
case SMBITEM_SMB_SHARE:
case SMBITEM_SMB_SHARE_ITEM:
if ((fd = samba_opendir(path)) == NULL) return -errno;
function_store_fd(fi, fd);
return 0;
default:
return -ENOTDIR;
}
}
static int function_closedir(const char *path, struct fuse_file_info *fi){
samba_fd fd;
DPRINTF(5, "(%s, fh=%llx, flags=%o)\n", path, (long long) fi->fh, fi->flags);
if ((fd = function_get_fd(fi)) == NULL) return -EBADF;
if (fd == (samba_fd) (-1)) return 0;
if (samba_closedir(fd) != 0) return -errno;
return 0;
}
static int function_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi){
samba_fd fd;
int error, rec_cnt;
struct stat st;
(void) offset;
DPRINTF(5, "(%s)\n", path);
memset(&st, 0, sizeof(st));
if ((fd = function_get_fd(fi)) == NULL) return -EBADF;
if (fd == (samba_fd) (-1)){
int i, show_hidden_hosts;
struct smbitem *dir;
while(*path == '/') path++;
if ((dir = smbitem_getdir(path)) == NULL) return -EBADF;
error = EINVAL;
st.st_mode = S_IFDIR;
if (filler(buf, ".", &st, 0)) goto error0;
if (filler(buf, "..", &st, 0)) goto error0;
show_hidden_hosts = function_get_hidden_hosts_visibility();
for(i = 0; i < dir->child_cnt; i++){
switch(dir->childs[i]->type){
case SMBITEM_GROUP:
st.st_mode = S_IFDIR;
break;
case SMBITEM_HOST:
st.st_mode = S_IFDIR;
if (! show_hidden_hosts) continue;
break;
case SMBITEM_LINK:
st.st_mode = S_IFLNK;
break;
default:
goto error0;
}
if (filler(buf, dir->childs[i]->name, &st, 0)) goto end;
}
error = 0;
error0:
smbitem_release_dir(dir);
return -error;
}
rec_cnt = 0;
while(*path == '/') path++;
while(1){
int count;
char readdir_buf[4096];
char name[1024];
char link[1024];
struct smb_conn_dirent_rec *rec;
count = samba_readdir(fd, readdir_buf, sizeof(readdir_buf));
if (count == 0) break;
if (count < 0){
error = errno;
goto end;
}
rec = (struct smb_conn_dirent_rec *) readdir_buf;
for( ; count >= (int) sizeof(struct smb_conn_dirent_rec);
count -= sizeof(struct smb_conn_dirent_rec)){
if (strcmp(rec->d_name, "") == 0) goto next_record;
if (strcmp(rec->d_name, ".") == 0) goto next_record;
if (strcmp(rec->d_name, "..") == 0) goto next_record;
switch(rec->smbc_type){
case SMBC_WORKGROUP:
error = EBADF;
goto end;
case SMBC_SERVER:
st.st_mode = S_IFDIR;
snprintf(name, sizeof(name), "%s/%s", path, rec->d_name);
snprintf(link, sizeof(link), "../%s", rec->d_name);
smbitem_mkgroup(path, SMBITEM_SAMBA_TREE);
smbitem_mkhost(rec->d_name, path, 1, SMBITEM_SAMBA_TREE);
smbitem_mklink(name, link, SMBITEM_SAMBA_TREE);
break;
case SMBC_FILE_SHARE:
st.st_mode = S_IFDIR;
if ((rec->d_name[strlen(rec->d_name) - 1] == '$') &&
! function_get_dollar_share_visibility())
goto next_record;
break;
case SMBC_DIR:
st.st_mode = S_IFDIR;
break;
case SMBC_FILE:
st.st_mode = S_IFREG;
break;
default:
goto next_record;
}
if (rec_cnt == 0){
struct stat st;
error = EINVAL;
memset(&st, 0, sizeof(st));
st.st_mode = S_IFDIR;
if (filler(buf, ".", &st, 0)) goto end;
if (filler(buf, "..", &st, 0)) goto end;
rec_cnt += 2;
}
if (filler(buf, rec->d_name, &st, 0)){
error = EINVAL;
goto end;
}
rec_cnt++;
next_record:
rec++;
}
}
if (rec_cnt == 0){
error = EINVAL;
st.st_mode = S_IFDIR;
if (filler(buf, ".", &st, 0)) goto end;
if (filler(buf, "..", &st, 0)) goto end;
rec_cnt += 2;
}
error = 0;
end:
return -error;
}
static int function_mkdir(const char *path, mode_t mode){
DPRINTF(5, "(%s, %o)\n", path, mode);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_mkdir(path, mode) != 0) return -errno;
return 0;
}
static int function_rmdir(const char *path){
DPRINTF(5, "(%s)\n", path);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_rmdir(path) != 0) return -errno;
return 0;
}
static int function_stat(const char *path, struct stat *stbuf){
int i, count;
size_t len;
struct smbitem *dir;
char buf[2048];
DPRINTF(5, "(%s)\n", path);
if (function_is_kde_workaround(path)) return -ENOENT;
switch(smbitem_what_is(path)){
case SMBITEM_SMBNETFS_DIR:
while(*path == '/') path++;
count = 2;
if ((dir = smbitem_getdir(path)) == NULL) return -EINVAL;
for(i = 0; i < dir->child_cnt; i++)
switch(dir->childs[i]->type){
case SMBITEM_HOST:
case SMBITEM_GROUP:
count++;
break;
default:
break;
}
smbitem_release_dir(dir);
memset(stbuf, 0, sizeof(struct stat));
stbuf->st_mode = 0040777; /* protection */
stbuf->st_nlink = count; /* number of hard links */
stbuf->st_uid = 0; /* user ID of owner */
stbuf->st_gid = 0; /* group ID of owner */
stbuf->st_size = 0; /* total size, in bytes */
stbuf->st_blksize = 4096; /* blocksize for filesystem I/O */
return 0;
case SMBITEM_SMBNETFS_LINK:
DPRINTF(5, "link:(%s)\n", path);
if (smbitem_readlink(path, buf, sizeof(buf)) != 0) return -EINVAL;
len = strlen(buf);
memset(stbuf, 0, sizeof(struct stat));
stbuf->st_mode = 0120777; /* protection */
stbuf->st_nlink = 1; /* number of hard links */
stbuf->st_uid = 0; /* user ID of owner */
stbuf->st_gid = 0; /* group ID of owner */
stbuf->st_size = len; /* total size, in bytes */
stbuf->st_blksize = 4096; /* blocksize for filesystem I/O */
return 0;
case SMBITEM_SMB_NAME:
case SMBITEM_SMB_SHARE:
memset(stbuf, 0, sizeof(struct stat));
stbuf->st_mode = 0040777; /* protection */
stbuf->st_nlink = 2; /* number of hard links */
stbuf->st_uid = 0; /* user ID of owner */
stbuf->st_gid = 0; /* group ID of owner */
stbuf->st_size = 0; /* total size, in bytes */
stbuf->st_blksize = 4096; /* blocksize for filesystem I/O */
return 0;
case SMBITEM_SMB_SHARE_ITEM:
if (samba_stat(path, stbuf) != 0) return -errno;
return 0;
default:
return -EINVAL;
}
}
static int function_fstat(const char *path, struct stat *stbuf,
struct fuse_file_info *fi){
int i, count;
struct smbitem *dir;
samba_fd fd;
(void) path;
DPRINTF(5, "(%s)\n", path);
if ((fd = function_get_fd(fi)) == NULL) return -EBADF;
if (fd == (samba_fd) (-1)){
/* SMBNETFS_DIR */
while(*path == '/') path++;
count = 2;
if ((dir = smbitem_getdir(path)) == NULL) return -EBADF;
for(i = 0; i < dir->child_cnt; i++)
switch(dir->childs[i]->type){
case SMBITEM_HOST:
case SMBITEM_GROUP:
count++;
break;
default:
break;
}
smbitem_release_dir(dir);
memset(stbuf, 0, sizeof(struct stat));
stbuf->st_mode = 0040777; /* protection */
stbuf->st_nlink = count; /* number of hard links */
stbuf->st_uid = 0; /* user ID of owner */
stbuf->st_gid = 0; /* group ID of owner */
stbuf->st_size = 0; /* total size, in bytes */
stbuf->st_blksize = 4096; /* blocksize for filesystem I/O */
return 0;
}
if (samba_fstat(fd, stbuf) != 0) return -errno;
return 0;
}
static int function_ftruncate(const char *path, off_t size,
struct fuse_file_info *fi){
samba_fd fd;
DPRINTF(5, "(%s, %lld)\n", path, (long long) size);
if (size < 0) return -EINVAL;
if ((fd = function_get_fd(fi)) == NULL) return -EBADF;
if (samba_ftruncate(fd, size) != 0) return -errno;
return 0;
}
static int function_chmod(const char *path, mode_t mode){
DPRINTF(5, "(%s, %o)\n", path, mode);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_chmod(path, mode) != 0) return -errno;
return 0;
}
static int function_utimes(const char *path, struct utimbuf *buffer){
struct timeval tbuf[2];
DPRINTF(5, "(%s, %u)\n", path, (unsigned int)buffer->modtime);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
tbuf[0].tv_sec = buffer->actime;
tbuf[0].tv_usec = 0;
tbuf[1].tv_sec = buffer->modtime;
tbuf[1].tv_usec = 0;
if (samba_utimes(path, tbuf) != 0) return -errno;
return 0;
}
/* libfuse does not support lsetxattr() and fsetxattr(), but samba does */
static int function_setxattr(const char *path, const char *name,
const char *value, size_t size, int flags){
DPRINTF(5, "(%s, name=%s, value=%s, size=%d, flags=%o)\n", path,
name, value, (int) size, flags);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_setxattr(path, name, value, size, flags) != 0) return -errno;
return 0;
}
/* libfuse does not support lgetxattr() and fgetxattr(), but samba does */
static int function_getxattr(const char *path, const char *name,
char *value, size_t size){
DPRINTF(5, "(%s, name=%s, size=%d)\n", path, name, (int) size);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_getxattr(path, name, value, size) != 0) return -errno;
return 0;
}
/* libfuse does not support llistxattr() and flistxattr(), but samba does */
static int function_listxattr(const char *path, char *list, size_t size){
DPRINTF(5, "(%s, size=%d)\n", path, (int) size);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_listxattr(path, list, size) != 0) return -errno;
return 0;
}
/* libfuse does not support lremovexattr() and fremovexattr(), but samba does */
static int function_removexattr(const char *path, const char *name){
DPRINTF(5, "(%s, name=%s)\n", path, name);
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if (samba_removexattr(path, name) != 0) return -errno;
return 0;
}
static int function_readlink(const char *path, char *buf, size_t size){
DPRINTF(5, "(%s, %d)\n", path, (int) size);
if (smbitem_what_is(path) != SMBITEM_SMBNETFS_LINK) return -EINVAL;
if (smbitem_readlink(path, buf, size) != 0) return -EINVAL;
return 0;
}
static int function_mknod(const char *path, mode_t mode, dev_t rdev){
samba_fd fd;
(void) rdev;
DPRINTF(5, "(%s, %o)\n", path, mode);
if ((mode & S_IFMT) != S_IFREG) return -EPERM;
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if ((fd = samba_creat(path, mode)) == NULL) return -errno;
if (samba_close(fd) != 0) return -errno;
return 0;
}
static int function_chown(const char *path, uid_t uid, gid_t gid){
(void) path;
(void) uid;
(void) gid;
DPRINTF(5, "(%s, uid=%d, gid=%d)\n", path, uid, gid);
if (function_get_quiet_flag()) return 0;
else return -EPERM;
}
static int function_truncate(const char *path, off_t size){
samba_fd fd;
DPRINTF(5, "(%s, %lld)\n", path, (long long) size);
if (size < 0) return -EINVAL;
if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
if ((fd = samba_open(path, O_RDWR, 0777)) == NULL) return -errno;
if (samba_ftruncate(fd, size) != 0){
int error = errno;
samba_close(fd);
return -error;
}
if (samba_close(fd) != 0) return -errno;
return 0;
}
static int function_statfs(const char *path, struct statvfs *stbuf){
int free_space_blocks;
DPRINTF(5, "(%s)\n", path);
free_space_blocks = function_get_free_space_size();
memset(stbuf, 0, sizeof(struct statvfs));
stbuf->f_bsize = 4096;
stbuf->f_frsize = 4096;
if (free_space_blocks > 0){
stbuf->f_blocks = free_space_blocks;
stbuf->f_bfree = free_space_blocks;
stbuf->f_bavail = free_space_blocks;
stbuf->f_ffree = 32768;
stbuf->f_favail = 32768;
}
stbuf->f_namemax = FILENAME_MAX;
return 0;
}
struct fuse_operations smb_oper = {
.open = function_open,
.create = function_creat,
.read = function_read,
.write = function_write,
.release = function_close,
.unlink = function_unlink,
.rename = function_rename,
.opendir = function_opendir,
.releasedir = function_closedir,
.readdir = function_readdir,
.mkdir = function_mkdir,
.rmdir = function_rmdir,
.getattr = function_stat,
.fgetattr = function_fstat,
.ftruncate = function_ftruncate,
.chmod = function_chmod,
.utime = function_utimes,
.setxattr = function_setxattr,
.getxattr = function_getxattr,
.listxattr = function_listxattr,
.removexattr= function_removexattr,
.readlink = function_readlink,
.mknod = function_mknod,
.chown = function_chown,
.truncate = function_truncate,
.statfs = function_statfs,
// .init = function_init, /* event.c */
// .destroy = function_destroy, /* event.c */
// .fsyncdir = function_fsyncdir,
// .access = function_access,
};