?? device.pm
字號:
# This file was automatically generated by SWIG (http://www.swig.org).# Version 1.3.31## Don't modify this file, modify the SWIG interface instead.package Amanda::Device;require Exporter;require DynaLoader;@ISA = qw(Exporter DynaLoader);require Amanda::Types;package Amanda::Devicec;bootstrap Amanda::Device;package Amanda::Device;@EXPORT = qw( );# ---------- BASE METHODS -------------package Amanda::Device;sub TIEHASH { my ($classname,$obj) = @_; return bless $obj, $classname;}sub CLEAR { }sub FIRSTKEY { }sub NEXTKEY { }sub FETCH { my ($self,$field) = @_; my $member_func = "swig_${field}_get"; $self->$member_func();}sub STORE { my ($self,$field,$newval) = @_; my $member_func = "swig_${field}_set"; $self->$member_func($newval);}sub this { my $ptr = shift; return tied(%$ptr);}# ------- FUNCTION WRAPPERS --------package Amanda::Device;*IS_WRITABLE_ACCESS_MODE = *Amanda::Devicec::IS_WRITABLE_ACCESS_MODE;*feature_support_flags_is_valid = *Amanda::Devicec::feature_support_flags_is_valid;############# Class : Amanda::Device::Device ##############package Amanda::Device::Device;use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);@ISA = qw( Amanda::Device );%OWNER = ();%ITERATORS = ();*swig_file_get = *Amanda::Devicec::Device_file_get;*swig_file_set = *Amanda::Devicec::Device_file_set;*swig_block_get = *Amanda::Devicec::Device_block_get;*swig_block_set = *Amanda::Devicec::Device_block_set;*swig_in_file_get = *Amanda::Devicec::Device_in_file_get;*swig_in_file_set = *Amanda::Devicec::Device_in_file_set;*swig_device_name_get = *Amanda::Devicec::Device_device_name_get;*swig_device_name_set = *Amanda::Devicec::Device_device_name_set;*swig_access_mode_get = *Amanda::Devicec::Device_access_mode_get;*swig_access_mode_set = *Amanda::Devicec::Device_access_mode_set;*swig_is_eof_get = *Amanda::Devicec::Device_is_eof_get;*swig_is_eof_set = *Amanda::Devicec::Device_is_eof_set;*swig_volume_label_get = *Amanda::Devicec::Device_volume_label_get;*swig_volume_label_set = *Amanda::Devicec::Device_volume_label_set;*swig_volume_time_get = *Amanda::Devicec::Device_volume_time_get;*swig_volume_time_set = *Amanda::Devicec::Device_volume_time_set;sub new { my $pkg = shift; my $self = Amanda::Devicec::new_Device(@_); bless $self, $pkg if defined($self);}sub DESTROY { return unless $_[0]->isa('HASH'); my $self = tied(%{$_[0]}); return unless defined $self; delete $ITERATORS{$self}; if (exists $OWNER{$self}) { Amanda::Devicec::delete_Device($self); delete $OWNER{$self}; }}*read_label = *Amanda::Devicec::Device_read_label;*start = *Amanda::Devicec::Device_start;*finish = *Amanda::Devicec::Device_finish;*start_file = *Amanda::Devicec::Device_start_file;*write_min_size = *Amanda::Devicec::Device_write_min_size;*write_max_size = *Amanda::Devicec::Device_write_max_size;*read_max_size = *Amanda::Devicec::Device_read_max_size;*write_block = *Amanda::Devicec::Device_write_block;*write_from_fd = *Amanda::Devicec::Device_write_from_fd;*finish_file = *Amanda::Devicec::Device_finish_file;*seek_file = *Amanda::Devicec::Device_seek_file;*seek_block = *Amanda::Devicec::Device_seek_block;*read_block = *Amanda::Devicec::Device_read_block;*read_to_fd = *Amanda::Devicec::Device_read_to_fd;*property_list = *Amanda::Devicec::Device_property_list;*property_get = *Amanda::Devicec::Device_property_get;*property_set = *Amanda::Devicec::Device_property_set;*recycle_file = *Amanda::Devicec::Device_recycle_file;*set_startup_properties_from_config = *Amanda::Devicec::Device_set_startup_properties_from_config;sub DISOWN { my $self = shift; my $ptr = tied(%$self); delete $OWNER{$ptr};}sub ACQUIRE { my $self = shift; my $ptr = tied(%$self); $OWNER{$ptr} = 1;}# ------- VARIABLE STUBS --------package Amanda::Device;*ACCESS_NULL = *Amanda::Devicec::ACCESS_NULL;*ACCESS_READ = *Amanda::Devicec::ACCESS_READ;*ACCESS_WRITE = *Amanda::Devicec::ACCESS_WRITE;*ACCESS_APPEND = *Amanda::Devicec::ACCESS_APPEND;*READ_LABEL_STATUS_SUCCESS = *Amanda::Devicec::READ_LABEL_STATUS_SUCCESS;*READ_LABEL_STATUS_DEVICE_MISSING = *Amanda::Devicec::READ_LABEL_STATUS_DEVICE_MISSING;*READ_LABEL_STATUS_DEVICE_ERROR = *Amanda::Devicec::READ_LABEL_STATUS_DEVICE_ERROR;*READ_LABEL_STATUS_VOLUME_MISSING = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_MISSING;*READ_LABEL_STATUS_VOLUME_UNLABELED = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_UNLABELED;*READ_LABEL_STATUS_VOLUME_ERROR = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_ERROR;*READ_LABEL_STATUS_FLAGS_MAX = *Amanda::Devicec::READ_LABEL_STATUS_FLAGS_MAX;*PROPERTY_PHASE_BEFORE_START = *Amanda::Devicec::PROPERTY_PHASE_BEFORE_START;*PROPERTY_PHASE_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_BETWEEN_FILE_WRITE;*PROPERTY_PHASE_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_INSIDE_FILE_WRITE;*PROPERTY_PHASE_BETWEEN_FILE_READ = *Amanda::Devicec::PROPERTY_PHASE_BETWEEN_FILE_READ;*PROPERTY_PHASE_INSIDE_FILE_READ = *Amanda::Devicec::PROPERTY_PHASE_INSIDE_FILE_READ;*PROPERTY_PHASE_MAX = *Amanda::Devicec::PROPERTY_PHASE_MAX;*PROPERTY_PHASE_MASK = *Amanda::Devicec::PROPERTY_PHASE_MASK;*PROPERTY_PHASE_SHIFT = *Amanda::Devicec::PROPERTY_PHASE_SHIFT;*PROPERTY_ACCESS_GET_BEFORE_START = *Amanda::Devicec::PROPERTY_ACCESS_GET_BEFORE_START;*PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE;*PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE;*PROPERTY_ACCESS_GET_BETWEEN_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_GET_BETWEEN_FILE_READ;*PROPERTY_ACCESS_GET_INSIDE_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_GET_INSIDE_FILE_READ;*PROPERTY_ACCESS_SET_BEFORE_START = *Amanda::Devicec::PROPERTY_ACCESS_SET_BEFORE_START;*PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE;*PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE;*PROPERTY_ACCESS_SET_BETWEEN_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_SET_BETWEEN_FILE_READ;*PROPERTY_ACCESS_SET_INSIDE_FILE_READ = *Amanda::Devicec::PROPERTY_ACCESS_SET_INSIDE_FILE_READ;*PROPERTY_ACCESS_GET_MASK = *Amanda::Devicec::PROPERTY_ACCESS_GET_MASK;*PROPERTY_ACCESS_SET_MASK = *Amanda::Devicec::PROPERTY_ACCESS_SET_MASK;*CONCURRENCY_PARADIGM_EXCLUSIVE = *Amanda::Devicec::CONCURRENCY_PARADIGM_EXCLUSIVE;*CONCURRENCY_PARADIGM_SHARED_READ = *Amanda::Devicec::CONCURRENCY_PARADIGM_SHARED_READ;*CONCURRENCY_PARADIGM_RANDOM_ACCESS = *Amanda::Devicec::CONCURRENCY_PARADIGM_RANDOM_ACCESS;*STREAMING_REQUIREMENT_NONE = *Amanda::Devicec::STREAMING_REQUIREMENT_NONE;*STREAMING_REQUIREMENT_DESIRED = *Amanda::Devicec::STREAMING_REQUIREMENT_DESIRED;*STREAMING_REQUIREMENT_REQUIRED = *Amanda::Devicec::STREAMING_REQUIREMENT_REQUIRED;*MEDIA_ACCESS_MODE_READ_ONLY = *Amanda::Devicec::MEDIA_ACCESS_MODE_READ_ONLY;*MEDIA_ACCESS_MODE_WORM = *Amanda::Devicec::MEDIA_ACCESS_MODE_WORM;*MEDIA_ACCESS_MODE_READ_WRITE = *Amanda::Devicec::MEDIA_ACCESS_MODE_READ_WRITE;*MEDIA_ACCESS_MODE_WRITE_ONLY = *Amanda::Devicec::MEDIA_ACCESS_MODE_WRITE_ONLY;*SIZE_ACCURACY_UNKNOWN = *Amanda::Devicec::SIZE_ACCURACY_UNKNOWN;*SIZE_ACCURACY_ESTIMATE = *Amanda::Devicec::SIZE_ACCURACY_ESTIMATE;*SIZE_ACCURACY_REAL = *Amanda::Devicec::SIZE_ACCURACY_REAL;*FEATURE_STATUS_ENABLED = *Amanda::Devicec::FEATURE_STATUS_ENABLED;*FEATURE_STATUS_DISABLED = *Amanda::Devicec::FEATURE_STATUS_DISABLED;*FEATURE_SURETY_BAD = *Amanda::Devicec::FEATURE_SURETY_BAD;*FEATURE_SURETY_GOOD = *Amanda::Devicec::FEATURE_SURETY_GOOD;*FEATURE_SOURCE_DEFAULT = *Amanda::Devicec::FEATURE_SOURCE_DEFAULT;*FEATURE_SOURCE_DETECTED = *Amanda::Devicec::FEATURE_SOURCE_DETECTED;*FEATURE_SOURCE_USER = *Amanda::Devicec::FEATURE_SOURCE_USER;*FEATURE_SUPPORT_FLAGS_MAX = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_MAX;*FEATURE_SUPPORT_FLAGS_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_MASK;*FEATURE_SUPPORT_FLAGS_STATUS_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_STATUS_MASK;*FEATURE_SUPPORT_FLAGS_SURETY_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_SURETY_MASK;*FEATURE_SUPPORT_FLAGS_SOURCE_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_SOURCE_MASK;@EXPORT_OK = ();%EXPORT_TAGS = ();=head1 NAMEAmanda::Device - interact with Amanda data-storage devices=head1 SYNOPSIS use Amanda::Device qw( :constants ); my $dev = Amanda::Device->new($device_name); $dev->set_startup_properties_from_config(); if ($dev->read_label() == $READ_LABEL_STATUS_SUCCESS) { print "Label on $device_name is '$dev->volume_label'\n"; } See L<http://wiki.zmanda.com/index.php/Device_API> for details on how Devices are used.=head1 API STATUSStable=head1 Amanda::Device Objects=head2 Instance Variables=over=item C<$file>=item C<$block>=item C<$in_file>=item C<$device_name>=item C<$access_mode>=item C<$is_eof>=item C<$volume_label>=item C<$volume_time>=back=head2 MethodsSee the wiki for descriptions of these functions=over=item C<read_label()>=item C<start($mode, $label, $timestamp)>=item C<finish()>=item C<start_file($jobinfo)>where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Datatypes)=item C<write_min_size()>=item C<write_max_size()>=item C<read_max_size()>=item C<write_block($size, $data, $short_block)>Note that Perl code is not expected to handle on-device data, so thereis currently no way to provide data to this function from Perl. This maychange in future revisions.=item C<write_from_fd($fd)>where C<$fd> is an integer file descriptor, not a filehandle=item C<finish_file()>=item C<seek_file($file)>=item C<seek_block($block)>=item C<read_block($size)>=item C<read_to_fd($fd)>where C<$fd> is an integer file descriptor, not a filehandleNote that Perl code is not expected to handle on-device data, so thereis currently no way to access the data this function returns. This maychange in future revisions.=item C<property_list()>returns a list of property names.=item C<property_get($property_name)>returns the property as the appropriate Perl type.=item C<property_set($property_name, $value)>where $value is of an appropriate type for the given property=item C<recycle_file($filenum)>=item C<set_startup_properties_from_config()>=back=head1 CONSTANTSThis module defines a large number of constants. Again, consult thewiki or C<device.h> for the details on their meaning. These constantsare available from the package namespace (e.g.,C<Amanda::Device::ACCESS_WRITE>), of imported with the C<:constant>import tag.=cutpush @EXPORT_OK, qw(DeviceAccessMode_to_strings);push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw(DeviceAccessMode_to_strings);my %_DeviceAccessMode_VALUES;#Convert a flag value to a list of names for flags that are set.sub DeviceAccessMode_to_strings { my ($flags) = @_; my @result = (); for my $k (keys %_DeviceAccessMode_VALUES) { my $v = $_DeviceAccessMode_VALUES{$k}; #is this a matching flag? if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) { push @result, $k; } }#by default, just return the number as a 1-element list if (!@result) { return ($flags); } return @result;}push @EXPORT_OK, qw($ACCESS_NULL);push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_NULL);$_DeviceAccessMode_VALUES{"NULL"} = $ACCESS_NULL;push @EXPORT_OK, qw($ACCESS_READ);push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_READ);$_DeviceAccessMode_VALUES{"READ"} = $ACCESS_READ;push @EXPORT_OK, qw($ACCESS_WRITE);push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_WRITE);$_DeviceAccessMode_VALUES{"WRITE"} = $ACCESS_WRITE;push @EXPORT_OK, qw($ACCESS_APPEND);push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw($ACCESS_APPEND);$_DeviceAccessMode_VALUES{"APPEND"} = $ACCESS_APPEND;push @EXPORT_OK, qw(IS_WRITABLE_ACCESS_MODE);push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw(IS_WRITABLE_ACCESS_MODE);#copy symbols in DeviceAccessMode to constantspush @{$EXPORT_TAGS{"constants"}}, @{$EXPORT_TAGS{"DeviceAccessMode"}};push @EXPORT_OK, qw(ReadLabelStatusFlags_to_strings);push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw(ReadLabelStatusFlags_to_strings);my %_ReadLabelStatusFlags_VALUES;#Convert a flag value to a list of names for flags that are set.sub ReadLabelStatusFlags_to_strings { my ($flags) = @_; my @result = (); for my $k (keys %_ReadLabelStatusFlags_VALUES) { my $v = $_ReadLabelStatusFlags_VALUES{$k}; #is this a matching flag? if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) { push @result, $k; } }#by default, just return the number as a 1-element list if (!@result) { return ($flags); } return @result;}push @EXPORT_OK, qw($READ_LABEL_STATUS_SUCCESS);push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_SUCCESS);$_ReadLabelStatusFlags_VALUES{"SUCCESS"} = $READ_LABEL_STATUS_SUCCESS;push @EXPORT_OK, qw($READ_LABEL_STATUS_DEVICE_MISSING);push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_DEVICE_MISSING);$_ReadLabelStatusFlags_VALUES{"DEVICE_MISSING"} = $READ_LABEL_STATUS_DEVICE_MISSING;push @EXPORT_OK, qw($READ_LABEL_STATUS_DEVICE_ERROR);push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_DEVICE_ERROR);$_ReadLabelStatusFlags_VALUES{"DEVICE_ERROR"} = $READ_LABEL_STATUS_DEVICE_ERROR;push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_MISSING);push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_MISSING);$_ReadLabelStatusFlags_VALUES{"VOLUME_MISSING"} = $READ_LABEL_STATUS_VOLUME_MISSING;push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_UNLABELED);push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_UNLABELED);$_ReadLabelStatusFlags_VALUES{"VOLUME_UNLABELED"} = $READ_LABEL_STATUS_VOLUME_UNLABELED;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -