Re: How to write to the middle of a swap file?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 5 Jul 2002 10:46:06 +0200

Because the Squid store interface is very simplistic and you are not
intended to do things like this.

If you want to rewrite an object then you currently need to create a
new object for the modified contents and then assign this new object
the correct public key.

Regards
Henrik

On Friday 05 July 2002 07.13, Yee Man Chan wrote:
> Hi,
>
> I am playing with 2.4S6. I want to replace
> something in a swap file by something else of the same
> length. I supposed in UFS, it is gonna be like this:
>
> lseek(fd, offset, SEEK_SET);
> write(fd, buf, len);
>
> I find that there is storeWrite function that seems
> to be able to do these two steps. So I do
>
> storeWrite(entry->mem_obj->swapout.sio, buf, len,
> offset, NULL);
>
> However, I find that instead of writing to where I
> want it to be, it goes to the end of the file. Why is
> that? I run gdb with it many times but I still can't
> figure it out. The return value from lseek inside
> diskHandleWrite seems right, too. However, it still
> appends to the end of the file. Can anyone help me on
> this?
>
> Thanks in advance.
> Yee Man
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
Received on Fri Jul 05 2002 - 03:29:32 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:45 MST