List Info

Thread: hard link count for a file




hard link count for a file
country flaguser name
United States
2007-11-06 01:29:45
Is there a way to find hard link count for a file in Java?
(id 
'st_nlink'  in struct stat).

Thanks,
Raghu.

Re: hard link count for a file
country flaguser name
United States
2007-11-06 16:35:43
Raghu Angadi wrote:
> Is there a way to find hard link count for a file in
Java? (id 
> 'st_nlink'  in struct stat).

I think you'd need to exec a shell command and parse the
output.

You could add this to FileUtil.java...

Doug

Re: hard link count for a file
country flaguser name
United States
2007-11-06 16:55:17
 > I think you'd need to exec a shell command and parse
the output.

We might need to invoke this for a lot of blocks at run
time.

The use case is that datanode needs to know if a block is
also linked by 
a back up (after start-dfs.sh -upgrade).

The current use case is when we want to update block
metadata when 
datanode verifies a block (HADOOP-2012). Shell command might
fine for 
this. Later this might be used for appends.

Raghu.

Doug Cutting wrote:
> Raghu Angadi wrote:
>> Is there a way to find hard link count for a file
in Java? (id 
>> 'st_nlink'  in struct stat).
> 
> I think you'd need to exec a shell command and parse
the output.
> 
> You could add this to FileUtil.java...
> 
> Doug


Re: hard link count for a file
country flaguser name
United States
2007-11-07 01:32:18
A Java incubator project 'Java Native Access' looks
promising : 
https://jna.dev.java.net/

Can we include LGPL jar in Hadoop?

 From examples, code for accessing atol() from libc looks
very simple :

https://jna.dev.java.net/source/browse/jna/trunk/jnalib/
src/com/sun/jna/examples/CLibrary.java?rev=7&view=markup


Raghu.

Raghu Angadi wrote:
> 
>  > I think you'd need to exec a shell command and
parse the output.
> 
> We might need to invoke this for a lot of blocks at run
time.
> 
> The use case is that datanode needs to know if a block
is also linked by 
> a back up (after start-dfs.sh -upgrade).
> 
> The current use case is when we want to update block
metadata when 
> datanode verifies a block (HADOOP-2012). Shell command
might fine for 
> this. Later this might be used for appends.
> 
> Raghu.
> 
> Doug Cutting wrote:
>> Raghu Angadi wrote:
>>> Is there a way to find hard link count for a
file in Java? (id 
>>> 'st_nlink'  in struct stat).
>>
>> I think you'd need to exec a shell command and
parse the output.
>>
>> You could add this to FileUtil.java...
>>
>> Doug
> 


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )