* How can I allocate few bytes to a file to store info about that file?
@ 2004-04-28 20:14 Vineet Joglekar
2004-04-28 20:59 ` Andreas Dilger
0 siblings, 1 reply; 2+ messages in thread
From: Vineet Joglekar @ 2004-04-28 20:14 UTC (permalink / raw)
To: linux-kernel
Hi all,
I was going through the functions like generic_file_write, generic_file_direct_IO, generic_direct_IO and filemap_fdatasync. I was thinking about calling these functions or calling functions written on similar lines to add new few bytes to the file when the inode is created by "ext2_create()". Can any1 please tell me how to do this? What I mean is, I want to add few bytes to the file as soon as it is created. I want to store some information regarding the file in that area.
I guess it would have been simpler to call these functions in the call sys_open() when a new file is created, but I want to make changes in kernel code only in ext2 module. playing with sys_open will be like modifying kernel code apart from the ext2 fs module which I dont want.
Thanks and regards,
Vineet
--- On Mon 04/26, Vineet Joglekar < vintya@excite.com > wrote:
From: Vineet Joglekar [mailto: vintya@excite.com]
To: linux-fsf@vger.kernel.org
Date: Mon, 26 Apr 2004 10:31:19 -0400
Subject: Can I allocate few bytes in a file to store info about that file; not visible to user?
Hi all,<br><br>In ext2fs, while creating a file, can I allocate a number of bytes for that file in advance, such that those bytes are not seen by the user? that is,<br><br>suppose I am creating a new file temp, then allocate 50 bytes immediately after creating the file. I want to use those bytes to store the file related info; accessible only to kernel. Whatever data user wants to add, will be added after the these 50 bytes. If user does lseek(fd,0,SEEK_SET), then the file pointer should point to the 51st byte. The 1st 50 bytes shouldnt be visible to user. I dont care if the file size is shown as userdata+50. Is it possible to achieve? If yes, how?<br><br>Thanks and regards,
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How can I allocate few bytes to a file to store info about that file?
2004-04-28 20:14 How can I allocate few bytes to a file to store info about that file? Vineet Joglekar
@ 2004-04-28 20:59 ` Andreas Dilger
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Dilger @ 2004-04-28 20:59 UTC (permalink / raw)
To: Vineet Joglekar; +Cc: linux-kernel
On Apr 28, 2004 16:14 -0400, Vineet Joglekar wrote:
> I was going through the functions like generic_file_write,
> generic_file_direct_IO, generic_direct_IO and filemap_fdatasync. I was
> thinking about calling these functions or calling functions written on
> similar lines to add new few bytes to the file when the inode is created
> by "ext2_create()". Can any1 please tell me how to do this? What I mean
> is, I want to add few bytes to the file as soon as it is created. I want
> to store some information regarding the file in that area.
See sys_setxattr(). You need support for extended attributes in your kernel
and filesystem. This includes ext2/ext3 for 2.6, but only if you apply a
patch for 2.4 I believe.
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-04-28 21:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-28 20:14 How can I allocate few bytes to a file to store info about that file? Vineet Joglekar
2004-04-28 20:59 ` Andreas Dilger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®