From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11098 invoked by alias); 11 May 2005 07:39:03 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 11036 invoked from network); 11 May 2005 07:38:59 -0000 Received: from unknown (HELO lorien.ee.elatec.si) (193.77.58.106) by sourceware.org with SMTP; 11 May 2005 07:38:59 -0000 Received: from [192.168.0.3] (telperion.ee.elatec.si [192.168.0.3]) by lorien.ee.elatec.si (8.12.11/8.12.11) with ESMTP id j4B7X9AV031773; Wed, 11 May 2005 09:33:10 +0200 Message-ID: <4281B63F.1060107@elatec.si> Date: Wed, 11 May 2005 09:32:00 -0000 From: Savin Zlobec User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) MIME-Version: 1.0 To: Gratian Crisan CC: ecos-discuss@ecos.sourceware.org References: <200505091228.04579.nelu@iv.ro> <200505101258.48354.nelu@iv.ro> <428091CE.20300@elatec.si> <200505101500.19717.nelu@iv.ro> In-Reply-To: <200505101500.19717.nelu@iv.ro> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Status: Clean Subject: Re: [ECOS] fatfs lseek EOF bug X-SW-Source: 2005-05/txt/msg00154.txt.bz2 Gratian Crisan wrote: > The patch works OK :), thanks. Ok, I'll wait a couple of days and then send the patch to ecos-patches. >On a side note: I'm looking for an alternative implementation for 'ftruncate' >POSIX function which is missing from eCos. Do you know how I could implement >it for fatfs? > > It should not be too hard - If the file is shrinking find the last cluster of the new file length (get_position_from_off), free all clusters from the current one the the end of the file (free_cluster_chain) and change the size of the coresponding fatfs node. If the file is extending, then you need to allocate the appropriate number of clusters and link them into the file cluster chain (find_and_append_cluster). savin -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss