src/server/daemon/vfs.c

branch
webdav
changeset 247
1df803e06076
parent 241
4adad7faf452
child 269
3dfbd0b91950
equal deleted inserted replaced
246:155bdef7fe7e 247:1df803e06076
53 sys_vfs_fstat, 53 sys_vfs_fstat,
54 sys_vfs_opendir, 54 sys_vfs_opendir,
55 sys_vfs_fdopendir, 55 sys_vfs_fdopendir,
56 sys_vfs_mkdir, 56 sys_vfs_mkdir,
57 sys_vfs_unlink, 57 sys_vfs_unlink,
58 sys_vfs_rmdir,
58 VFS_CHECKS_ACL, 59 VFS_CHECKS_ACL,
59 NULL 60 NULL
60 }; 61 };
61 62
62 static VFS_IO sys_file_io = { 63 static VFS_IO sys_file_io = {
265 WS_ASSERT(path); 266 WS_ASSERT(path);
266 267
267 return vfs_path_op(ctx, path, ctx->vfs->unlink, ACL_DELETE); 268 return vfs_path_op(ctx, path, ctx->vfs->unlink, ACL_DELETE);
268 } 269 }
269 270
271 int vfs_rmdir(VFSContext *ctx, const char *path) {
272 WS_ASSERT(ctx);
273 WS_ASSERT(path);
274
275 return vfs_path_op(ctx, path, ctx->vfs->rmdir, ACL_DELETE);
276 }
270 277
271 // private 278 // private
272 int vfs_path_op(VFSContext *ctx, const char *path, vfs_op_f op, uint32_t access) { 279 int vfs_path_op(VFSContext *ctx, const char *path, vfs_op_f op, uint32_t access) {
273 uint32_t access_mask = ctx->aclreqaccess; 280 uint32_t access_mask = ctx->aclreqaccess;
274 access_mask |= access; 281 access_mask |= access;
508 return sys_path_op(ctx, path, sys_mkdir); 515 return sys_path_op(ctx, path, sys_mkdir);
509 } 516 }
510 517
511 int sys_vfs_unlink(VFSContext *ctx, const char *path) { 518 int sys_vfs_unlink(VFSContext *ctx, const char *path) {
512 return sys_path_op(ctx, path, sys_unlink); 519 return sys_path_op(ctx, path, sys_unlink);
520 }
521
522 int sys_vfs_rmdir(VFSContext *ctx, const char *path) {
523 return sys_path_op(ctx, path, sys_rmdir);
513 } 524 }
514 525
515 526
516 int sys_path_op(VFSContext *ctx, const char *path, sys_op_f op) { 527 int sys_path_op(VFSContext *ctx, const char *path, sys_op_f op) {
517 uint32_t access_mask = ctx->aclreqaccess; 528 uint32_t access_mask = ctx->aclreqaccess;
665 676
666 int sys_unlink(VFSContext *ctx, const char *path, SysACL *sysacl) { 677 int sys_unlink(VFSContext *ctx, const char *path, SysACL *sysacl) {
667 return unlink(path); 678 return unlink(path);
668 } 679 }
669 680
681 int sys_rmdir(VFSContext *ctx, const char *path, SysACL *sysacl) {
682 return rmdir(path);
683 }
684
670 /* public file api */ 685 /* public file api */
671 686
672 NSAPI_PUBLIC int system_fread(SYS_FILE fd, void *buf, int nbyte) { 687 NSAPI_PUBLIC int system_fread(SYS_FILE fd, void *buf, int nbyte) {
673 return fd->io->read(fd, buf, nbyte); 688 return fd->io->read(fd, buf, nbyte);
674 } 689 }

mercurial