Add support for symbolic links to Ext23Lib

Some of the boot option file paths used when
booting with OS Loader payload are failing
because the Ext23Lib does not support symbolic
soft links (e.g. ln -s <file> <link>). This
patch adds support for loading the soft link
succesfully.

Signed-off-by: James Gutbub <james.gutbub@intel.com>
This commit is contained in:
James Gutbub 2021-04-14 15:16:11 -07:00 committed by Maurice Ma
parent 85826d40f2
commit 10b1685dc5
2 changed files with 8 additions and 6 deletions

View File

@ -735,7 +735,7 @@ Ext2fsOpen (
#ifndef LIBSA_NO_FS_SYMLINK
INODE32 ParentInumber;
INT32 Nlinks;
CHAR8 NameBuf[MAXPATHLEN + 1];
CHAR8 NameBuf[MAX_FILE_PATH_LEN+1];
CHAR8 *Buf;
Nlinks = 0;
@ -871,20 +871,20 @@ Ext2fsOpen (
//
// XXX should handle LARGEFILE
//
INT32 LinkLength;
INT32 Len;
UINTN LinkLength;
UINTN Len;
LinkLength = Fp->DiskInode.Ext2DInodeSize;
Len = AsciiStrLen (Cp);
if (LinkLength + Len > MAXPATHLEN ||
if (LinkLength + Len > MAX_FILE_PATH_LEN ||
++Nlinks > MAXSYMLINKS) {
Status = RETURN_LOAD_ERROR;
goto out;
}
memmove (&NameBuf[LinkLength], Cp, Len + 1);
CopyMem (&NameBuf[LinkLength], Cp, Len + 1);
if (LinkLength < EXT2_MAXSYMLINKLEN) {
CopyMem (NameBuf, Fp->DiskInode.Ext2DInodeBlocks, LinkLength);

View File

@ -93,12 +93,14 @@
#define BBLOCK ((DADDRESS)(0))
#define SBLOCK ((DADDRESS)(BBLOCK + BBSIZE / DEV_BSIZE))
#define MAXSYMLINKS 1
#undef EXT2FS_DEBUG
#undef LIBSA_FS_SINGLECOMPONENT
#define LIBSA_FS_SINGLE_DEVICE
#define LIBSA_FS_SINGLE_FILESYSTEM
#define LIBSA_NO_FS_SYMLINK
#undef LIBSA_NO_FS_SYMLINK
#define LIBSA_NO_TWIDDLE
#undef LIBSA_ENABLE_LS_OP
#define LIBSA_NO_FS_WRITE