Skip to contentSkip to conversation

befs : Add small_data support through xattr handlers

PATCH New Fabian Frederick 1 participant 1 message Dec 3, 2013 Befs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 befs : Add small_data support through xattr handlers

Beos Filesystem stores small attributes in first inode block automagically read during lookup. Current driver implementation does nothing about it.

Those attributes feature both window manager and user metadata.

-This patch wakes up the small_data dump functionality when mounting in debug mode (iget) -The same is done "for real" by creating a list_head merged in befs_inode_info. -getfattr -n "attributename" is handled as well to retrieve small attributes
through xattr_handlers.

I hope someone (Andrew, Al ?) can help me improve that feature despite that driver is declared "Orphan" in maintainer list.

Signed off by Fabian Frederick

fs/befs/befs.h +11 -0
index b266428..02eb7ae 100644
@@ -57,6 +57,14 @@ typedef struct befs_sb_info {
 
 } befs_sb_info;
 
+typedef struct befs_small_datamem {
+ u32 type;
+ char name[BEFS_ATTRIBUTE_LEN];
+ char value[BEFS_ATTRIBUTE_VALUE_LEN];
+ struct list_head list;
+
+} befs_small_datamem;
+
 typedef struct befs_inode_info {
  u32 i_flags;
  u32 i_type;
@@ -71,6 +79,7 @@ typedef struct befs_inode_info {
  } i_data;
 
  struct inode vfs_inode;
+ struct befs_small_datamem datamem;
 
 } befs_inode_info;
 
@@ -96,6 +105,8 @@ void befs_dump_super_block(const struct super_block *sb, befs_super_block *);
 void befs_dump_inode(const struct super_block *sb, befs_inode *);
 void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *);
 void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *);
+void befs_dump_small_data(const struct super_block *sb, befs_small_data * sd);
+
 /****************************/
 
 
fs/befs/befs_fs_types.h +2 -0
index eb557d9..47e2ac0 100644
@@ -26,6 +26,8 @@
 
 #define BEFS_NAME_LEN 255
 
+#define BEFS_ATTRIBUTE_LEN 255
+#define BEFS_ATTRIBUTE_VALUE_LEN 1024
 #define BEFS_SYMLINK_LEN 144
 #define BEFS_NUM_DIRECT_BLOCKS 12
 #define B_OS_NAME_LENGTH 32
fs/befs/debug.c +27 -2
index 622e737..d23dda2 100644
@@ -222,13 +222,38 @@ befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
 #endif //CONFIG_BEFS_DEBUG
 }
 
-#if 0
-/* unused */
 void
 befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)
 {
+#ifdef CONFIG_BEFS_DEBUG
+
+ char *oft, *ioft;
+ ioft=(char*)sd;
+
+ while(1){
+ befs_debug(sb, "befs_small_data information");
+ befs_debug(sb, "   type : %x", sd->type);
+ befs_debug(sb, "   name size : %d", sd->name_size);
+ befs_debug(sb, "   name size : %d", sd->data_size);
+ if(sd->name[0]==0x13)
+ befs_debug(sb, "   name : %d", sd->data_size);
+     else befs_debug(sb, "   name : %s", sd->name);
+ oft=sd->name;
+ while(oft[0])oft++; //eos
+ oft+=3; //padding
+ befs_debug(sb, "   value :%s", oft);
+ oft=oft+(sd->data_size);
+ while(!oft[0])oft++; 
+ sd=(befs_small_data*)oft;
+ befs_debug(sb, "   ioft : %x oft : %x delta : %x", ioft, oft, oft-ioft);
+ if(oft-ioft > sb->s_blocksize-sizeof(befs_inode))
+ break;
+ }
+
+#endif //CONFIG_BEFS_DEBUG
 }
 
+#if 0
 /* unused */
 void
 befs_dump_run(const struct super_block *sb, befs_disk_block_run run)
fs/befs/linuxvfs.c +88 -0

149 lines not on this page · raw message