line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# PurePerl implementation glue to '/usr/sbin/lfs' |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# (C) 2010 Adrian Ulrich - |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
7
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Lustre::LFS::Dir; |
12
|
1
|
|
|
1
|
|
4001
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
13
|
1
|
|
|
1
|
|
6
|
use Lustre::LFS; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
14
|
1
|
|
|
1
|
|
6
|
use IO::File; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
167
|
|
15
|
1
|
|
|
1
|
|
6
|
use base 'IO::File'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
412
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
######################################################################## |
19
|
|
|
|
|
|
|
# Return stripe information for opened file |
20
|
|
|
|
|
|
|
sub get_stripe { |
21
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
22
|
0
|
|
|
|
|
|
return Lustre::LFS::_parse_get_stripe_dir($self); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
######################################################################## |
26
|
|
|
|
|
|
|
# Set stripe information for current folder |
27
|
|
|
|
|
|
|
sub set_stripe { |
28
|
0
|
|
|
0
|
1
|
|
my($self, %args) = @_; |
29
|
0
|
|
|
|
|
|
my $fname = Lustre::LFS::_lfs_get_path($self); |
30
|
0
|
|
|
|
|
|
my $ssize = delete($args{Size}); |
31
|
0
|
|
|
|
|
|
my $soff = delete($args{Offset}); |
32
|
0
|
|
|
|
|
|
my $scount= delete($args{Count}); |
33
|
0
|
|
|
|
|
|
my $spool = delete($args{Pool}); |
34
|
0
|
|
|
|
|
|
my @arglist = ("setstripe"); |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
return $fname unless defined $fname; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
push(@arglist, "--size" , int($ssize)) if defined $ssize; |
39
|
0
|
0
|
|
|
|
|
push(@arglist, "--offset", int($soff)) if defined $soff; |
40
|
0
|
0
|
|
|
|
|
push(@arglist, "--count" , int($scount)) if defined $scount; |
41
|
0
|
0
|
|
|
|
|
push(@arglist, "--pool" , $spool) if defined $spool; |
42
|
0
|
|
|
|
|
|
push(@arglist, "--" , $fname); |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
return ( Lustre::LFS::_lfs_system(@arglist) ? 0 : 1 ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
######################################################################## |
49
|
|
|
|
|
|
|
# Remove stripe |
50
|
|
|
|
|
|
|
sub delete_stripe { |
51
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
52
|
0
|
|
|
|
|
|
my $path = Lustre::LFS::_lfs_get_path($self); |
53
|
0
|
0
|
|
|
|
|
return $path unless defined $path; |
54
|
0
|
0
|
|
|
|
|
return ( Lustre::LFS::_lfs_system("setstripe", "-d", "--", $path) ? 0 : 1); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |