Changeset 988 for vendor/current/examples/VFS
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/examples/VFS
- Files:
-
- 1 added
- 8 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/examples/VFS/README
r414 r988 11 11 final functions, like a database filesystem. 12 12 13 Please look at skel_transp ort.c when you want your module to provide13 Please look at skel_transparent.c when you want your module to provide 14 14 passthrough functions, like audit modules. 15 15 -
vendor/current/examples/VFS/shadow_copy_test.c
r860 r988 19 19 */ 20 20 21 #include " includes.h"21 #include "../source3/include/includes.h" 22 22 #include "ntioctl.h" 23 #include "smbd/proto.h"24 23 25 24 #undef DBGC_CLASS … … 58 57 bool labels) 59 58 { 60 uint32 num = 3;61 uint32 i;59 uint32_t num = 3; 60 uint32_t i; 62 61 63 62 shadow_copy_data->num_volumes = num; … … 65 64 if (labels) { 66 65 if (num) { 67 shadow_copy_data->labels = TALLOC_ZERO_ARRAY(shadow_copy_data,SHADOW_COPY_LABEL,num);66 shadow_copy_data->labels = talloc_zero_array(shadow_copy_data,SHADOW_COPY_LABEL,num); 68 67 } else { 69 68 shadow_copy_data->labels = NULL; … … 82 81 83 82 static struct vfs_fn_pointers vfs_test_shadow_copy_fns = { 84 .get_shadow_copy_data = test_get_shadow_copy_data83 .get_shadow_copy_data_fn = test_get_shadow_copy_data 85 84 }; 86 85 86 static_decl_vfs; 87 87 NTSTATUS vfs_shadow_copy_test_init(void) 88 88 { -
vendor/current/examples/VFS/skel_opaque.c
r860 r988 22 22 */ 23 23 24 25 #include "includes.h" 26 #include "smbd/proto.h" 24 #include "../source3/include/includes.h" 25 #include "lib/util/tevent_ntstatus.h" 27 26 28 27 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE … … 34 33 */ 35 34 36 static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user) 35 static int skel_connect(vfs_handle_struct *handle, const char *service, 36 const char *user) 37 37 { 38 38 errno = ENOSYS; … … 45 45 } 46 46 47 static uint64_t skel_disk_free(vfs_handle_struct *handle, 48 bool small_query,uint64_t *bsize,49 uint64_t *dfree, uint64_t *dsize)47 static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path, 48 uint64_t *bsize, 49 uint64_t *dfree, uint64_t *dsize) 50 50 { 51 51 *bsize = 0; … … 55 55 } 56 56 57 static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) 58 { 59 errno = ENOSYS; 60 return -1; 61 } 62 63 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) 64 { 65 errno = ENOSYS; 66 return -1; 67 } 68 69 static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels) 70 { 71 errno = ENOSYS; 72 return -1; 73 } 74 75 static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf) 76 { 77 errno = ENOSYS; 78 return -1; 79 } 80 81 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res) 57 static int skel_get_quota(vfs_handle_struct *handle, const char *path, 58 enum SMB_QUOTA_TYPE qtype, unid_t id, 59 SMB_DISK_QUOTA *dq) 60 { 61 errno = ENOSYS; 62 return -1; 63 } 64 65 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, 66 unid_t id, SMB_DISK_QUOTA *dq) 67 { 68 errno = ENOSYS; 69 return -1; 70 } 71 72 static int skel_get_shadow_copy_data(vfs_handle_struct *handle, 73 files_struct *fsp, 74 struct shadow_copy_data *shadow_copy_data, 75 bool labels) 76 { 77 errno = ENOSYS; 78 return -1; 79 } 80 81 static int skel_statvfs(struct vfs_handle_struct *handle, 82 const char *path, struct vfs_statvfs_struct *statbuf) 83 { 84 errno = ENOSYS; 85 return -1; 86 } 87 88 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, 89 enum timestamp_set_resolution *p_ts_res) 82 90 { 83 91 return 0; 84 92 } 85 93 86 static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) 94 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle, 95 struct dfs_GetDFSReferral *r) 96 { 97 return NT_STATUS_NOT_IMPLEMENTED; 98 } 99 100 static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, 101 const char *mask, uint32_t attr) 87 102 { 88 103 return NULL; 89 104 } 90 105 91 static SMB_STRUCT_DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr) 106 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle, 107 TALLOC_CTX *mem_ctx, 108 const char *service_path, 109 char **base_volume) 110 { 111 return NT_STATUS_NOT_SUPPORTED; 112 } 113 114 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle, 115 TALLOC_CTX *mem_ctx, 116 const char *base_volume, 117 time_t *tstamp, 118 bool rw, 119 char **base_path, 120 char **snap_path) 121 { 122 return NT_STATUS_NOT_SUPPORTED; 123 } 124 125 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle, 126 TALLOC_CTX *mem_ctx, 127 char *base_path, 128 char *snap_path) 129 { 130 return NT_STATUS_NOT_SUPPORTED; 131 } 132 133 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, 134 const char *mask, uint32_t attr) 92 135 { 93 136 return NULL; 94 137 } 95 138 96 static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, 97 SMB_STRUCT_DIR *dirp, 98 SMB_STRUCT_STAT *sbuf) 139 static struct dirent *skel_readdir(vfs_handle_struct *handle, 140 DIR *dirp, SMB_STRUCT_STAT *sbuf) 99 141 { 100 142 return NULL; 101 143 } 102 144 103 static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset)145 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset) 104 146 { 105 147 ; 106 148 } 107 149 108 static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)150 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp) 109 151 { 110 152 return (long)-1; 111 153 } 112 154 113 static void skel_rewind_dir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)155 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp) 114 156 { 115 157 ; 116 158 } 117 159 118 static int skel_mkdir(vfs_handle_struct *handle, 119 { 120 errno = ENOSYS; 121 return -1; 122 } 123 124 static int skel_rmdir(vfs_handle_struct *handle, 125 { 126 errno = ENOSYS; 127 return -1; 128 } 129 130 static int skel_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dir)131 { 132 errno = ENOSYS; 133 return -1; 134 } 135 136 static void skel_init_search_op(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)160 static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) 161 { 162 errno = ENOSYS; 163 return -1; 164 } 165 166 static int skel_rmdir(vfs_handle_struct *handle, const char *path) 167 { 168 errno = ENOSYS; 169 return -1; 170 } 171 172 static int skel_closedir(vfs_handle_struct *handle, DIR *dir) 173 { 174 errno = ENOSYS; 175 return -1; 176 } 177 178 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp) 137 179 { 138 180 ; … … 147 189 148 190 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, 149 struct smb_request *req, 150 uint16_t root_dir_fid, 151 struct smb_filename *smb_fname, 152 uint32_t access_mask, 153 uint32_t share_access, 154 uint32_t create_disposition, 155 uint32_t create_options, 156 uint32_t file_attributes, 157 uint32_t oplock_request, 158 uint64_t allocation_size, 159 uint32_t private_flags, 160 struct security_descriptor *sd, 161 struct ea_list *ea_list, 162 files_struct **result, 163 int *pinfo) 191 struct smb_request *req, 192 uint16_t root_dir_fid, 193 struct smb_filename *smb_fname, 194 uint32_t access_mask, 195 uint32_t share_access, 196 uint32_t create_disposition, 197 uint32_t create_options, 198 uint32_t file_attributes, 199 uint32_t oplock_request, 200 struct smb2_lease *lease, 201 uint64_t allocation_size, 202 uint32_t private_flags, 203 struct security_descriptor *sd, 204 struct ea_list *ea_list, 205 files_struct **result, int *pinfo, 206 const struct smb2_create_blobs *in_context_blobs, 207 struct smb2_create_blobs *out_context_blobs) 164 208 { 165 209 return NT_STATUS_NOT_IMPLEMENTED; … … 172 216 } 173 217 174 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) 175 { 176 errno = ENOSYS; 177 return -1; 178 } 179 180 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) 181 { 182 errno = ENOSYS; 183 return -1; 184 } 185 186 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) 187 { 188 errno = ENOSYS; 189 return -1; 190 } 191 192 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) 193 { 194 errno = ENOSYS; 195 return -1; 196 } 197 198 static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) 199 { 200 errno = ENOSYS; 201 return (SMB_OFF_T)-1; 202 } 203 204 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) 205 { 206 errno = ENOSYS; 207 return -1; 208 } 209 210 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) 218 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, 219 void *data, size_t n) 220 { 221 errno = ENOSYS; 222 return -1; 223 } 224 225 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, 226 void *data, size_t n, off_t offset) 227 { 228 errno = ENOSYS; 229 return -1; 230 } 231 232 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle, 233 TALLOC_CTX *mem_ctx, 234 struct tevent_context *ev, 235 struct files_struct *fsp, 236 void *data, size_t n, off_t offset) 237 { 238 return NULL; 239 } 240 241 static ssize_t skel_pread_recv(struct tevent_req *req, int *err) 242 { 243 *err = ENOSYS; 244 return -1; 245 } 246 247 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, 248 const void *data, size_t n) 249 { 250 errno = ENOSYS; 251 return -1; 252 } 253 254 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, 255 const void *data, size_t n, off_t offset) 256 { 257 errno = ENOSYS; 258 return -1; 259 } 260 261 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle, 262 TALLOC_CTX *mem_ctx, 263 struct tevent_context *ev, 264 struct files_struct *fsp, 265 const void *data, 266 size_t n, off_t offset) 267 { 268 return NULL; 269 } 270 271 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err) 272 { 273 *err = ENOSYS; 274 return -1; 275 } 276 277 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp, 278 off_t offset, int whence) 279 { 280 errno = ENOSYS; 281 return (off_t) - 1; 282 } 283 284 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, 285 files_struct *fromfsp, const DATA_BLOB *hdr, 286 off_t offset, size_t n) 287 { 288 errno = ENOSYS; 289 return -1; 290 } 291 292 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, 293 files_struct *tofsp, off_t offset, size_t n) 211 294 { 212 295 errno = ENOSYS; … … 228 311 } 229 312 313 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle, 314 TALLOC_CTX *mem_ctx, 315 struct tevent_context *ev, 316 struct files_struct *fsp) 317 { 318 return NULL; 319 } 320 321 static int skel_fsync_recv(struct tevent_req *req, int *err) 322 { 323 *err = ENOSYS; 324 return -1; 325 } 326 230 327 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname) 231 328 { … … 234 331 } 235 332 236 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) 237 { 238 errno = ENOSYS; 239 return -1; 240 } 241 242 static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname) 243 { 244 errno = ENOSYS; 245 return -1; 246 } 247 248 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf) 333 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, 334 SMB_STRUCT_STAT *sbuf) 335 { 336 errno = ENOSYS; 337 return -1; 338 } 339 340 static int skel_lstat(vfs_handle_struct *handle, 341 struct smb_filename *smb_fname) 342 { 343 errno = ENOSYS; 344 return -1; 345 } 346 347 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, 348 struct files_struct *fsp, 349 const SMB_STRUCT_STAT *sbuf) 249 350 { 250 351 errno = ENOSYS; … … 259 360 } 260 361 261 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) 262 { 263 errno = ENOSYS; 264 return -1; 265 } 266 267 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) 268 { 269 errno = ENOSYS; 270 return -1; 271 } 272 273 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) 274 { 275 errno = ENOSYS; 276 return -1; 277 } 278 279 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) 280 { 281 errno = ENOSYS; 282 return -1; 283 } 284 285 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) 286 { 287 errno = ENOSYS; 288 return -1; 289 } 290 291 static int skel_chdir(vfs_handle_struct *handle, const char *path) 292 { 293 errno = ENOSYS; 294 return -1; 295 } 296 297 static char *skel_getwd(vfs_handle_struct *handle, char *buf) 362 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) 363 { 364 errno = ENOSYS; 365 return -1; 366 } 367 368 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, 369 mode_t mode) 370 { 371 errno = ENOSYS; 372 return -1; 373 } 374 375 static int skel_chown(vfs_handle_struct *handle, const char *path, 376 uid_t uid, gid_t gid) 377 { 378 errno = ENOSYS; 379 return -1; 380 } 381 382 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, 383 uid_t uid, gid_t gid) 384 { 385 errno = ENOSYS; 386 return -1; 387 } 388 389 static int skel_lchown(vfs_handle_struct *handle, const char *path, 390 uid_t uid, gid_t gid) 391 { 392 errno = ENOSYS; 393 return -1; 394 } 395 396 static int skel_chdir(vfs_handle_struct *handle, const char *path) 397 { 398 errno = ENOSYS; 399 return -1; 400 } 401 402 static char *skel_getwd(vfs_handle_struct *handle) 298 403 { 299 404 errno = ENOSYS; … … 309 414 } 310 415 311 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset) 416 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, 417 off_t offset) 312 418 { 313 419 errno = ENOSYS; … … 316 422 317 423 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp, 318 enum vfs_fallocate_mode mode,319 SMB_OFF_T offset, SMB_OFF_T len) 320 { 321 errno = ENOSYS;322 return -1; 323 } 324 325 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_Tcount, int type)424 uint32_t mode, off_t offset, off_t len) 425 { 426 errno = ENOSYS; 427 return -1; 428 } 429 430 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, 431 off_t offset, off_t count, int type) 326 432 { 327 433 errno = ENOSYS; … … 329 435 } 330 436 331 static int skel_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32 access_mask) 332 { 333 errno = ENOSYS; 334 return -1; 335 } 336 337 static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype) 338 { 339 errno = ENOSYS; 340 return -1; 341 } 342 343 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) 437 static int skel_kernel_flock(struct vfs_handle_struct *handle, 438 struct files_struct *fsp, 439 uint32_t share_mode, uint32_t access_mask) 440 { 441 errno = ENOSYS; 442 return -1; 443 } 444 445 static int skel_linux_setlease(struct vfs_handle_struct *handle, 446 struct files_struct *fsp, int leasetype) 447 { 448 errno = ENOSYS; 449 return -1; 450 } 451 452 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, 453 off_t *poffset, off_t *pcount, int *ptype, 454 pid_t *ppid) 344 455 { 345 456 errno = ENOSYS; … … 347 458 } 348 459 349 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) 350 { 351 errno = ENOSYS; 352 return -1; 353 } 354 355 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) 356 { 357 errno = ENOSYS; 358 return -1; 359 } 360 361 static int skel_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath) 362 { 363 errno = ENOSYS; 364 return -1; 365 } 366 367 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev) 368 { 369 errno = ENOSYS; 370 return -1; 371 } 372 373 static char *skel_realpath(vfs_handle_struct *handle, const char *path) 460 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, 461 const char *newpath) 462 { 463 errno = ENOSYS; 464 return -1; 465 } 466 467 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, 468 char *buf, size_t bufsiz) 469 { 470 errno = ENOSYS; 471 return -1; 472 } 473 474 static int skel_link(vfs_handle_struct *handle, const char *oldpath, 475 const char *newpath) 476 { 477 errno = ENOSYS; 478 return -1; 479 } 480 481 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, 482 SMB_DEV_T dev) 483 { 484 errno = ENOSYS; 485 return -1; 486 } 487 488 static char *skel_realpath(vfs_handle_struct *handle, const char *path) 374 489 { 375 490 errno = ENOSYS; … … 377 492 } 378 493 379 static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle, 380 struct sys_notify_context *ctx, struct notify_entry *e, 381 void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev), 382 void *private_data, void *handle_p) 383 { 384 return NT_STATUS_NOT_IMPLEMENTED; 385 } 386 387 static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags) 494 static int skel_chflags(vfs_handle_struct *handle, const char *path, 495 uint flags) 388 496 { 389 497 errno = ENOSYS; … … 398 506 errno = ENOSYS; 399 507 return id; 508 } 509 510 struct skel_cc_state { 511 uint64_t unused; 512 }; 513 static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle, 514 TALLOC_CTX *mem_ctx, 515 struct tevent_context *ev, 516 struct files_struct *src_fsp, 517 off_t src_off, 518 struct files_struct *dest_fsp, 519 off_t dest_off, 520 off_t num) 521 { 522 struct tevent_req *req; 523 struct skel_cc_state *cc_state; 524 525 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state); 526 if (req == NULL) { 527 return NULL; 528 } 529 530 tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED); 531 return tevent_req_post(req, ev); 532 } 533 534 static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle, 535 struct tevent_req *req, 536 off_t *copied) 537 { 538 NTSTATUS status; 539 540 if (tevent_req_is_nterror(req, &status)) { 541 tevent_req_received(req); 542 return status; 543 } 544 tevent_req_received(req); 545 546 return NT_STATUS_OK; 547 } 548 549 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle, 550 TALLOC_CTX *mem_ctx, 551 struct files_struct *fsp, 552 struct smb_filename *smb_fname, 553 uint16_t *_compression_fmt) 554 { 555 return NT_STATUS_INVALID_DEVICE_REQUEST; 556 } 557 558 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle, 559 TALLOC_CTX *mem_ctx, 560 struct files_struct *fsp, 561 uint16_t compression_fmt) 562 { 563 return NT_STATUS_INVALID_DEVICE_REQUEST; 400 564 } 401 565 … … 411 575 412 576 static int skel_get_real_filename(struct vfs_handle_struct *handle, 413 const char *path, 414 const char *name, 577 const char *path, 578 const char *name, 579 TALLOC_CTX *mem_ctx, char **found_name) 580 { 581 errno = ENOSYS; 582 return -1; 583 } 584 585 static const char *skel_connectpath(struct vfs_handle_struct *handle, 586 const char *filename) 587 { 588 errno = ENOSYS; 589 return NULL; 590 } 591 592 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle, 593 struct byte_range_lock *br_lck, 594 struct lock_struct *plock, 595 bool blocking_lock) 596 { 597 return NT_STATUS_NOT_IMPLEMENTED; 598 } 599 600 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle, 601 struct messaging_context *msg_ctx, 602 struct byte_range_lock *br_lck, 603 const struct lock_struct *plock) 604 { 605 errno = ENOSYS; 606 return false; 607 } 608 609 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle, 610 struct byte_range_lock *br_lck, 611 struct lock_struct *plock) 612 { 613 errno = ENOSYS; 614 return false; 615 } 616 617 static bool skel_strict_lock(struct vfs_handle_struct *handle, 618 struct files_struct *fsp, 619 struct lock_struct *plock) 620 { 621 errno = ENOSYS; 622 return false; 623 } 624 625 static void skel_strict_unlock(struct vfs_handle_struct *handle, 626 struct files_struct *fsp, 627 struct lock_struct *plock) 628 { 629 ; 630 } 631 632 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle, 633 const char *mapped_name, 634 enum vfs_translate_direction direction, 635 TALLOC_CTX *mem_ctx, char **pmapped_name) 636 { 637 return NT_STATUS_NOT_IMPLEMENTED; 638 } 639 640 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle, 641 struct files_struct *fsp, 642 TALLOC_CTX *ctx, 643 uint32_t function, 644 uint16_t req_flags, /* Needed for UNICODE ... */ 645 const uint8_t *_in_data, 646 uint32_t in_len, 647 uint8_t **_out_data, 648 uint32_t max_out_len, uint32_t *out_len) 649 { 650 return NT_STATUS_NOT_IMPLEMENTED; 651 } 652 653 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle, 654 const struct smb_filename *fname, 655 TALLOC_CTX *mem_ctx, 656 struct readdir_attr_data **pattr_data) 657 { 658 return NT_STATUS_NOT_IMPLEMENTED; 659 } 660 661 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 662 uint32_t security_info, 663 TALLOC_CTX *mem_ctx, 664 struct security_descriptor **ppdesc) 665 { 666 return NT_STATUS_NOT_IMPLEMENTED; 667 } 668 669 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle, 670 const char *name, uint32_t security_info, 415 671 TALLOC_CTX *mem_ctx, 416 char **found_name) 417 { 418 errno = ENOSYS; 419 return -1; 420 } 421 422 static const char *skel_connectpath(struct vfs_handle_struct *handle, 423 const char *filename) 424 { 425 errno = ENOSYS; 426 return NULL; 427 } 428 429 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle, 430 struct byte_range_lock *br_lck, 431 struct lock_struct *plock, 432 bool blocking_lock, 433 struct blocking_lock_record *blr) 672 struct security_descriptor **ppdesc) 434 673 { 435 674 return NT_STATUS_NOT_IMPLEMENTED; 436 675 } 437 676 438 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle, 439 struct messaging_context *msg_ctx, 440 struct byte_range_lock *br_lck, 441 const struct lock_struct *plock) 677 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 678 uint32_t security_info_sent, 679 const struct security_descriptor *psd) 680 { 681 return NT_STATUS_NOT_IMPLEMENTED; 682 } 683 684 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, 685 mode_t mode) 686 { 687 errno = ENOSYS; 688 return -1; 689 } 690 691 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, 692 mode_t mode) 693 { 694 errno = ENOSYS; 695 return -1; 696 } 697 698 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, 699 const char *path_p, 700 SMB_ACL_TYPE_T type, 701 TALLOC_CTX *mem_ctx) 702 { 703 errno = ENOSYS; 704 return (SMB_ACL_T) NULL; 705 } 706 707 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, 708 files_struct *fsp, TALLOC_CTX *mem_ctx) 709 { 710 errno = ENOSYS; 711 return (SMB_ACL_T) NULL; 712 } 713 714 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle, 715 const char *path_p, TALLOC_CTX *mem_ctx, 716 char **blob_description, DATA_BLOB *blob) 717 { 718 errno = ENOSYS; 719 return -1; 720 } 721 722 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle, 723 files_struct *fsp, TALLOC_CTX *mem_ctx, 724 char **blob_description, DATA_BLOB *blob) 725 { 726 errno = ENOSYS; 727 return -1; 728 } 729 730 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, 731 SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) 732 { 733 errno = ENOSYS; 734 return -1; 735 } 736 737 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, 738 SMB_ACL_T theacl) 739 { 740 errno = ENOSYS; 741 return -1; 742 } 743 744 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, 745 const char *path) 746 { 747 errno = ENOSYS; 748 return -1; 749 } 750 751 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, 752 const char *name, void *value, size_t size) 753 { 754 errno = ENOSYS; 755 return -1; 756 } 757 758 static ssize_t skel_fgetxattr(vfs_handle_struct *handle, 759 struct files_struct *fsp, const char *name, 760 void *value, size_t size) 761 { 762 errno = ENOSYS; 763 return -1; 764 } 765 766 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, 767 char *list, size_t size) 768 { 769 errno = ENOSYS; 770 return -1; 771 } 772 773 static ssize_t skel_flistxattr(vfs_handle_struct *handle, 774 struct files_struct *fsp, char *list, 775 size_t size) 776 { 777 errno = ENOSYS; 778 return -1; 779 } 780 781 static int skel_removexattr(vfs_handle_struct *handle, const char *path, 782 const char *name) 783 { 784 errno = ENOSYS; 785 return -1; 786 } 787 788 static int skel_fremovexattr(vfs_handle_struct *handle, 789 struct files_struct *fsp, const char *name) 790 { 791 errno = ENOSYS; 792 return -1; 793 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name); 794 } 795 796 static int skel_setxattr(vfs_handle_struct *handle, const char *path, 797 const char *name, const void *value, size_t size, 798 int flags) 799 { 800 errno = ENOSYS; 801 return -1; 802 } 803 804 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, 805 const char *name, const void *value, size_t size, 806 int flags) 807 { 808 errno = ENOSYS; 809 return -1; 810 } 811 812 static bool skel_aio_force(struct vfs_handle_struct *handle, 813 struct files_struct *fsp) 442 814 { 443 815 errno = ENOSYS; … … 445 817 } 446 818 447 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle, 448 struct byte_range_lock *br_lck, 449 struct lock_struct *plock, 450 struct blocking_lock_record *blr) 819 static bool skel_is_offline(struct vfs_handle_struct *handle, 820 const struct smb_filename *fname, 821 SMB_STRUCT_STAT *sbuf) 451 822 { 452 823 errno = ENOSYS; … … 454 825 } 455 826 456 static bool skel_strict_lock(struct vfs_handle_struct *handle, 457 struct files_struct *fsp, 458 struct lock_struct *plock) 459 { 460 errno = ENOSYS; 461 return false; 462 } 463 464 static void skel_strict_unlock(struct vfs_handle_struct *handle, 465 struct files_struct *fsp, 466 struct lock_struct *plock) 467 { 468 ; 469 } 470 471 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle, 472 const char *mapped_name, 473 enum vfs_translate_direction direction, 474 TALLOC_CTX *mem_ctx, 475 char **pmapped_name) 476 { 477 return NT_STATUS_NOT_IMPLEMENTED; 478 } 479 480 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 481 uint32 security_info, struct security_descriptor **ppdesc) 482 { 483 return NT_STATUS_NOT_IMPLEMENTED; 484 } 485 486 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle, 487 const char *name, uint32 security_info, struct security_descriptor **ppdesc) 488 { 489 return NT_STATUS_NOT_IMPLEMENTED; 490 } 491 492 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 493 uint32 security_info_sent, const struct security_descriptor *psd) 494 { 495 return NT_STATUS_NOT_IMPLEMENTED; 496 } 497 498 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) 499 { 500 errno = ENOSYS; 501 return -1; 502 } 503 504 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) 505 { 506 errno = ENOSYS; 507 return -1; 508 } 509 510 static int skel_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) 511 { 512 errno = ENOSYS; 513 return -1; 514 } 515 516 static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) 517 { 518 errno = ENOSYS; 519 return -1; 520 } 521 522 static int skel_sys_acl_get_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) 523 { 524 errno = ENOSYS; 525 return -1; 526 } 527 528 static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d) 529 { 530 errno = ENOSYS; 531 return NULL; 532 } 533 534 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type) 535 { 536 errno = ENOSYS; 537 return (SMB_ACL_T)NULL; 538 } 539 540 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) 541 { 542 errno = ENOSYS; 543 return (SMB_ACL_T)NULL; 544 } 545 546 static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset) 547 { 548 errno = ENOSYS; 549 return -1; 550 } 551 552 static int skel_sys_acl_add_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) 553 { 554 errno = ENOSYS; 555 return -1; 556 } 557 558 static char *skel_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen) 559 { 560 errno = ENOSYS; 561 return NULL; 562 } 563 564 static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, int count) 565 { 566 errno = ENOSYS; 567 return (SMB_ACL_T)NULL; 568 } 569 570 static int skel_sys_acl_create_entry(vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) 571 { 572 errno = ENOSYS; 573 return -1; 574 } 575 576 static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) 577 { 578 errno = ENOSYS; 579 return -1; 580 } 581 582 static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual) 583 { 584 errno = ENOSYS; 585 return -1; 586 } 587 588 static int skel_sys_acl_set_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) 589 { 590 errno = ENOSYS; 591 return -1; 592 } 593 594 static int skel_sys_acl_valid(vfs_handle_struct *handle, SMB_ACL_T theacl ) 595 { 596 errno = ENOSYS; 597 return -1; 598 } 599 600 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) 601 { 602 errno = ENOSYS; 603 return -1; 604 } 605 606 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) 607 { 608 errno = ENOSYS; 609 return -1; 610 } 611 612 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) 613 { 614 errno = ENOSYS; 615 return -1; 616 } 617 618 static int skel_sys_acl_get_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) 619 { 620 errno = ENOSYS; 621 return -1; 622 } 623 624 static int skel_sys_acl_free_text(vfs_handle_struct *handle, char *text) 625 { 626 errno = ENOSYS; 627 return -1; 628 } 629 630 static int skel_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl) 631 { 632 errno = ENOSYS; 633 return -1; 634 } 635 636 static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype) 637 { 638 errno = ENOSYS; 639 return -1; 640 } 641 642 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) 643 { 644 errno = ENOSYS; 645 return -1; 646 } 647 648 static ssize_t skel_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t 649 size) 650 { 651 errno = ENOSYS; 652 return -1; 653 } 654 655 static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) 656 { 657 errno = ENOSYS; 658 return -1; 659 } 660 661 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) 662 { 663 errno = ENOSYS; 664 return -1; 665 } 666 667 static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) 668 { 669 errno = ENOSYS; 670 return -1; 671 } 672 673 static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) 674 { 675 errno = ENOSYS; 676 return -1; 677 } 678 679 static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name) 680 { 681 errno = ENOSYS; 682 return -1; 683 } 684 685 static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name) 686 { 687 errno = ENOSYS; 688 return -1; 689 } 690 691 static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name) 692 { 693 errno = ENOSYS; 694 return -1; 695 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name); 696 } 697 698 static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) 699 { 700 errno = ENOSYS; 701 return -1; 702 } 703 704 static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) 705 { 706 errno = ENOSYS; 707 return -1; 708 } 709 710 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) 711 { 712 errno = ENOSYS; 713 return -1; 714 } 715 716 static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 717 { 718 errno = ENOSYS; 719 return -1; 720 } 721 722 static int skel_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 723 { 724 errno = ENOSYS; 725 return -1; 726 } 727 728 static ssize_t skel_aio_return_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 729 { 730 errno = ENOSYS; 731 return -1; 732 } 733 734 static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 735 { 736 errno = ENOSYS; 737 return -1; 738 } 739 740 static int skel_aio_error_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 741 { 742 errno = ENOSYS; 743 return -1; 744 } 745 746 static int skel_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb) 747 { 748 errno = ENOSYS; 749 return -1; 750 } 751 752 static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts) 753 { 754 errno = ENOSYS; 755 return -1; 756 } 757 758 static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) 759 { 760 errno = ENOSYS; 761 return false; 762 } 763 764 static bool skel_is_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname, SMB_STRUCT_STAT *sbuf) 765 { 766 errno = ENOSYS; 767 return false; 768 } 769 770 static int skel_set_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname) 827 static int skel_set_offline(struct vfs_handle_struct *handle, 828 const struct smb_filename *fname) 771 829 { 772 830 errno = ENOSYS; … … 776 834 /* VFS operations structure */ 777 835 778 struct vfs_fn_pointers skel_ transparent_fns = {836 struct vfs_fn_pointers skel_opaque_fns = { 779 837 /* Disk operations */ 780 838 781 839 .connect_fn = skel_connect, 782 .disconnect = skel_disconnect, 783 .disk_free = skel_disk_free, 784 .get_quota = skel_get_quota, 785 .set_quota = skel_set_quota, 786 .get_shadow_copy_data = skel_get_shadow_copy_data, 787 .statvfs = skel_statvfs, 788 .fs_capabilities = skel_fs_capabilities, 840 .disconnect_fn = skel_disconnect, 841 .disk_free_fn = skel_disk_free, 842 .get_quota_fn = skel_get_quota, 843 .set_quota_fn = skel_set_quota, 844 .get_shadow_copy_data_fn = skel_get_shadow_copy_data, 845 .statvfs_fn = skel_statvfs, 846 .fs_capabilities_fn = skel_fs_capabilities, 847 .get_dfs_referrals_fn = skel_get_dfs_referrals, 848 .snap_check_path_fn = skel_snap_check_path, 849 .snap_create_fn = skel_snap_create, 850 .snap_delete_fn = skel_snap_delete, 789 851 790 852 /* Directory operations */ 791 853 792 .opendir = skel_opendir,793 .fdopendir = skel_fdopendir,794 .readdir = skel_readdir,795 .seekdir = skel_seekdir,796 .telldir = skel_telldir,797 .rewind_dir = skel_rewind_dir,798 .mkdir = skel_mkdir,799 .rmdir = skel_rmdir,800 .closedir = skel_closedir,801 .init_search_op = skel_init_search_op,854 .opendir_fn = skel_opendir, 855 .fdopendir_fn = skel_fdopendir, 856 .readdir_fn = skel_readdir, 857 .seekdir_fn = skel_seekdir, 858 .telldir_fn = skel_telldir, 859 .rewind_dir_fn = skel_rewind_dir, 860 .mkdir_fn = skel_mkdir, 861 .rmdir_fn = skel_rmdir, 862 .closedir_fn = skel_closedir, 863 .init_search_op_fn = skel_init_search_op, 802 864 803 865 /* File operations */ 804 866 805 867 .open_fn = skel_open, 806 .create_file = skel_create_file,868 .create_file_fn = skel_create_file, 807 869 .close_fn = skel_close_fn, 808 .vfs_read = skel_vfs_read, 809 .pread = skel_pread, 810 .write = skel_write, 811 .pwrite = skel_pwrite, 812 .lseek = skel_lseek, 813 .sendfile = skel_sendfile, 814 .recvfile = skel_recvfile, 815 .rename = skel_rename, 816 .fsync = skel_fsync, 817 .stat = skel_stat, 818 .fstat = skel_fstat, 819 .lstat = skel_lstat, 820 .get_alloc_size = skel_get_alloc_size, 821 .unlink = skel_unlink, 822 .chmod = skel_chmod, 823 .fchmod = skel_fchmod, 824 .chown = skel_chown, 825 .fchown = skel_fchown, 826 .lchown = skel_lchown, 827 .chdir = skel_chdir, 828 .getwd = skel_getwd, 829 .ntimes = skel_ntimes, 830 .ftruncate = skel_ftruncate, 831 .fallocate = skel_fallocate, 832 .lock = skel_lock, 833 .kernel_flock = skel_kernel_flock, 834 .linux_setlease = skel_linux_setlease, 835 .getlock = skel_getlock, 836 .symlink = skel_symlink, 837 .vfs_readlink = skel_vfs_readlink, 838 .link = skel_link, 839 .mknod = skel_mknod, 840 .realpath = skel_realpath, 841 .notify_watch = skel_notify_watch, 842 .chflags = skel_chflags, 843 .file_id_create = skel_file_id_create, 844 845 .streaminfo = skel_streaminfo, 846 .get_real_filename = skel_get_real_filename, 847 .connectpath = skel_connectpath, 848 .brl_lock_windows = skel_brl_lock_windows, 849 .brl_unlock_windows = skel_brl_unlock_windows, 850 .brl_cancel_windows = skel_brl_cancel_windows, 851 .strict_lock = skel_strict_lock, 852 .strict_unlock = skel_strict_unlock, 853 .translate_name = skel_translate_name, 870 .read_fn = skel_vfs_read, 871 .pread_fn = skel_pread, 872 .pread_send_fn = skel_pread_send, 873 .pread_recv_fn = skel_pread_recv, 874 .write_fn = skel_write, 875 .pwrite_fn = skel_pwrite, 876 .pwrite_send_fn = skel_pwrite_send, 877 .pwrite_recv_fn = skel_pwrite_recv, 878 .lseek_fn = skel_lseek, 879 .sendfile_fn = skel_sendfile, 880 .recvfile_fn = skel_recvfile, 881 .rename_fn = skel_rename, 882 .fsync_fn = skel_fsync, 883 .fsync_send_fn = skel_fsync_send, 884 .fsync_recv_fn = skel_fsync_recv, 885 .stat_fn = skel_stat, 886 .fstat_fn = skel_fstat, 887 .lstat_fn = skel_lstat, 888 .get_alloc_size_fn = skel_get_alloc_size, 889 .unlink_fn = skel_unlink, 890 .chmod_fn = skel_chmod, 891 .fchmod_fn = skel_fchmod, 892 .chown_fn = skel_chown, 893 .fchown_fn = skel_fchown, 894 .lchown_fn = skel_lchown, 895 .chdir_fn = skel_chdir, 896 .getwd_fn = skel_getwd, 897 .ntimes_fn = skel_ntimes, 898 .ftruncate_fn = skel_ftruncate, 899 .fallocate_fn = skel_fallocate, 900 .lock_fn = skel_lock, 901 .kernel_flock_fn = skel_kernel_flock, 902 .linux_setlease_fn = skel_linux_setlease, 903 .getlock_fn = skel_getlock, 904 .symlink_fn = skel_symlink, 905 .readlink_fn = skel_vfs_readlink, 906 .link_fn = skel_link, 907 .mknod_fn = skel_mknod, 908 .realpath_fn = skel_realpath, 909 .chflags_fn = skel_chflags, 910 .file_id_create_fn = skel_file_id_create, 911 .copy_chunk_send_fn = skel_copy_chunk_send, 912 .copy_chunk_recv_fn = skel_copy_chunk_recv, 913 .get_compression_fn = skel_get_compression, 914 .set_compression_fn = skel_set_compression, 915 916 .streaminfo_fn = skel_streaminfo, 917 .get_real_filename_fn = skel_get_real_filename, 918 .connectpath_fn = skel_connectpath, 919 .brl_lock_windows_fn = skel_brl_lock_windows, 920 .brl_unlock_windows_fn = skel_brl_unlock_windows, 921 .brl_cancel_windows_fn = skel_brl_cancel_windows, 922 .strict_lock_fn = skel_strict_lock, 923 .strict_unlock_fn = skel_strict_unlock, 924 .translate_name_fn = skel_translate_name, 925 .fsctl_fn = skel_fsctl, 926 .readdir_attr_fn = skel_readdir_attr, 854 927 855 928 /* NT ACL operations. */ 856 929 857 .fget_nt_acl = skel_fget_nt_acl,858 .get_nt_acl = skel_get_nt_acl,859 .fset_nt_acl = skel_fset_nt_acl,930 .fget_nt_acl_fn = skel_fget_nt_acl, 931 .get_nt_acl_fn = skel_get_nt_acl, 932 .fset_nt_acl_fn = skel_fset_nt_acl, 860 933 861 934 /* POSIX ACL operations. */ 862 935 863 .chmod_acl = skel_chmod_acl, 864 .fchmod_acl = skel_fchmod_acl, 865 866 .sys_acl_get_entry = skel_sys_acl_get_entry, 867 .sys_acl_get_tag_type = skel_sys_acl_get_tag_type, 868 .sys_acl_get_permset = skel_sys_acl_get_permset, 869 .sys_acl_get_qualifier = skel_sys_acl_get_qualifier, 870 .sys_acl_get_file = skel_sys_acl_get_file, 871 .sys_acl_get_fd = skel_sys_acl_get_fd, 872 .sys_acl_clear_perms = skel_sys_acl_clear_perms, 873 .sys_acl_add_perm = skel_sys_acl_add_perm, 874 .sys_acl_to_text = skel_sys_acl_to_text, 875 .sys_acl_init = skel_sys_acl_init, 876 .sys_acl_create_entry = skel_sys_acl_create_entry, 877 .sys_acl_set_tag_type = skel_sys_acl_set_tag_type, 878 .sys_acl_set_qualifier = skel_sys_acl_set_qualifier, 879 .sys_acl_set_permset = skel_sys_acl_set_permset, 880 .sys_acl_valid = skel_sys_acl_valid, 881 .sys_acl_set_file = skel_sys_acl_set_file, 882 .sys_acl_set_fd = skel_sys_acl_set_fd, 883 .sys_acl_delete_def_file = skel_sys_acl_delete_def_file, 884 .sys_acl_get_perm = skel_sys_acl_get_perm, 885 .sys_acl_free_text = skel_sys_acl_free_text, 886 .sys_acl_free_acl = skel_sys_acl_free_acl, 887 .sys_acl_free_qualifier = skel_sys_acl_free_qualifier, 936 .chmod_acl_fn = skel_chmod_acl, 937 .fchmod_acl_fn = skel_fchmod_acl, 938 939 .sys_acl_get_file_fn = skel_sys_acl_get_file, 940 .sys_acl_get_fd_fn = skel_sys_acl_get_fd, 941 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file, 942 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd, 943 .sys_acl_set_file_fn = skel_sys_acl_set_file, 944 .sys_acl_set_fd_fn = skel_sys_acl_set_fd, 945 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file, 888 946 889 947 /* EA operations. */ 890 .getxattr = skel_getxattr, 891 .lgetxattr = skel_lgetxattr, 892 .fgetxattr = skel_fgetxattr, 893 .listxattr = skel_listxattr, 894 .llistxattr = skel_llistxattr, 895 .flistxattr = skel_flistxattr, 896 .removexattr = skel_removexattr, 897 .lremovexattr = skel_lremovexattr, 898 .fremovexattr = skel_fremovexattr, 899 .setxattr = skel_setxattr, 900 .lsetxattr = skel_lsetxattr, 901 .fsetxattr = skel_fsetxattr, 948 .getxattr_fn = skel_getxattr, 949 .fgetxattr_fn = skel_fgetxattr, 950 .listxattr_fn = skel_listxattr, 951 .flistxattr_fn = skel_flistxattr, 952 .removexattr_fn = skel_removexattr, 953 .fremovexattr_fn = skel_fremovexattr, 954 .setxattr_fn = skel_setxattr, 955 .fsetxattr_fn = skel_fsetxattr, 902 956 903 957 /* aio operations */ 904 .aio_read = skel_aio_read, 905 .aio_write = skel_aio_write, 906 .aio_return_fn = skel_aio_return_fn, 907 .aio_cancel = skel_aio_cancel, 908 .aio_error_fn = skel_aio_error_fn, 909 .aio_fsync = skel_aio_fsync, 910 .aio_suspend = skel_aio_suspend, 911 .aio_force = skel_aio_force, 958 .aio_force_fn = skel_aio_force, 912 959 913 960 /* offline operations */ 914 .is_offline = skel_is_offline,915 .set_offline = skel_set_offline961 .is_offline_fn = skel_is_offline, 962 .set_offline_fn = skel_set_offline 916 963 }; 917 964 918 NTSTATUS vfs_skel_transparent_init(void) 919 { 920 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", &skel_transparent_fns); 921 } 965 static_decl_vfs; 966 NTSTATUS vfs_skel_opaque_init(void) 967 { 968 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque", 969 &skel_opaque_fns); 970 } -
vendor/current/examples/VFS/skel_transparent.c
r860 r988 22 22 */ 23 23 24 25 #include " includes.h"26 #include " smbd/proto.h"24 #include "../source3/include/includes.h" 25 #include "lib/util/tevent_unix.h" 26 #include "lib/util/tevent_ntstatus.h" 27 27 28 28 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE … … 38 38 */ 39 39 40 static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user) 40 static int skel_connect(vfs_handle_struct *handle, const char *service, 41 const char *user) 41 42 { 42 43 return SMB_VFS_NEXT_CONNECT(handle, service, user); … … 48 49 } 49 50 50 static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path, 51 bool small_query, uint64_t *bsize, 52 uint64_t *dfree, uint64_t *dsize) 53 { 54 return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, 55 dfree, dsize); 56 } 57 58 static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) 59 { 60 return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq); 61 } 62 63 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq) 51 static uint64_t skel_disk_free(vfs_handle_struct *handle, const char *path, 52 uint64_t *bsize, 53 uint64_t *dfree, uint64_t *dsize) 54 { 55 return SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize); 56 } 57 58 static int skel_get_quota(vfs_handle_struct *handle, const char *path, 59 enum SMB_QUOTA_TYPE qtype, unid_t id, 60 SMB_DISK_QUOTA *dq) 61 { 62 return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq); 63 } 64 65 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, 66 unid_t id, SMB_DISK_QUOTA *dq) 64 67 { 65 68 return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq); 66 69 } 67 70 68 static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels) 69 { 70 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); 71 } 72 73 static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf) 71 static int skel_get_shadow_copy_data(vfs_handle_struct *handle, 72 files_struct *fsp, 73 struct shadow_copy_data *shadow_copy_data, 74 bool labels) 75 { 76 return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, 77 labels); 78 } 79 80 static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, 81 struct vfs_statvfs_struct *statbuf) 74 82 { 75 83 return SMB_VFS_NEXT_STATVFS(handle, path, statbuf); 76 84 } 77 85 78 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res) 86 static uint32_t skel_fs_capabilities(struct vfs_handle_struct *handle, 87 enum timestamp_set_resolution *p_ts_res) 79 88 { 80 89 return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res); 81 90 } 82 91 83 static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) 92 static NTSTATUS skel_get_dfs_referrals(struct vfs_handle_struct *handle, 93 struct dfs_GetDFSReferral *r) 94 { 95 return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r); 96 } 97 98 static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, 99 const char *mask, uint32_t attr) 84 100 { 85 101 return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr); 86 102 } 87 103 88 static SMB_STRUCT_DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr) 104 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle, 105 TALLOC_CTX *mem_ctx, 106 const char *service_path, 107 char **base_volume) 108 { 109 return SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path, 110 base_volume); 111 } 112 113 static NTSTATUS skel_snap_create(struct vfs_handle_struct *handle, 114 TALLOC_CTX *mem_ctx, 115 const char *base_volume, 116 time_t *tstamp, 117 bool rw, 118 char **base_path, 119 char **snap_path) 120 { 121 return SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp, 122 rw, base_path, snap_path); 123 } 124 125 static NTSTATUS skel_snap_delete(struct vfs_handle_struct *handle, 126 TALLOC_CTX *mem_ctx, 127 char *base_path, 128 char *snap_path) 129 { 130 return SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path); 131 } 132 133 static DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, 134 const char *mask, uint32_t attr) 89 135 { 90 136 return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); 91 137 } 92 138 93 static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, 94 SMB_STRUCT_DIR *dirp, 95 SMB_STRUCT_STAT *sbuf) 139 static struct dirent *skel_readdir(vfs_handle_struct *handle, 140 DIR *dirp, SMB_STRUCT_STAT *sbuf) 96 141 { 97 142 return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf); 98 143 } 99 144 100 static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset)145 static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset) 101 146 { 102 147 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset); 103 148 } 104 149 105 static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)150 static long skel_telldir(vfs_handle_struct *handle, DIR *dirp) 106 151 { 107 152 return SMB_VFS_NEXT_TELLDIR(handle, dirp); 108 153 } 109 154 110 static void skel_rewind_dir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)155 static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp) 111 156 { 112 157 SMB_VFS_NEXT_REWINDDIR(handle, dirp); 113 158 } 114 159 115 static int skel_mkdir(vfs_handle_struct *handle, 160 static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) 116 161 { 117 162 return SMB_VFS_NEXT_MKDIR(handle, path, mode); 118 163 } 119 164 120 static int skel_rmdir(vfs_handle_struct *handle, 165 static int skel_rmdir(vfs_handle_struct *handle, const char *path) 121 166 { 122 167 return SMB_VFS_NEXT_RMDIR(handle, path); 123 168 } 124 169 125 static int skel_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dir)170 static int skel_closedir(vfs_handle_struct *handle, DIR *dir) 126 171 { 127 172 return SMB_VFS_NEXT_CLOSEDIR(handle, dir); 128 173 } 129 174 130 static void skel_init_search_op(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)175 static void skel_init_search_op(struct vfs_handle_struct *handle, DIR *dirp) 131 176 { 132 177 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp); … … 140 185 141 186 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, 142 struct smb_request *req, 143 uint16_t root_dir_fid, 144 struct smb_filename *smb_fname, 145 uint32_t access_mask, 146 uint32_t share_access, 147 uint32_t create_disposition, 148 uint32_t create_options, 149 uint32_t file_attributes, 150 uint32_t oplock_request, 151 uint64_t allocation_size, 152 uint32_t private_flags, 153 struct security_descriptor *sd, 154 struct ea_list *ea_list, 155 files_struct **result, 156 int *pinfo) 187 struct smb_request *req, 188 uint16_t root_dir_fid, 189 struct smb_filename *smb_fname, 190 uint32_t access_mask, 191 uint32_t share_access, 192 uint32_t create_disposition, 193 uint32_t create_options, 194 uint32_t file_attributes, 195 uint32_t oplock_request, 196 struct smb2_lease *lease, 197 uint64_t allocation_size, 198 uint32_t private_flags, 199 struct security_descriptor *sd, 200 struct ea_list *ea_list, 201 files_struct ** result, int *pinfo, 202 const struct smb2_create_blobs *in_context_blobs, 203 struct smb2_create_blobs *out_context_blobs) 157 204 { 158 205 return SMB_VFS_NEXT_CREATE_FILE(handle, 159 req, 160 root_dir_fid, 161 smb_fname, 162 access_mask, 163 share_access, 164 create_disposition, 165 create_options, 166 file_attributes, 167 oplock_request, 168 allocation_size, 169 private_flags, 170 sd, 171 ea_list, 172 result, 173 pinfo); 206 req, 207 root_dir_fid, 208 smb_fname, 209 access_mask, 210 share_access, 211 create_disposition, 212 create_options, 213 file_attributes, 214 oplock_request, 215 lease, 216 allocation_size, 217 private_flags, 218 sd, ea_list, result, pinfo, 219 in_context_blobs, out_context_blobs); 174 220 } 175 221 … … 179 225 } 180 226 181 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) 227 static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, 228 void *data, size_t n) 182 229 { 183 230 return SMB_VFS_NEXT_READ(handle, fsp, data, n); 184 231 } 185 232 186 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) 233 static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, 234 void *data, size_t n, off_t offset) 187 235 { 188 236 return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); 189 237 } 190 238 191 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) 239 struct skel_pread_state { 240 ssize_t ret; 241 int err; 242 }; 243 244 static void skel_pread_done(struct tevent_req *subreq); 245 246 static struct tevent_req *skel_pread_send(struct vfs_handle_struct *handle, 247 TALLOC_CTX *mem_ctx, 248 struct tevent_context *ev, 249 struct files_struct *fsp, 250 void *data, size_t n, off_t offset) 251 { 252 struct tevent_req *req, *subreq; 253 struct skel_pread_state *state; 254 255 req = tevent_req_create(mem_ctx, &state, struct skel_pread_state); 256 if (req == NULL) { 257 return NULL; 258 } 259 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data, 260 n, offset); 261 if (tevent_req_nomem(subreq, req)) { 262 return tevent_req_post(req, ev); 263 } 264 tevent_req_set_callback(subreq, skel_pread_done, req); 265 return req; 266 } 267 268 static void skel_pread_done(struct tevent_req *subreq) 269 { 270 struct tevent_req *req = 271 tevent_req_callback_data(subreq, struct tevent_req); 272 struct skel_pread_state *state = 273 tevent_req_data(req, struct skel_pread_state); 274 275 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err); 276 TALLOC_FREE(subreq); 277 tevent_req_done(req); 278 } 279 280 static ssize_t skel_pread_recv(struct tevent_req *req, int *err) 281 { 282 struct skel_pread_state *state = 283 tevent_req_data(req, struct skel_pread_state); 284 285 if (tevent_req_is_unix_error(req, err)) { 286 return -1; 287 } 288 *err = state->err; 289 return state->ret; 290 } 291 292 static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, 293 const void *data, size_t n) 192 294 { 193 295 return SMB_VFS_NEXT_WRITE(handle, fsp, data, n); 194 296 } 195 297 196 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) 298 static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, 299 const void *data, size_t n, off_t offset) 197 300 { 198 301 return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); 199 302 } 200 303 201 static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) 304 struct skel_pwrite_state { 305 ssize_t ret; 306 int err; 307 }; 308 309 static void skel_pwrite_done(struct tevent_req *subreq); 310 311 static struct tevent_req *skel_pwrite_send(struct vfs_handle_struct *handle, 312 TALLOC_CTX *mem_ctx, 313 struct tevent_context *ev, 314 struct files_struct *fsp, 315 const void *data, 316 size_t n, off_t offset) 317 { 318 struct tevent_req *req, *subreq; 319 struct skel_pwrite_state *state; 320 321 req = tevent_req_create(mem_ctx, &state, struct skel_pwrite_state); 322 if (req == NULL) { 323 return NULL; 324 } 325 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data, 326 n, offset); 327 if (tevent_req_nomem(subreq, req)) { 328 return tevent_req_post(req, ev); 329 } 330 tevent_req_set_callback(subreq, skel_pwrite_done, req); 331 return req; 332 } 333 334 static void skel_pwrite_done(struct tevent_req *subreq) 335 { 336 struct tevent_req *req = 337 tevent_req_callback_data(subreq, struct tevent_req); 338 struct skel_pwrite_state *state = 339 tevent_req_data(req, struct skel_pwrite_state); 340 341 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err); 342 TALLOC_FREE(subreq); 343 tevent_req_done(req); 344 } 345 346 static ssize_t skel_pwrite_recv(struct tevent_req *req, int *err) 347 { 348 struct skel_pwrite_state *state = 349 tevent_req_data(req, struct skel_pwrite_state); 350 351 if (tevent_req_is_unix_error(req, err)) { 352 return -1; 353 } 354 *err = state->err; 355 return state->ret; 356 } 357 358 static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp, 359 off_t offset, int whence) 202 360 { 203 361 return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence); 204 362 } 205 363 206 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) 364 static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, 365 files_struct *fromfsp, const DATA_BLOB *hdr, 366 off_t offset, size_t n) 207 367 { 208 368 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); 209 369 } 210 370 211 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) 371 static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, 372 files_struct *tofsp, off_t offset, size_t n) 212 373 { 213 374 return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n); … … 226 387 } 227 388 389 struct skel_fsync_state { 390 int ret; 391 int err; 392 }; 393 394 static void skel_fsync_done(struct tevent_req *subreq); 395 396 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle, 397 TALLOC_CTX *mem_ctx, 398 struct tevent_context *ev, 399 struct files_struct *fsp) 400 { 401 struct tevent_req *req, *subreq; 402 struct skel_fsync_state *state; 403 404 req = tevent_req_create(mem_ctx, &state, struct skel_fsync_state); 405 if (req == NULL) { 406 return NULL; 407 } 408 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp); 409 if (tevent_req_nomem(subreq, req)) { 410 return tevent_req_post(req, ev); 411 } 412 tevent_req_set_callback(subreq, skel_fsync_done, req); 413 return req; 414 } 415 416 static void skel_fsync_done(struct tevent_req *subreq) 417 { 418 struct tevent_req *req = 419 tevent_req_callback_data(subreq, struct tevent_req); 420 struct skel_fsync_state *state = 421 tevent_req_data(req, struct skel_fsync_state); 422 423 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err); 424 TALLOC_FREE(subreq); 425 tevent_req_done(req); 426 } 427 428 static int skel_fsync_recv(struct tevent_req *req, int *err) 429 { 430 struct skel_fsync_state *state = 431 tevent_req_data(req, struct skel_fsync_state); 432 433 if (tevent_req_is_unix_error(req, err)) { 434 return -1; 435 } 436 *err = state->err; 437 return state->ret; 438 } 439 228 440 static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname) 229 441 { … … 231 443 } 232 444 233 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) 445 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, 446 SMB_STRUCT_STAT *sbuf) 234 447 { 235 448 return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); 236 449 } 237 450 238 static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname) 451 static int skel_lstat(vfs_handle_struct *handle, 452 struct smb_filename *smb_fname) 239 453 { 240 454 return SMB_VFS_NEXT_LSTAT(handle, smb_fname); 241 455 } 242 456 243 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf) 457 static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, 458 struct files_struct *fsp, 459 const SMB_STRUCT_STAT *sbuf) 244 460 { 245 461 return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf); … … 252 468 } 253 469 254 static int skel_chmod(vfs_handle_struct *handle, 470 static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) 255 471 { 256 472 return SMB_VFS_NEXT_CHMOD(handle, path, mode); 257 473 } 258 474 259 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) 475 static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, 476 mode_t mode) 260 477 { 261 478 return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); 262 479 } 263 480 264 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) 481 static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, 482 gid_t gid) 265 483 { 266 484 return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid); 267 485 } 268 486 269 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) 487 static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, 488 uid_t uid, gid_t gid) 270 489 { 271 490 return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid); 272 491 } 273 492 274 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) 493 static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, 494 gid_t gid) 275 495 { 276 496 return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid); 277 497 } 278 498 279 static int skel_chdir(vfs_handle_struct *handle, 499 static int skel_chdir(vfs_handle_struct *handle, const char *path) 280 500 { 281 501 return SMB_VFS_NEXT_CHDIR(handle, path); 282 502 } 283 503 284 static char *skel_getwd(vfs_handle_struct *handle , char *buf)285 { 286 return SMB_VFS_NEXT_GETWD(handle , buf);504 static char *skel_getwd(vfs_handle_struct *handle) 505 { 506 return SMB_VFS_NEXT_GETWD(handle); 287 507 } 288 508 … … 294 514 } 295 515 296 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset) 516 static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, 517 off_t offset) 297 518 { 298 519 return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); … … 300 521 301 522 static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp, 302 enum vfs_fallocate_mode mode, 303 SMB_OFF_T offset, 304 SMB_OFF_T len) 523 uint32_t mode, off_t offset, off_t len) 305 524 { 306 525 return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len); 307 526 } 308 527 309 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) 528 static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, 529 off_t offset, off_t count, int type) 310 530 { 311 531 return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type); 312 532 } 313 533 314 static int skel_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32 access_mask) 534 static int skel_kernel_flock(struct vfs_handle_struct *handle, 535 struct files_struct *fsp, uint32_t share_mode, 536 uint32_t access_mask) 315 537 { 316 538 return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask); 317 539 } 318 540 319 static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype) 541 static int skel_linux_setlease(struct vfs_handle_struct *handle, 542 struct files_struct *fsp, int leasetype) 320 543 { 321 544 return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype); 322 545 } 323 546 324 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) 547 static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, 548 off_t *poffset, off_t *pcount, int *ptype, 549 pid_t *ppid) 325 550 { 326 551 return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid); 327 552 } 328 553 329 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) 554 static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, 555 const char *newpath) 330 556 { 331 557 return SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath); 332 558 } 333 559 334 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz) 560 static int skel_vfs_readlink(vfs_handle_struct *handle, const char *path, 561 char *buf, size_t bufsiz) 335 562 { 336 563 return SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz); 337 564 } 338 565 339 static int skel_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath) 566 static int skel_link(vfs_handle_struct *handle, const char *oldpath, 567 const char *newpath) 340 568 { 341 569 return SMB_VFS_NEXT_LINK(handle, oldpath, newpath); 342 570 } 343 571 344 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev) 572 static int skel_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, 573 SMB_DEV_T dev) 345 574 { 346 575 return SMB_VFS_NEXT_MKNOD(handle, path, mode, dev); 347 576 } 348 577 349 static char *skel_realpath(vfs_handle_struct *handle, 578 static char *skel_realpath(vfs_handle_struct *handle, const char *path) 350 579 { 351 580 return SMB_VFS_NEXT_REALPATH(handle, path); 352 581 } 353 582 354 static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle, 355 struct sys_notify_context *ctx, struct notify_entry *e, 356 void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev), 357 void *private_data, void *handle_p) 358 { 359 return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback, 360 private_data, handle_p); 361 } 362 363 static int skel_chflags(vfs_handle_struct *handle, const char *path, uint flags) 583 static int skel_chflags(vfs_handle_struct *handle, const char *path, 584 uint flags) 364 585 { 365 586 return SMB_VFS_NEXT_CHFLAGS(handle, path, flags); … … 370 591 { 371 592 return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf); 593 } 594 595 struct skel_cc_state { 596 struct vfs_handle_struct *handle; 597 off_t copied; 598 }; 599 static void skel_copy_chunk_done(struct tevent_req *subreq); 600 601 static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle, 602 TALLOC_CTX *mem_ctx, 603 struct tevent_context *ev, 604 struct files_struct *src_fsp, 605 off_t src_off, 606 struct files_struct *dest_fsp, 607 off_t dest_off, 608 off_t num) 609 { 610 struct tevent_req *req; 611 struct tevent_req *subreq; 612 struct skel_cc_state *cc_state; 613 614 req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state); 615 if (req == NULL) { 616 return NULL; 617 } 618 619 cc_state->handle = handle; 620 subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, cc_state, ev, 621 src_fsp, src_off, 622 dest_fsp, dest_off, num); 623 if (tevent_req_nomem(subreq, req)) { 624 return tevent_req_post(req, ev); 625 } 626 627 tevent_req_set_callback(subreq, skel_copy_chunk_done, req); 628 return req; 629 } 630 631 static void skel_copy_chunk_done(struct tevent_req *subreq) 632 { 633 struct tevent_req *req = tevent_req_callback_data( 634 subreq, struct tevent_req); 635 struct skel_cc_state *cc_state 636 = tevent_req_data(req, struct skel_cc_state); 637 NTSTATUS status; 638 639 status = SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state->handle, 640 subreq, 641 &cc_state->copied); 642 TALLOC_FREE(subreq); 643 if (tevent_req_nterror(req, status)) { 644 return; 645 } 646 tevent_req_done(req); 647 } 648 649 static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle, 650 struct tevent_req *req, 651 off_t *copied) 652 { 653 struct skel_cc_state *cc_state 654 = tevent_req_data(req, struct skel_cc_state); 655 NTSTATUS status; 656 657 *copied = cc_state->copied; 658 if (tevent_req_is_nterror(req, &status)) { 659 tevent_req_received(req); 660 return status; 661 } 662 663 tevent_req_received(req); 664 return NT_STATUS_OK; 665 } 666 667 static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle, 668 TALLOC_CTX *mem_ctx, 669 struct files_struct *fsp, 670 struct smb_filename *smb_fname, 671 uint16_t *_compression_fmt) 672 { 673 return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname, 674 _compression_fmt); 675 } 676 677 static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle, 678 TALLOC_CTX *mem_ctx, 679 struct files_struct *fsp, 680 uint16_t compression_fmt) 681 { 682 return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp, 683 compression_fmt); 372 684 } 373 685 … … 380 692 { 381 693 return SMB_VFS_NEXT_STREAMINFO(handle, 382 fsp, 383 fname, 384 mem_ctx, 385 num_streams, 386 streams); 694 fsp, 695 fname, mem_ctx, num_streams, streams); 387 696 } 388 697 389 698 static int skel_get_real_filename(struct vfs_handle_struct *handle, 390 const char *path, 391 const char *name, 392 TALLOC_CTX *mem_ctx, 393 char **found_name) 699 const char *path, 700 const char *name, 701 TALLOC_CTX *mem_ctx, char **found_name) 394 702 { 395 703 return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, 396 path, 397 name, 398 mem_ctx, 399 found_name); 704 path, name, mem_ctx, found_name); 400 705 } 401 706 402 707 static const char *skel_connectpath(struct vfs_handle_struct *handle, 403 const char *filename)708 const char *filename) 404 709 { 405 710 return SMB_VFS_NEXT_CONNECTPATH(handle, filename); … … 407 712 408 713 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle, 409 struct byte_range_lock *br_lck, 410 struct lock_struct *plock, 411 bool blocking_lock, 412 struct blocking_lock_record *blr) 714 struct byte_range_lock *br_lck, 715 struct lock_struct *plock, 716 bool blocking_lock) 413 717 { 414 718 return SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, 415 br_lck, 416 plock, 417 blocking_lock, 418 blr); 719 br_lck, plock, blocking_lock); 419 720 } 420 721 421 722 static bool skel_brl_unlock_windows(struct vfs_handle_struct *handle, 422 struct messaging_context *msg_ctx, 423 struct byte_range_lock *br_lck, 424 const struct lock_struct *plock) 425 { 426 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, 427 msg_ctx, 428 br_lck, 429 plock); 723 struct messaging_context *msg_ctx, 724 struct byte_range_lock *br_lck, 725 const struct lock_struct *plock) 726 { 727 return SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck, plock); 430 728 } 431 729 432 730 static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle, 433 struct byte_range_lock *br_lck, 434 struct lock_struct *plock, 435 struct blocking_lock_record *blr) 436 { 437 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, 438 br_lck, 439 plock, 440 blr); 731 struct byte_range_lock *br_lck, 732 struct lock_struct *plock) 733 { 734 return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock); 441 735 } 442 736 443 737 static bool skel_strict_lock(struct vfs_handle_struct *handle, 444 struct files_struct *fsp, 445 struct lock_struct *plock) 446 { 447 return SMB_VFS_NEXT_STRICT_LOCK(handle, 448 fsp, 449 plock); 738 struct files_struct *fsp, 739 struct lock_struct *plock) 740 { 741 return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock); 450 742 } 451 743 452 744 static void skel_strict_unlock(struct vfs_handle_struct *handle, 453 struct files_struct *fsp, 454 struct lock_struct *plock) 455 { 456 SMB_VFS_NEXT_STRICT_UNLOCK(handle, 457 fsp, 458 plock); 745 struct files_struct *fsp, 746 struct lock_struct *plock) 747 { 748 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock); 459 749 } 460 750 461 751 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle, 462 const char *mapped_name, 463 enum vfs_translate_direction direction, 464 TALLOC_CTX *mem_ctx, 465 char **pmapped_name) 752 const char *mapped_name, 753 enum vfs_translate_direction direction, 754 TALLOC_CTX *mem_ctx, char **pmapped_name) 466 755 { 467 756 return SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction, … … 469 758 } 470 759 760 static NTSTATUS skel_fsctl(struct vfs_handle_struct *handle, 761 struct files_struct *fsp, 762 TALLOC_CTX *ctx, 763 uint32_t function, 764 uint16_t req_flags, /* Needed for UNICODE ... */ 765 const uint8_t *_in_data, 766 uint32_t in_len, 767 uint8_t ** _out_data, 768 uint32_t max_out_len, uint32_t *out_len) 769 { 770 return SMB_VFS_NEXT_FSCTL(handle, 771 fsp, 772 ctx, 773 function, 774 req_flags, 775 _in_data, 776 in_len, _out_data, max_out_len, out_len); 777 } 778 779 static NTSTATUS skel_readdir_attr(struct vfs_handle_struct *handle, 780 const struct smb_filename *fname, 781 TALLOC_CTX *mem_ctx, 782 struct readdir_attr_data **pattr_data) 783 { 784 return SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data); 785 } 786 471 787 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 472 uint32 security_info, struct security_descriptor **ppdesc) 473 { 474 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc); 788 uint32_t security_info, 789 TALLOC_CTX *mem_ctx, 790 struct security_descriptor **ppdesc) 791 { 792 return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx, 793 ppdesc); 475 794 } 476 795 477 796 static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle, 478 const char *name, uint32 security_info, struct security_descriptor **ppdesc) 479 { 480 return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc); 797 const char *name, uint32_t security_info, 798 TALLOC_CTX *mem_ctx, 799 struct security_descriptor **ppdesc) 800 { 801 return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, mem_ctx, 802 ppdesc); 481 803 } 482 804 483 805 static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, 484 uint32 security_info_sent, const struct security_descriptor *psd) 806 uint32_t security_info_sent, 807 const struct security_descriptor *psd) 485 808 { 486 809 return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd); 487 810 } 488 811 489 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode) 812 static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, 813 mode_t mode) 490 814 { 491 815 return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode); 492 816 } 493 817 494 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) 818 static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, 819 mode_t mode) 495 820 { 496 821 return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); 497 822 } 498 823 499 static int skel_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) 500 { 501 return SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p); 502 } 503 504 static int skel_sys_acl_get_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p) 505 { 506 return SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p); 507 } 508 509 static int skel_sys_acl_get_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p) 510 { 511 return SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p); 512 } 513 514 static void *skel_sys_acl_get_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d) 515 { 516 return SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d); 517 } 518 519 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type) 520 { 521 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type); 522 } 523 524 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) 525 { 526 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp); 527 } 528 529 static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset) 530 { 531 return SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset); 532 } 533 534 static int skel_sys_acl_add_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) 535 { 536 return SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm); 537 } 538 539 static char *skel_sys_acl_to_text(vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen) 540 { 541 return SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen); 542 } 543 544 static SMB_ACL_T skel_sys_acl_init(vfs_handle_struct *handle, int count) 545 { 546 return SMB_VFS_NEXT_SYS_ACL_INIT(handle, count); 547 } 548 549 static int skel_sys_acl_create_entry(vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry) 550 { 551 return SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry); 552 } 553 554 static int skel_sys_acl_set_tag_type(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype) 555 { 556 return SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry, tagtype); 557 } 558 559 static int skel_sys_acl_set_qualifier(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual) 560 { 561 return SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual); 562 } 563 564 static int skel_sys_acl_set_permset(vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset) 565 { 566 return SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset); 567 } 568 569 static int skel_sys_acl_valid(vfs_handle_struct *handle, SMB_ACL_T theacl ) 570 { 571 return SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl); 572 } 573 574 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) 824 static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, 825 const char *path_p, 826 SMB_ACL_TYPE_T type, 827 TALLOC_CTX *mem_ctx) 828 { 829 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx); 830 } 831 832 static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, 833 files_struct *fsp, TALLOC_CTX *mem_ctx) 834 { 835 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx); 836 } 837 838 static int skel_sys_acl_blob_get_file(vfs_handle_struct *handle, 839 const char *path_p, TALLOC_CTX *mem_ctx, 840 char **blob_description, DATA_BLOB *blob) 841 { 842 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, 843 blob_description, blob); 844 } 845 846 static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle, 847 files_struct *fsp, TALLOC_CTX *mem_ctx, 848 char **blob_description, DATA_BLOB *blob) 849 { 850 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, 851 blob_description, blob); 852 } 853 854 static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, 855 SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) 575 856 { 576 857 return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl); 577 858 } 578 859 579 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) 860 static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, 861 SMB_ACL_T theacl) 580 862 { 581 863 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl); 582 864 } 583 865 584 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) 866 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, 867 const char *path) 585 868 { 586 869 return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path); 587 870 } 588 871 589 static int skel_sys_acl_get_perm(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm) 590 { 591 return SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm); 592 } 593 594 static int skel_sys_acl_free_text(vfs_handle_struct *handle, char *text) 595 { 596 return SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text); 597 } 598 599 static int skel_sys_acl_free_acl(vfs_handle_struct *handle, SMB_ACL_T posix_acl) 600 { 601 return SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl); 602 } 603 604 static int skel_sys_acl_free_qualifier(vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype) 605 { 606 return SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier, tagtype); 607 } 608 609 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size) 610 { 611 return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size); 612 } 613 614 static ssize_t skel_lgetxattr(vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t 615 size) 616 { 617 return SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size); 618 } 619 620 static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) 621 { 622 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size); 623 } 624 625 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) 626 { 627 return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size); 628 } 629 630 static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) 631 { 632 return SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size); 633 } 634 635 static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) 636 { 637 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size); 638 } 639 640 static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name) 641 { 642 return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name); 643 } 644 645 static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const char *name) 646 { 647 return SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name); 648 } 649 650 static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name) 651 { 652 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name); 653 } 654 655 static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) 656 { 657 return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags); 658 } 659 660 static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) 661 { 662 return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags); 663 } 664 665 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) 666 { 667 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags); 668 } 669 670 static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 671 { 672 return SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb); 673 } 674 675 static int skel_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 676 { 677 return SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb); 678 } 679 680 static ssize_t skel_aio_return_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 681 { 682 return SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb); 683 } 684 685 static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 686 { 687 return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb); 688 } 689 690 static int skel_aio_error_fn(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) 691 { 692 return SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb); 693 } 694 695 static int skel_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb) 696 { 697 return SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb); 698 } 699 700 static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts) 701 { 702 return SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts); 703 } 704 705 static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) 706 { 707 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp); 708 } 709 710 static bool skel_is_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname, SMB_STRUCT_STAT *sbuf) 872 static ssize_t skel_getxattr(vfs_handle_struct *handle, const char *path, 873 const char *name, void *value, size_t size) 874 { 875 return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size); 876 } 877 878 static ssize_t skel_fgetxattr(vfs_handle_struct *handle, 879 struct files_struct *fsp, const char *name, 880 void *value, size_t size) 881 { 882 return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size); 883 } 884 885 static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, 886 char *list, size_t size) 887 { 888 return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size); 889 } 890 891 static ssize_t skel_flistxattr(vfs_handle_struct *handle, 892 struct files_struct *fsp, char *list, 893 size_t size) 894 { 895 return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size); 896 } 897 898 static int skel_removexattr(vfs_handle_struct *handle, const char *path, 899 const char *name) 900 { 901 return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name); 902 } 903 904 static int skel_fremovexattr(vfs_handle_struct *handle, 905 struct files_struct *fsp, const char *name) 906 { 907 return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name); 908 } 909 910 static int skel_setxattr(vfs_handle_struct *handle, const char *path, 911 const char *name, const void *value, size_t size, 912 int flags) 913 { 914 return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags); 915 } 916 917 static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, 918 const char *name, const void *value, size_t size, 919 int flags) 920 { 921 return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags); 922 } 923 924 static bool skel_aio_force(struct vfs_handle_struct *handle, 925 struct files_struct *fsp) 926 { 927 return SMB_VFS_NEXT_AIO_FORCE(handle, fsp); 928 } 929 930 static bool skel_is_offline(struct vfs_handle_struct *handle, 931 const struct smb_filename *fname, 932 SMB_STRUCT_STAT *sbuf) 711 933 { 712 934 return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf); 713 935 } 714 936 715 static int skel_set_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname) 937 static int skel_set_offline(struct vfs_handle_struct *handle, 938 const struct smb_filename *fname) 716 939 { 717 940 return SMB_VFS_NEXT_SET_OFFLINE(handle, fname); … … 724 947 725 948 .connect_fn = skel_connect, 726 .disconnect = skel_disconnect, 727 .disk_free = skel_disk_free, 728 .get_quota = skel_get_quota, 729 .set_quota = skel_set_quota, 730 .get_shadow_copy_data = skel_get_shadow_copy_data, 731 .statvfs = skel_statvfs, 732 .fs_capabilities = skel_fs_capabilities, 949 .disconnect_fn = skel_disconnect, 950 .disk_free_fn = skel_disk_free, 951 .get_quota_fn = skel_get_quota, 952 .set_quota_fn = skel_set_quota, 953 .get_shadow_copy_data_fn = skel_get_shadow_copy_data, 954 .statvfs_fn = skel_statvfs, 955 .fs_capabilities_fn = skel_fs_capabilities, 956 .get_dfs_referrals_fn = skel_get_dfs_referrals, 957 .snap_check_path_fn = skel_snap_check_path, 958 .snap_create_fn = skel_snap_create, 959 .snap_delete_fn = skel_snap_delete, 733 960 734 961 /* Directory operations */ 735 962 736 .opendir = skel_opendir,737 .fdopendir = skel_fdopendir,738 .readdir = skel_readdir,739 .seekdir = skel_seekdir,740 .telldir = skel_telldir,741 .rewind_dir = skel_rewind_dir,742 .mkdir = skel_mkdir,743 .rmdir = skel_rmdir,744 .closedir = skel_closedir,745 .init_search_op = skel_init_search_op,963 .opendir_fn = skel_opendir, 964 .fdopendir_fn = skel_fdopendir, 965 .readdir_fn = skel_readdir, 966 .seekdir_fn = skel_seekdir, 967 .telldir_fn = skel_telldir, 968 .rewind_dir_fn = skel_rewind_dir, 969 .mkdir_fn = skel_mkdir, 970 .rmdir_fn = skel_rmdir, 971 .closedir_fn = skel_closedir, 972 .init_search_op_fn = skel_init_search_op, 746 973 747 974 /* File operations */ 748 975 749 976 .open_fn = skel_open, 750 .create_file = skel_create_file,977 .create_file_fn = skel_create_file, 751 978 .close_fn = skel_close_fn, 752 .vfs_read = skel_vfs_read, 753 .pread = skel_pread, 754 .write = skel_write, 755 .pwrite = skel_pwrite, 756 .lseek = skel_lseek, 757 .sendfile = skel_sendfile, 758 .recvfile = skel_recvfile, 759 .rename = skel_rename, 760 .fsync = skel_fsync, 761 .stat = skel_stat, 762 .fstat = skel_fstat, 763 .lstat = skel_lstat, 764 .get_alloc_size = skel_get_alloc_size, 765 .unlink = skel_unlink, 766 .chmod = skel_chmod, 767 .fchmod = skel_fchmod, 768 .chown = skel_chown, 769 .fchown = skel_fchown, 770 .lchown = skel_lchown, 771 .chdir = skel_chdir, 772 .getwd = skel_getwd, 773 .ntimes = skel_ntimes, 774 .ftruncate = skel_ftruncate, 775 .fallocate = skel_fallocate, 776 .lock = skel_lock, 777 .kernel_flock = skel_kernel_flock, 778 .linux_setlease = skel_linux_setlease, 779 .getlock = skel_getlock, 780 .symlink = skel_symlink, 781 .vfs_readlink = skel_vfs_readlink, 782 .link = skel_link, 783 .mknod = skel_mknod, 784 .realpath = skel_realpath, 785 .notify_watch = skel_notify_watch, 786 .chflags = skel_chflags, 787 .file_id_create = skel_file_id_create, 788 789 .streaminfo = skel_streaminfo, 790 .get_real_filename = skel_get_real_filename, 791 .connectpath = skel_connectpath, 792 .brl_lock_windows = skel_brl_lock_windows, 793 .brl_unlock_windows = skel_brl_unlock_windows, 794 .brl_cancel_windows = skel_brl_cancel_windows, 795 .strict_lock = skel_strict_lock, 796 .strict_unlock = skel_strict_unlock, 797 .translate_name = skel_translate_name, 979 .read_fn = skel_vfs_read, 980 .pread_fn = skel_pread, 981 .pread_send_fn = skel_pread_send, 982 .pread_recv_fn = skel_pread_recv, 983 .write_fn = skel_write, 984 .pwrite_fn = skel_pwrite, 985 .pwrite_send_fn = skel_pwrite_send, 986 .pwrite_recv_fn = skel_pwrite_recv, 987 .lseek_fn = skel_lseek, 988 .sendfile_fn = skel_sendfile, 989 .recvfile_fn = skel_recvfile, 990 .rename_fn = skel_rename, 991 .fsync_fn = skel_fsync, 992 .fsync_send_fn = skel_fsync_send, 993 .fsync_recv_fn = skel_fsync_recv, 994 .stat_fn = skel_stat, 995 .fstat_fn = skel_fstat, 996 .lstat_fn = skel_lstat, 997 .get_alloc_size_fn = skel_get_alloc_size, 998 .unlink_fn = skel_unlink, 999 .chmod_fn = skel_chmod, 1000 .fchmod_fn = skel_fchmod, 1001 .chown_fn = skel_chown, 1002 .fchown_fn = skel_fchown, 1003 .lchown_fn = skel_lchown, 1004 .chdir_fn = skel_chdir, 1005 .getwd_fn = skel_getwd, 1006 .ntimes_fn = skel_ntimes, 1007 .ftruncate_fn = skel_ftruncate, 1008 .fallocate_fn = skel_fallocate, 1009 .lock_fn = skel_lock, 1010 .kernel_flock_fn = skel_kernel_flock, 1011 .linux_setlease_fn = skel_linux_setlease, 1012 .getlock_fn = skel_getlock, 1013 .symlink_fn = skel_symlink, 1014 .readlink_fn = skel_vfs_readlink, 1015 .link_fn = skel_link, 1016 .mknod_fn = skel_mknod, 1017 .realpath_fn = skel_realpath, 1018 .chflags_fn = skel_chflags, 1019 .file_id_create_fn = skel_file_id_create, 1020 .copy_chunk_send_fn = skel_copy_chunk_send, 1021 .copy_chunk_recv_fn = skel_copy_chunk_recv, 1022 .get_compression_fn = skel_get_compression, 1023 .set_compression_fn = skel_set_compression, 1024 1025 .streaminfo_fn = skel_streaminfo, 1026 .get_real_filename_fn = skel_get_real_filename, 1027 .connectpath_fn = skel_connectpath, 1028 .brl_lock_windows_fn = skel_brl_lock_windows, 1029 .brl_unlock_windows_fn = skel_brl_unlock_windows, 1030 .brl_cancel_windows_fn = skel_brl_cancel_windows, 1031 .strict_lock_fn = skel_strict_lock, 1032 .strict_unlock_fn = skel_strict_unlock, 1033 .translate_name_fn = skel_translate_name, 1034 .fsctl_fn = skel_fsctl, 1035 .readdir_attr_fn = skel_readdir_attr, 798 1036 799 1037 /* NT ACL operations. */ 800 1038 801 .fget_nt_acl = skel_fget_nt_acl,802 .get_nt_acl = skel_get_nt_acl,803 .fset_nt_acl = skel_fset_nt_acl,1039 .fget_nt_acl_fn = skel_fget_nt_acl, 1040 .get_nt_acl_fn = skel_get_nt_acl, 1041 .fset_nt_acl_fn = skel_fset_nt_acl, 804 1042 805 1043 /* POSIX ACL operations. */ 806 1044 807 .chmod_acl = skel_chmod_acl, 808 .fchmod_acl = skel_fchmod_acl, 809 810 .sys_acl_get_entry = skel_sys_acl_get_entry, 811 .sys_acl_get_tag_type = skel_sys_acl_get_tag_type, 812 .sys_acl_get_permset = skel_sys_acl_get_permset, 813 .sys_acl_get_qualifier = skel_sys_acl_get_qualifier, 814 .sys_acl_get_file = skel_sys_acl_get_file, 815 .sys_acl_get_fd = skel_sys_acl_get_fd, 816 .sys_acl_clear_perms = skel_sys_acl_clear_perms, 817 .sys_acl_add_perm = skel_sys_acl_add_perm, 818 .sys_acl_to_text = skel_sys_acl_to_text, 819 .sys_acl_init = skel_sys_acl_init, 820 .sys_acl_create_entry = skel_sys_acl_create_entry, 821 .sys_acl_set_tag_type = skel_sys_acl_set_tag_type, 822 .sys_acl_set_qualifier = skel_sys_acl_set_qualifier, 823 .sys_acl_set_permset = skel_sys_acl_set_permset, 824 .sys_acl_valid = skel_sys_acl_valid, 825 .sys_acl_set_file = skel_sys_acl_set_file, 826 .sys_acl_set_fd = skel_sys_acl_set_fd, 827 .sys_acl_delete_def_file = skel_sys_acl_delete_def_file, 828 .sys_acl_get_perm = skel_sys_acl_get_perm, 829 .sys_acl_free_text = skel_sys_acl_free_text, 830 .sys_acl_free_acl = skel_sys_acl_free_acl, 831 .sys_acl_free_qualifier = skel_sys_acl_free_qualifier, 1045 .chmod_acl_fn = skel_chmod_acl, 1046 .fchmod_acl_fn = skel_fchmod_acl, 1047 1048 .sys_acl_get_file_fn = skel_sys_acl_get_file, 1049 .sys_acl_get_fd_fn = skel_sys_acl_get_fd, 1050 .sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file, 1051 .sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd, 1052 .sys_acl_set_file_fn = skel_sys_acl_set_file, 1053 .sys_acl_set_fd_fn = skel_sys_acl_set_fd, 1054 .sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file, 832 1055 833 1056 /* EA operations. */ 834 .getxattr = skel_getxattr, 835 .lgetxattr = skel_lgetxattr, 836 .fgetxattr = skel_fgetxattr, 837 .listxattr = skel_listxattr, 838 .llistxattr = skel_llistxattr, 839 .flistxattr = skel_flistxattr, 840 .removexattr = skel_removexattr, 841 .lremovexattr = skel_lremovexattr, 842 .fremovexattr = skel_fremovexattr, 843 .setxattr = skel_setxattr, 844 .lsetxattr = skel_lsetxattr, 845 .fsetxattr = skel_fsetxattr, 1057 .getxattr_fn = skel_getxattr, 1058 .fgetxattr_fn = skel_fgetxattr, 1059 .listxattr_fn = skel_listxattr, 1060 .flistxattr_fn = skel_flistxattr, 1061 .removexattr_fn = skel_removexattr, 1062 .fremovexattr_fn = skel_fremovexattr, 1063 .setxattr_fn = skel_setxattr, 1064 .fsetxattr_fn = skel_fsetxattr, 846 1065 847 1066 /* aio operations */ 848 .aio_read = skel_aio_read, 849 .aio_write = skel_aio_write, 850 .aio_return_fn = skel_aio_return_fn, 851 .aio_cancel = skel_aio_cancel, 852 .aio_error_fn = skel_aio_error_fn, 853 .aio_fsync = skel_aio_fsync, 854 .aio_suspend = skel_aio_suspend, 855 .aio_force = skel_aio_force, 1067 .aio_force_fn = skel_aio_force, 856 1068 857 1069 /* offline operations */ 858 .is_offline = skel_is_offline,859 .set_offline = skel_set_offline1070 .is_offline_fn = skel_is_offline, 1071 .set_offline_fn = skel_set_offline 860 1072 }; 861 1073 1074 static_decl_vfs; 862 1075 NTSTATUS vfs_skel_transparent_init(void) 863 1076 { 864 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", &skel_transparent_fns); 865 } 1077 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", 1078 &skel_transparent_fns); 1079 }
Note:
See TracChangeset
for help on using the changeset viewer.