X-Git-Url: https://rtime.felk.cvut.cz/gitweb/l4.git/blobdiff_plain/8fe9942cde59835eb3c3c6936d866dd3305582ef:/l4/pkg/l4re_vfs/include/impl/vfs_impl.h..003b628647705666de261350195da72a38f2c4d2:/l4/pkg/l4re-core/l4re_vfs/include/impl/vfs_impl.h diff --git a/l4/pkg/l4re_vfs/include/impl/vfs_impl.h b/l4/pkg/l4re-core/l4re_vfs/include/impl/vfs_impl.h similarity index 95% rename from l4/pkg/l4re_vfs/include/impl/vfs_impl.h rename to l4/pkg/l4re-core/l4re_vfs/include/impl/vfs_impl.h index 8c030c3f1..eb479886e 100644 --- a/l4/pkg/l4re_vfs/include/impl/vfs_impl.h +++ b/l4/pkg/l4re-core/l4re_vfs/include/impl/vfs_impl.h @@ -114,7 +114,7 @@ public: _root_mount.add_ref(); _root.add_ref(); _root_mount.mount(cxx::ref_ptr(&_root)); - _cwd = &_root; + _cwd = cxx::ref_ptr(&_root); #if 0 Ref_ptr rom; @@ -141,7 +141,7 @@ public: int munmap(void *start, size_t len) throw(); int mremap(void *old, size_t old_sz, size_t new_sz, int flags, - void **new_adr) throw(); + void **new_addr) throw(); int mprotect(const void *a, size_t sz, int prot) throw(); int msync(void *addr, size_t len, int flags) throw(); int madvise(void *addr, size_t len, int advice) throw(); @@ -346,8 +346,6 @@ Vfs::munmap(void *start, size_t len) L4_NOTHROW switch (err & Rm::Detach_result_mask) { case Rm::Split_ds: - if (ds.is_valid()) - ds->take(); return 0; case Rm::Detached_ds: if (ds.is_valid()) @@ -405,8 +403,6 @@ Vfs::alloc_anon_mem(l4_umword_t size, L4::Cap *ds, else *ds = _annon_ds; - (*ds)->take(); - if (_early_oom) { if (int err = (*ds)->allocate(_annon_offset, size)) @@ -511,7 +507,6 @@ Vfs::mmap2(void *start, size_t len, int prot, int flags, int fd, off_t _offset, else { ds = fds; - ds->take(); } } else @@ -544,7 +539,11 @@ Vfs::mmap2(void *start, size_t len, int prot, int flags, int fd, off_t _offset, if (!(flags & MAP_FIXED)) rm_flags |= Rm::Search_addr; if (!(prot & PROT_WRITE)) rm_flags |= Rm::Read_only; - err = r->attach(&data, size, rm_flags, ds, offset); + err = r->attach(&data, size, rm_flags, + L4::Ipc::make_cap(ds, (prot & PROT_WRITE) + ? L4_CAP_FPAGE_RW + : L4_CAP_FPAGE_RO), + offset); DEBUG_LOG(debug_mmap, { outstring(" MAPPED: "); @@ -717,12 +716,14 @@ Vfs::mremap(void *old_addr, size_t old_size, size_t new_size, int flags, if (ts > max_s) ts = max_s; - err = r->attach(&n, ts, tflags | Rm::In_area, tds, toffs); + err = r->attach(&n, ts, tflags | Rm::In_area, + L4::Ipc::make_cap(tds, (tflags & Rm::Read_only) + ? L4_CAP_FPAGE_RO + : L4_CAP_FPAGE_RW), + toffs); if (err) return err; - tds->take(); - err = r->detach(ta, ts, &tds, This_task, Rm::Detach_exact | Rm::Detach_keep); if (err < 0) return err; @@ -730,8 +731,6 @@ Vfs::mremap(void *old_addr, size_t old_size, size_t new_size, int flags, switch (err & Rm::Detach_result_mask) { case Rm::Split_ds: - if (tds.is_valid()) - tds->take(); break; case Rm::Detached_ds: if (tds.is_valid()) @@ -749,7 +748,11 @@ Vfs::mremap(void *old_addr, size_t old_size, size_t new_size, int flags, *new_addr = (void *)na; na = na + old_size; - err = r->attach(&na, new_size - old_size, Rm::In_area | Rm::Detach_free, tds, toffs); + err = r->attach(&na, new_size - old_size, Rm::In_area | Rm::Detach_free, + L4::Ipc::make_cap(tds, (tflags & Rm::Read_only) + ? L4_CAP_FPAGE_RO + : L4_CAP_FPAGE_RW), + toffs); return err; }