Sergey Bugaev, le sam. 08 mai 2021 18:31:41 +0300, a ecrit: > Clarify this in the documentation, and fix the storeio implementation.
That was indeed quite unclear, most code was assuming it was unmapped, and storeio was following the documentation. Applied, thanks! Samuel > --- > doc/hurd.texi | 6 +++--- > libpager/pager.h | 6 +++--- > storeio/pager.c | 8 +++----- > tmpfs/pager-stubs.c | 6 +++--- > 4 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/doc/hurd.texi b/doc/hurd.texi > index c8db86b5..239d82da 100644 > --- a/doc/hurd.texi > +++ b/doc/hurd.texi > @@ -1536,9 +1536,9 @@ only permissible error returns are @code{EIO}, > @code{EDQUOT}, and > > @deftypefun error_t pager_write_page (@w{struct user_pager_info > *@var{pager}}, @w{vm_offset_t @var{page}}, @w{vm_address_t @var{buf}}) > For pager @var{pager}, synchronously write one page from @var{buf} to > -offset @var{page}. In addition, @code{vm_deallocate} (or equivalent) > -@var{buf}. The only permissible error returns are @code{EIO}, > -@code{EDQUOT}, and @code{ENOSPC}. > +offset @var{page}. Do not deallocate @var{buf}, and do not keep any > +references to @var{buf}. The only permissible error returns are > +@code{EIO}, @code{EDQUOT}, and @code{ENOSPC}. > @end deftypefun > > @deftypefun error_t pager_unlock_page (@w{struct user_pager_info > *@var{pager}}, @w{vm_offset_t @var{address}}) > diff --git a/libpager/pager.h b/libpager/pager.h > index df7fbfc8..5c03b748 100644 > --- a/libpager/pager.h > +++ b/libpager/pager.h > @@ -191,9 +191,9 @@ pager_read_page (struct user_pager_info *pager, > int *write_lock); > > /* The user must define this function. For pager PAGER, synchronously > - write one page from BUF to offset PAGE. In addition, mfree > - (or equivalent) BUF. The only permissible error returns are EIO, > - EDQUOT, and ENOSPC. */ > + write one page from BUF to offset PAGE. Do not deallocate BUF, and do > + not keep any references to BUF. The only permissible error returns > + are EIO, EDQUOT, and ENOSPC. */ > error_t > pager_write_page (struct user_pager_info *pager, > vm_offset_t page, > diff --git a/storeio/pager.c b/storeio/pager.c > index 12387939..01a1525c 100644 > --- a/storeio/pager.c > +++ b/storeio/pager.c > @@ -66,9 +66,9 @@ pager_read_page (struct user_pager_info *upi, > return 0; > } > > -/* For pager PAGER, synchronously write one page from BUF to offset PAGE. In > - addition, vm_deallocate (or equivalent) BUF. The only permissible error > - returns are EIO, EDQUOT, and ENOSPC. */ > +/* For pager PAGER, synchronously write one page from BUF to offset PAGE. > + Do not deallocate BUF, and do not keep any references to BUF. The only > + permissible error returns are EIO, EDQUOT, and ENOSPC. */ > error_t > pager_write_page (struct user_pager_info *upi, > vm_offset_t page, vm_address_t buf) > @@ -90,8 +90,6 @@ pager_write_page (struct user_pager_info *upi, > > err = dev_write (dev, page, (char *)buf, want, &written); > > - munmap ((caddr_t) buf, vm_page_size); > - > if (err || written < want) > return EIO; > else > diff --git a/tmpfs/pager-stubs.c b/tmpfs/pager-stubs.c > index 3299e218..883a635e 100644 > --- a/tmpfs/pager-stubs.c > +++ b/tmpfs/pager-stubs.c > @@ -36,9 +36,9 @@ pager_read_page (struct user_pager_info *pager, > } > > /* The user must define this function. For pager PAGER, synchronously > - write one page from BUF to offset PAGE. In addition, mfree > - (or equivalent) BUF. The only permissible error returns are EIO, > - EDQUOT, and ENOSPC. */ > + write one page from BUF to offset PAGE. Do not deallocate BUF, and do > + not keep any references to BUF. The only permissible error returns > + are EIO, EDQUOT, and ENOSPC. */ > error_t > pager_write_page (struct user_pager_info *pager, > vm_offset_t page, > -- > 2.31.1 > -- Samuel Q: How do you play religious roulette? A: You stand around in a circle and blaspheme and see who gets struck by lightning first.