pub struct FxFile { /* private fields */ }Expand description
FxFile represents an open connection to a file.
Implementations§
Source§impl FxFile
impl FxFile
Sourcepub fn new(handle: DataObjectHandle<FxVolume>) -> Arc<Self>
pub fn new(handle: DataObjectHandle<FxVolume>) -> Arc<Self>
Creates a new regular FxFile.
Sourcepub async fn create_connection_async(
this: OpenedNode<FxFile>,
scope: ExecutionScope,
flags: impl ProtocolsExt,
object_request: ObjectRequestRef<'_>,
) -> Result<(), Status>
pub async fn create_connection_async( this: OpenedNode<FxFile>, scope: ExecutionScope, flags: impl ProtocolsExt, object_request: ObjectRequestRef<'_>, ) -> Result<(), Status>
Creates a new connection on the given scope. May take a read lock on the object.
Sourcepub fn open_as_temporary(self: Arc<Self>) -> OpenedNode<dyn FxNode>
pub fn open_as_temporary(self: Arc<Self>) -> OpenedNode<dyn FxNode>
Open the file as a temporary. The file must have just been created with no other open counts.
Sourcepub fn mark_as_permanent(&self)
pub fn mark_as_permanent(&self)
Mark the state as permanent (to be used when the file is currently marked as temporary).
pub fn is_verified_file(&self) -> bool
pub fn handle(&self) -> &PagedObjectHandle
Sourcepub fn into_opened_node(self: Arc<Self>) -> Option<OpenedNode<FxFile>>
pub fn into_opened_node(self: Arc<Self>) -> Option<OpenedNode<FxFile>>
If this instance has not been marked to be purged, returns an OpenedNode instance. If marked for purging, returns None.
Sourcepub async fn flush(
this: &OpenedNode<FxFile>,
last_chance: bool,
) -> Result<(), Error>
pub async fn flush( this: &OpenedNode<FxFile>, last_chance: bool, ) -> Result<(), Error>
Persists any unflushed data to disk.
Flush may be triggered as a background task so this requires an OpenedNode to
ensure that we don’t accidentally try to flush a file handle that is in the process of
being removed. (See use of cache in FxVolume::flush_all_files.)
pub fn get_block_size(&self) -> u64
pub async fn is_allocated( &self, start_offset: u64, ) -> Result<(bool, u64), Status>
pub async fn write_at_uncached( &self, offset: u64, content: &[u8], ) -> Result<u64, Status>
pub async fn read_at_uncached( &self, offset: u64, buffer: &mut [u8], ) -> Result<u64, Status>
pub fn get_size_uncached(&self) -> u64
Sourcepub fn force_clean(&self)
pub fn force_clean(&self)
Forcibly marks the file as clean.
Trait Implementations§
Source§impl File for FxFile
impl File for FxFile
fn writable(&self) -> bool
Source§async fn open_file(&self, _options: &FileOptions) -> Result<(), Status>
async fn open_file(&self, _options: &FileOptions) -> Result<(), Status>
fidl_fuchsia_io.Node/Open.
The following flags are handled by the connection and do not need to be handled inside
open(): Read moreSource§async fn truncate(&self, length: u64) -> Result<(), Status>
async fn truncate(&self, length: u64) -> Result<(), Status>
length.
If there are pending attributes to update (see update_attributes), they should also be
flushed at this time. Otherwise, no attributes should be updated, other than size as needed.Source§async fn enable_verity(
&self,
options: VerificationOptions,
) -> Result<(), Status>
async fn enable_verity( &self, options: VerificationOptions, ) -> Result<(), Status>
Source§async fn get_backing_memory(&self, flags: VmoFlags) -> Result<Vmo, Status>
async fn get_backing_memory(&self, flags: VmoFlags) -> Result<Vmo, Status>
Source§async fn get_size(&self) -> Result<u64, Status>
async fn get_size(&self) -> Result<u64, Status>
Source§async fn update_attributes(
&self,
attributes: MutableNodeAttributes,
) -> Result<(), Status>
async fn update_attributes( &self, attributes: MutableNodeAttributes, ) -> Result<(), Status>
attributes. If the file
does not support updating all of the specified attributes, implementations should fail
with ZX_ERR_NOT_SUPPORTED.Source§async fn allocate(
&self,
offset: u64,
length: u64,
_mode: AllocateMode,
) -> Result<(), Status>
async fn allocate( &self, offset: u64, length: u64, _mode: AllocateMode, ) -> Result<(), Status>
Source§async fn sync(&self, mode: SyncMode) -> Result<(), Status>
async fn sync(&self, mode: SyncMode) -> Result<(), Status>
fn executable(&self) -> bool
Source§impl FxNode for FxFile
impl FxNode for FxFile
fn object_id(&self) -> u64
fn parent(&self) -> Option<Arc<FxDirectory>>
fn set_parent(&self, _parent: Arc<FxDirectory>)
fn open_count_add_one(&self)
Source§fn open_count_sub_one(self: Arc<Self>)
fn open_count_sub_one(self: Arc<Self>)
fn object_descriptor(&self) -> ObjectDescriptor
Source§fn terminate(&self)
fn terminate(&self)
Source§fn mark_to_be_purged(&self)
fn mark_to_be_purged(&self)
Source§impl GetEntryInfo for FxFile
impl GetEntryInfo for FxFile
Source§fn entry_info(&self) -> EntryInfo
fn entry_info(&self) -> EntryInfo
Source§impl Node for FxFile
impl Node for FxFile
Source§async fn get_attributes(
&self,
requested_attributes: NodeAttributesQuery,
) -> Result<NodeAttributes2, Status>
async fn get_attributes( &self, requested_attributes: NodeAttributesQuery, ) -> Result<NodeAttributes2, Status>
Source§fn will_clone(&self)
fn will_clone(&self)
will_clone will be accompanied by an eventual call to close.async fn link_into( self: Arc<Self>, destination_dir: Arc<dyn MutableDirectory>, name: Name, ) -> Result<(), Status>
Source§fn query_filesystem(&self) -> Result<FilesystemInfo, Status>
fn query_filesystem(&self) -> Result<FilesystemInfo, Status>
Source§async fn list_extended_attributes(&self) -> Result<Vec<Vec<u8>>, Status>
async fn list_extended_attributes(&self) -> Result<Vec<Vec<u8>>, Status>
Source§async fn get_extended_attribute(&self, name: Vec<u8>) -> Result<Vec<u8>, Status>
async fn get_extended_attribute(&self, name: Vec<u8>) -> Result<Vec<u8>, Status>
Source§async fn set_extended_attribute(
&self,
name: Vec<u8>,
value: Vec<u8>,
mode: SetExtendedAttributeMode,
) -> Result<(), Status>
async fn set_extended_attribute( &self, name: Vec<u8>, value: Vec<u8>, mode: SetExtendedAttributeMode, ) -> Result<(), Status>
Source§async fn remove_extended_attribute(&self, name: Vec<u8>) -> Result<(), Status>
async fn remove_extended_attribute(&self, name: Vec<u8>) -> Result<(), Status>
Source§fn will_open_as_node(&self) -> Result<(), Status>
fn will_open_as_node(&self) -> Result<(), Status>
Source§fn open_as_node(
self: Arc<Self>,
scope: ExecutionScope,
options: NodeOptions,
object_request: &mut ObjectRequest,
) -> Result<(), Status>where
Self: Sized,
fn open_as_node(
self: Arc<Self>,
scope: ExecutionScope,
options: NodeOptions,
object_request: &mut ObjectRequest,
) -> Result<(), Status>where
Self: Sized,
Source§impl PagerBacked for FxFile
impl PagerBacked for FxFile
Source§fn pager_packet_receiver_registration(
&self,
) -> &PagerPacketReceiverRegistration<Self>
fn pager_packet_receiver_registration( &self, ) -> &PagerPacketReceiverRegistration<Self>
Pager::create_vmo.Source§fn vmo(&self) -> &Vmo
fn vmo(&self) -> &Vmo
Pager::create_vmo.Source§fn page_in(self: Arc<Self>, range: PageInRange<Self>)
fn page_in(self: Arc<Self>, range: PageInRange<Self>)
ZX_PAGER_VMO_READ packet is received for the VMO. The
implementation must respond by calling either PageInRange::supply_pages or
PageInRange::report_failure.Source§fn mark_dirty(self: Arc<Self>, range: MarkDirtyRange<Self>)
fn mark_dirty(self: Arc<Self>, range: MarkDirtyRange<Self>)
ZX_PAGER_VMO_DIRTY packet is received for the VMO. The
implementation must respond by calling either MarkDirtyRange::dirty_pages or
MarkDirtyRange::report_failure.Source§fn on_zero_children(self: Arc<Self>)
fn on_zero_children(self: Arc<Self>)
Source§fn byte_size(&self) -> u64
fn byte_size(&self) -> u64
Source§async fn aligned_read(&self, range: Range<u64>) -> Result<Buffer<'_>, Error>
async fn aligned_read(&self, range: Range<u64>) -> Result<Buffer<'_>, Error>
default_page_in and aligned_byte_range will always be aligned to the read_ahead_size
past to default_page_in unless that would extend beyond self.byte_size(), in which case,
aligned_byte_range will end at self.byte_size()’s next page multiple. The returned
buffer must be at least as large as the requested range. Only the requested range will be
supplied to the pager.Source§impl ToWeakNode for FxFile
impl ToWeakNode for FxFile
fn to_weak_node(self: Arc<Self>) -> WeakNode
Auto Trait Implementations§
impl !Freeze for FxFile
impl !RefUnwindSafe for FxFile
impl Send for FxFile
impl Sync for FxFile
impl Unpin for FxFile
impl UnsafeUnpin for FxFile
impl !UnwindSafe for FxFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more