patch-2.4.9 linux/fs/isofs/rock.c

Next file: linux/fs/jffs/inode-v23.c
Previous file: linux/fs/isofs/joliet.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.8/linux/fs/isofs/rock.c linux/fs/isofs/rock.c
@@ -31,8 +31,8 @@
    use fields that is compatible with Rock Ridge */
 #define CHECK_SP(FAIL)	       			\
       if(rr->u.SP.magic[0] != 0xbe) FAIL;	\
-      if(rr->u.SP.magic[1] != 0xef) FAIL;
-
+      if(rr->u.SP.magic[1] != 0xef) FAIL;       \
+      inode->i_sb->u.isofs_sb.s_rock_offset=rr->u.SP.skip;
 /* We define a series of macros because each function must do exactly the
    same thing in certain places.  We use the macros to ensure that everything
    is done correctly */
@@ -50,7 +50,14 @@
   {LEN= sizeof(struct iso_directory_record) + DE->name_len[0];	\
   if(LEN & 1) LEN++;						\
   CHR = ((unsigned char *) DE) + LEN;				\
-  LEN = *((unsigned char *) DE) - LEN;}
+  LEN = *((unsigned char *) DE) - LEN;                          \
+  if (inode->i_sb->u.isofs_sb.s_rock_offset!=-1)                \
+  {                                                             \
+     LEN-=inode->i_sb->u.isofs_sb.s_rock_offset;                \
+     CHR+=inode->i_sb->u.isofs_sb.s_rock_offset;                \
+     if (LEN<0) LEN=0;                                          \
+  }                                                             \
+}                                     
 
 #define MAYBE_CONTINUE(LABEL,DEV) \
   {if (buffer) kfree(buffer); \
@@ -220,8 +227,8 @@
   return 0;
 }
 
-int parse_rock_ridge_inode(struct iso_directory_record * de,
-			   struct inode * inode){
+int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
+			            struct inode * inode,int regard_xa){
   int len;
   unsigned char * chr;
   int symlink_len = 0;
@@ -230,6 +237,13 @@
   if (!inode->i_sb->u.isofs_sb.s_rock) return 0;
 
   SETUP_ROCK_RIDGE(de, chr, len);
+  if (regard_xa)
+   {
+     chr+=14;
+     len-=14;
+     if (len<0) len=0;
+   };
+   
  repeat:
   {
     int cnt, sig;
@@ -416,7 +430,7 @@
 			 * If there is another SL record, and this component
 			 * record isn't continued, then add a slash.
 			 */
-			if ((rr->u.SL.flags & 1) && !(oldslp->flags & 1))
+			if ((!rootflag) && (rr->u.SL.flags & 1) && !(oldslp->flags & 1))
 				*rpnt++='/';
 			break;
 		}
@@ -431,6 +445,20 @@
 	return rpnt;
 }
 
+int parse_rock_ridge_inode(struct iso_directory_record * de,
+			   struct inode * inode)
+{
+   int result=parse_rock_ridge_inode_internal(de,inode,0);
+   /* if rockridge flag was reset and we didn't look for attributes
+    * behind eventual XA attributes, have a look there */
+   if ((inode->i_sb->u.isofs_sb.s_rock_offset==-1)
+       &&(inode->i_sb->u.isofs_sb.s_rock==2))
+     {
+	printk(KERN_DEBUG"scanning for RockRidge behind XA attributes\n");
+	result=parse_rock_ridge_inode_internal(de,inode,14);
+     };
+   return result;
+};
 
 /* readpage() for symlinks: reads symlink contents into the page and either
    makes it uptodate and returns 0 or returns error (-EIO) */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)