On 22.02.2007 [16:15:43 -0800], Nishanth Aravamudan wrote:
> On 23.02.2007 [10:50:27 +1100], David Gibson wrote:
> > On Thu, Feb 22, 2007 at 02:59:36PM -0600, Steve Fox wrote:
> > > On Thu, 2007-02-22 at 13:17 -0600, Adam Litke wrote:
> > > > I don't think this is the right way to structure the data. There is one
> > > > to many relationship for ehdr->segment, but you are creating space to
> > > > store an ehdr pointer for each segment in the seg array.
> > >
> > > Yes. I thought about that, but thought that was what David was asking
> > > for anyway. I had a cleaner version, but it wasn't working on x86 and
> > > x86_64 .xB for some reason.
> >
> > Ah, no, I think you misunderstood. Nack on that first patch.
> >
> > > I've looked at it again and found a much nicer way to do this. Nish did
> > > the same thing too, but he added some extra clean-ups, so I've asked him
> > > to post his version instead.
> >
> > Yes, that looks much more like what I had in mind, moving
> > get_extracopy() to parse_pdrs(). Incidentally, now tgat parse_phdrs()
> > does that, it's actually doing more than just examining the program
> > headers, so possibly we should rename it parse_elf() or something.
>
> Yep, ISTR after doing my patch that there are a handful of other renames
> I'd like to do, as well. I'll see what they are throw out a patch soon.
Author: Nishanth Aravamudan <[EMAIL PROTECTED]>
Date: Thu Feb 22 17:05:46 2007 -0800
elflink: rename a seg_info member and a function
In struct seg_info, the phdr member is actually the number of the
program header. Make this clearer by renaming the member to num. Also,
rename parse_phdrs() to parse_elf() to indicate its new, extended
functionality.
Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
diff --git a/elflink.c b/elflink.c
index 6399b9f..59496b8 100644
--- a/elflink.c
+++ b/elflink.c
@@ -190,7 +190,7 @@ struct seg_info {
unsigned long filesz, memsz, extrasz;
int prot;
int fd;
- int phdr;
+ int num;
};
static struct seg_info htlb_seg_table[MAX_HTLB_SEGS];
@@ -348,7 +348,7 @@ static int get_shared_file_name(struct seg_info
*htlb_seg_info, char *file_path)
}
assemble_path(file_path, "%s/%s_%zd_%d", share_path, binary2,
- sizeof(unsigned long) * 8, htlb_seg_info->phdr);
+ sizeof(unsigned long) * 8, htlb_seg_info->num);
return 0;
}
@@ -522,7 +522,7 @@ bail2:
* Parse an ELF header and record segment information for any segments
* which contain hugetlb information.
*/
-static void parse_phdrs(Elf_Ehdr *ehdr)
+static void parse_elf(Elf_Ehdr *ehdr)
{
Elf_Phdr *phdr = (Elf_Phdr *)((char *)ehdr + ehdr->e_phoff);
int i;
@@ -563,7 +563,7 @@ static void parse_phdrs(Elf_Ehdr *ehdr)
htlb_seg_table[htlb_num_segs].filesz = filesz;
htlb_seg_table[htlb_num_segs].memsz = memsz;
htlb_seg_table[htlb_num_segs].prot = prot;
- htlb_seg_table[htlb_num_segs].phdr = i;
+ htlb_seg_table[htlb_num_segs].num = i;
get_extracopy(&htlb_seg_table[htlb_num_segs], phdr,
ehdr->e_phnum);
htlb_num_segs++;
@@ -948,7 +948,7 @@ static void __attribute__ ((constructor))
setup_elflink(void)
if (check_env())
return;
- parse_phdrs(ehdr);
+ parse_elf(ehdr);
if (htlb_num_segs == 0) {
DEBUG("Executable is not linked for hugepage segments\n");
--
Nishanth Aravamudan <[EMAIL PROTECTED]>
IBM Linux Technology Center
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel