Skip to contentSkip to conversation

Beginner questions about meta data and plugins

DISCUSSION Ivar Bergman 3 participants 3 messages Apr 1, 2004

lore
Share & tools
lore
#0 lore raw

Hi all!

Over the last weeks I have been experementing with Reiser4, so far I have managed to build the kernel, created a mountable Reiser4 partition, and played around with the file system via the shell.

To learn how Reiser4 work, I planed to implement the following two programs:

1, Write a simple C program that list the value of a
specific file meta data. Like the way you can list

the value of a attibute by using cat.

cat myfile/..pseudo

2, Write a simple plugin that adds a new file
attribute.

I tried to read the kernel source code for help, but I guess it was a bit to much for me. So, does anybody have some source code that could help me on the way, or perhaps point out some part of the resier4 kernel source code that could be helpfull.

Some general quiestion about plugins:

o Does a file belong to one plugin only, or does it have a list of plugins?

o Can I, as a plugin writer, introduce new operations

on a file? In other words extend the file
interface.
And if that is possible, how do I invoke that operation from a C program?

Best regards
Ivar Bergman

__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/

#1 lore raw
Quoted 18 lines · Ivar Bergman

Hi all!

Over the last weeks I have been experementing with Reiser4, so far I have managed to build the kernel, created a mountable Reiser4 partition, and played around with the file system via the shell.

To learn how Reiser4 work, I planed to implement the following two programs:

1, Write a simple C program that list the value of a
specific file meta data. Like the way you can list

the value of a attibute by using cat.

cat myfile/..pseudo

Quoted 8 lines

2, Write a simple plugin that adds a new file
attribute.

I tried to read the kernel source code for help, but I guess it was a bit to much for me. So, does anybody have some source code that could help me on the way, or perhaps point out some part of the resier4 kernel source code that could be helpfull.

Take a look at fs/reiser4/plugin/pseudo/pseudo.c, where most pseudo files are implemented. Pattern you test-plugin after some example, like metas/uid (implemented by show_uid() and get_uid()). You will have to add new element to the reiser4_pseudo_id enum defined in fs/reiser4/plugin/pseudo/pseudo.h.

Quoted 6 lines

Some general quiestion about plugins:

o Does a file belong to one plugin only, or does it have a list of plugins?

Quoted 6 lines

o Can I, as a plugin writer, introduce new operations

on a file? In other words extend the file
interface.
And if that is possible, how do I invoke that operation from a C program?

Pseudo files are designed to extend file interface. If you need new file operation "foo", it can be accessed through normal read/write/readdir operations on file/WHATEVER-PSEUDO-PREFIX-IS-FASHIONABLE-TO-DAY/foo.

This principle is applicable to pseudo files themselves, that is, they also may have pseudo files hanging from them.

Quoted 4 lines

Best regards
Ivar Bergman

Good luck.
Nikita.

#2 lore raw
Quoted 1 line · Nikita Danilov

file/WHATEVER-PSEUDO-PREFIX-IS-FASHIONABLE-TO-DAY/foo.

Great,
+1 vote for that!

(at least today)

Signature · 1 line
lg, Chris