On 23.02.2007 [11:29:15 -0600], Adam Litke wrote:
> On Fri, 2007-02-23 at 08:53 -0800, Nishanth Aravamudan wrote:
> > On 23.02.2007 [09:11:55 -0600], Adam Litke wrote:
> > > On Thu, 2007-02-22 at 17:07 -0800, Nishanth Aravamudan wrote:
> > > > 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;
> > > > };
> > >
> > > Urg. I hate structure members with names like 'num'. Num what?
> >
> > It's not num anything. It's the number of the segment the seg_info
> > references. I could make it phnum, but that made it too close to the
> > ehdr variable e_phnum for me.
>
> In parse_phdrs, the current program header number is being assigned to
> it.
Yes, I know. And the current program header number is *not* the current
program header, which is what phdr stands for. Now that we pass around
phdr for get_extracopy()'s use, it simply makes things confusing to have
two variables with the same name (even if one is a member of a struct)
but with two wildly different purposes (and types).
> If you really want to change it, perhaps phdr_num would work. But
> dropping the reference to program header in the name doesn't make it
> better in my opinion.
elflink: rename seg_info member phdr
Rename phdr to phdr_num to indicate it is the number of the program
header in question and not the program header itself. With the new
extracopy parameter, this helps clear up some code.
Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
diff --git a/elflink.c b/elflink.c
index 6399b9f..f71a640 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 phdr_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->phdr_num);
return 0;
}
@@ -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].phdr_num = i;
get_extracopy(&htlb_seg_table[htlb_num_segs], phdr,
ehdr->e_phnum);
htlb_num_segs++;
--
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