Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jan 2008 15:08:36 -0500
From:      Adam <urbansnap@gmail.com>
To:        David Schultz <das@FreeBSD.ORG>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Reading and Writing to Block from di_spare
Message-ID:  <B0EF8F15-0B65-4C3B-98A0-FADBA4640EED@gmail.com>
In-Reply-To: <20080117194457.GA84887@VARK.MIT.EDU>
References:  <485228D5-8D0B-4CD5-9FB7-B0D551B172DA@gmail.com> <20080117194457.GA84887@VARK.MIT.EDU>

next in thread | previous in thread | raw e-mail | index | archive | help
David,
I understand that there is no routine to read and write specifically  
to an address contained in the di_spare.   I also understand that  
di_spare is currently unused and has no specific manipulators.

Allow me to clarify.  I am looking for a way to take a ufs2_daddr_t  
(which is neither a direct nor indirect block of a di_node) and read/ 
write to that address.

Regards,
Adam



On Jan 17, 2008, at 2:44 PM, David Schultz wrote:

> On Thu, Jan 17, 2008, Adam wrote:
>> Hi, I am working on a project for where I want to take the standard
>> UFS/FFS file system that BSD ships with and add several blocks of
>> information to the dinode.  The simplest way of doing it seemed to be
>> to allocate blocks to di_spare.  I believe that I have figured out  
>> how
>> to do that:
>>
>> ffs_alloc(inode, 0 , 0, (int)(inode->i_fs->fs_bsize), td->td_ucred,
>> &addr);
>> dinode->di_spare[1]=(int64_t)addr;
>>
>> I'm having problems taking that block address and reading/writing to
>> it.   As far as I can tell most of the buffer read routines (getblk,
>> bread) seem to be geared toward reading and writing direct and
>> indirect blocks in an inode.
>>
>> How do I read and write a block that is neither a direct nor an
>> indirect block?
>
> Maybe I'm misunderstanding your question, but I don't see how you
> could expect FreeBSD to have routines to read and write things
> that don't exist in FreeBSD. :)
>
> See extattr(2). It may be possible that the "extra information"
> you want to store with files can be stored in user space using the
> relatively standard extended attributes API.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B0EF8F15-0B65-4C3B-98A0-FADBA4640EED>