[syslinux:pathbased] pathbased: clean up diskstart address numbers, 256 byte subvols

syslinux-bot for H. Peter Anvin hpa at zytor.com
Wed Jan 13 15:48:08 PST 2010


Commit-ID:  afb1f77428f6900365f5a1892f26979ca765292d
Gitweb:     http://syslinux.zytor.com/commit/afb1f77428f6900365f5a1892f26979ca765292d
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 13 Jan 2010 15:44:38 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 13 Jan 2010 15:44:38 -0800

pathbased: clean up diskstart address numbers, 256 byte subvols

Clean up the uses of hard-coded addresses in diskstart.inc.
Furthermore, the btrfs spec allows 255 characters for a subvolume, so
we might as well allocate that much.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/diskstart.inc |   37 +++++++++++++++++++++----------------
 extlinux/main.c    |    3 ++-
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/core/diskstart.inc b/core/diskstart.inc
index ca627b1..566feed 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -471,7 +471,7 @@ bootsignature	dw kaboom.again-bootsec
 ;  Start of LDLINUX.SYS
 ; ===========================================================================
 
-LDLINUX_SYS equ	0x7e00
+LDLINUX_SYS	equ ($-$$)+TEXT_START
 ldlinux_sys:
 
 syslinux_banner	db 0Dh, 0Ah
@@ -486,6 +486,9 @@ ldlinux_magic	dd LDLINUX_MAGIC
 ; This area is patched by the installer.  It is found by looking for
 ; LDLINUX_MAGIC, plus 8 bytes.
 ;
+SUBVOL_MAX	equ 256
+CURRENTDIR_MAX	equ FILENAME_MAX
+
 patch_area:
 DataSectors	dw 0		; Number of sectors (not including bootsec)
 ADVSectors	dw 0		; Additional sectors for ADVs
@@ -493,12 +496,23 @@ LDLDwords	dd 0		; Total dwords starting at ldlinux_sys,
 CheckSum	dd 0		; Checksum starting at ldlinux_sys
 				; value = LDLINUX_MAGIC - [sum of dwords]
 CurrentDirPtr	dw CurrentDirName-LDLINUX_SYS	; Current directory name string
-CurrentDirLen	dw FILENAME_MAX
-SubvolPtr	dw SubvolName - LDLINUX_SYS
-SubvolLen	dw 64		; Should be enough
-SecPtrOffset	dw SectorPtrs - LDLINUX_SYS
+CurrentDirLen	dw CURRENTDIR_MAX
+SubvolPtr	dw SubvolName-LDLINUX_SYS
+SubvolLen	dw SUBVOL_MAX
+SecPtrOffset	dw SectorPtrs-LDLINUX_SYS
 SecPtrCnt	dw (SectorPtrsEnd - SectorPtrs) >> 2
 
+;
+; Installer pokes the base directory here.  This is in .data16 so it
+; isn't actually located in the first sector.
+;
+%define HAVE_CURRENTDIRNAME
+		section .data16
+		global CurrentDirName, SubvolName
+CurrentDirName	times CURRENTDIR_MAX db 0
+SubvolName	times SUBVOL_MAX db 0
+		section .init
+
 ldlinux_ent:
 ;
 ; Note that some BIOSes are buggy and run the boot sector at 07C0:0000
@@ -540,7 +554,7 @@ BIOSName	resw 1
 ;
 load_rest:
 		lea esi,[SectorPtrs]
-		mov ebx,7C00h+2*SECTOR_SIZE	; Where we start loading
+		mov ebx,TEXT_START+2*SECTOR_SIZE ; Where we start loading
 		mov cx,[DataSectors]
 		dec cx				; Minus this sector
 
@@ -683,7 +697,7 @@ rl_checkpt_off	equ ($-$$)
 ; Sector pointers
 		alignz 4
 MaxInitDataSize	equ 96 << 10
-MaxLMA		equ 0x7c00+SECTOR_SIZE+MaxInitDataSize
+MaxLMA		equ TEXT_START+SECTOR_SIZE+MaxInitDataSize
 SectorPtrs	times MaxInitDataSize >> SECTOR_SHIFT dd 0
 SectorPtrsEnd	equ $
 
@@ -691,15 +705,6 @@ SectorPtrsEnd	equ $
 ;  End of code and data that have to be in the first sector
 ; ----------------------------------------------------------------------------
 
-;
-; Installer pokes the base directory here, needs to be in .text16 so the pointer
-; address can be calculated by the assembler.
-;
-%define HAVE_CURRENTDIRNAME
-		section .data16
-		global CurrentDirName, SubvolName
-CurrentDirName	times FILENAME_MAX db 0
-SubvolName	times 64 db 0
 		section .text16
 all_read:
 ;
diff --git a/extlinux/main.c b/extlinux/main.c
index c29e3b0..b02cfe2 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -140,7 +140,8 @@ static const char short_options[] = "iUuzS:H:rvho:O";
    boot image, the boot sector is from 0~512, the boot image starts at 2K */
 #define BTRFS_EXTLINUX_OFFSET (2*1024)
 #define BTRFS_SUBVOL_OPT "subvol="
-static char subvol[64];
+#define BTRFS_SUBVOL_MAX 256	/* By btrfs specification */
+static char subvol[BTRFS_SUBVOL_MAX];
 /*
  * Boot block
  */



More information about the Syslinux-commits mailing list