line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2014, cPanel, Inc. |
2
|
|
|
|
|
|
|
# All rights reserved. |
3
|
|
|
|
|
|
|
# http://cpanel.net/ |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under the same |
6
|
|
|
|
|
|
|
# terms as Perl itself. See the LICENSE file for further details. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Filesys::POSIX::Mem; |
9
|
|
|
|
|
|
|
|
10
|
26
|
|
|
26
|
|
433
|
use strict; |
|
26
|
|
|
|
|
24
|
|
|
26
|
|
|
|
|
522
|
|
11
|
26
|
|
|
26
|
|
64
|
use warnings; |
|
26
|
|
|
|
|
26
|
|
|
26
|
|
|
|
|
460
|
|
12
|
|
|
|
|
|
|
|
13
|
26
|
|
|
26
|
|
6874
|
use Filesys::POSIX::Bits; |
|
26
|
|
|
|
|
37
|
|
|
26
|
|
|
|
|
5779
|
|
14
|
26
|
|
|
26
|
|
8899
|
use Filesys::POSIX::Mem::Inode (); |
|
26
|
|
|
|
|
52
|
|
|
26
|
|
|
|
|
2773
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Filesys::POSIX::Mem - Filesystem whose logical structure resides solely in |
19
|
|
|
|
|
|
|
program memory |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
C provides a filesystem whose structure and, to a large |
24
|
|
|
|
|
|
|
extent, contents of regular files, exist solely in program memory as Perl data |
25
|
|
|
|
|
|
|
structures and string buffers. Regular file data up to a certain size can exist |
26
|
|
|
|
|
|
|
entirely in memory; files exceeding that size are dumped to temporary files |
27
|
|
|
|
|
|
|
backed by L. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 MOUNT OPTIONS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item C |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Allows one to specify the directory in which temporary bucket files which back |
36
|
|
|
|
|
|
|
regular file data are to be created and kept. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item C |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Specifies the maximum size, in bytes, of a regular file as it is kept in memory |
41
|
|
|
|
|
|
|
before being flushed to a bucket file in disk. The default value is, as per |
42
|
|
|
|
|
|
|
L, C<16384> bytes. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=back |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
42
|
|
|
42
|
0
|
1070002
|
my ($class) = @_; |
50
|
42
|
|
|
|
|
83
|
my $fs = bless {}, $class; |
51
|
|
|
|
|
|
|
|
52
|
42
|
|
|
|
|
212
|
$fs->{'root'} = Filesys::POSIX::Mem::Inode->new( |
53
|
|
|
|
|
|
|
'mode' => $S_IFDIR | 0755, |
54
|
|
|
|
|
|
|
'dev' => $fs |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
42
|
|
|
|
|
178
|
return $fs; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub init { |
61
|
39
|
|
|
39
|
0
|
55
|
my ( $self, %flags ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
39
|
|
|
|
|
59
|
$self->{'flags'} = \%flags; |
64
|
|
|
|
|
|
|
|
65
|
39
|
|
|
|
|
115
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item L |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
C implementation of the inode construct. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item L |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
C implementation of file handles associated with regular |
79
|
|
|
|
|
|
|
file data. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
C implementation of directory iterable directory structures |
84
|
|
|
|
|
|
|
as defined by the L interface. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |