<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_pfile</id>
	<title>Kernel: pfile - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_pfile"/>
	<link rel="alternate" type="text/html" href="https://tech-pubs.net/wiki/index.php?title=Kernel:_pfile&amp;action=history"/>
	<updated>2026-04-19T19:40:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://tech-pubs.net/wiki/index.php?title=Kernel:_pfile&amp;diff=474&amp;oldid=prev</id>
		<title>Raion at 23:57, 9 January 2026</title>
		<link rel="alternate" type="text/html" href="https://tech-pubs.net/wiki/index.php?title=Kernel:_pfile&amp;diff=474&amp;oldid=prev"/>
		<updated>2026-01-09T23:57:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:57, 9 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l52&quot;&gt;Line 52:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 52:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Less similar: file offsets in struct file (per-fd), with filedesc table. Vnode ops direct, no behavior descriptors/chaining. No distributed cell concept; clustering separate. Close handling simpler (single decrement).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Less similar: file offsets in struct file (per-fd), with filedesc table. Vnode ops direct, no behavior descriptors/chaining. No distributed cell concept; clustering separate. Close handling simpler (single decrement).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Overall, IRIX&amp;#039;s pfile is unique to its bhv_desc_t behavior system, designed for extensibility and distributed coherence. For replication or porting, focus on exact behavior insertion order and mutex usage. No direct illumos/BSD analog for easy porting; closest is Solaris vnode layering but without pfile separation.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Overall, IRIX&amp;#039;s pfile is unique to its bhv_desc_t behavior system, designed for extensibility and distributed coherence. For replication or porting, focus on exact behavior insertion order and mutex usage. No direct illumos/BSD analog for easy porting; closest is Solaris vnode layering but without pfile separation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category: Kernel Documentation]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
	<entry>
		<id>https://tech-pubs.net/wiki/index.php?title=Kernel:_pfile&amp;diff=458&amp;oldid=prev</id>
		<title>Raion: Created page with &quot;== Overview == The pfile (physical file) object in the IRIX kernel represents per-open-file state beyond the vnode (file system-independent) and vfile (open file description) layers. It primarily manages the current file offset (pf_offset) and associated synchronization (pf_offlock). In single-cell (non-distributed) configurations, the pfile layer directly handles offset and flag operations. In distributed (multi-cell) environments using Cellular IRIX features, higher la...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech-pubs.net/wiki/index.php?title=Kernel:_pfile&amp;diff=458&amp;oldid=prev"/>
		<updated>2026-01-04T03:28:02Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Overview == The pfile (physical file) object in the IRIX kernel represents per-open-file state beyond the vnode (file system-independent) and vfile (open file description) layers. It primarily manages the current file offset (pf_offset) and associated synchronization (pf_offlock). In single-cell (non-distributed) configurations, the pfile layer directly handles offset and flag operations. In distributed (multi-cell) environments using Cellular IRIX features, higher la...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Overview ==&lt;br /&gt;
The pfile (physical file) object in the IRIX kernel represents per-open-file state beyond the vnode (file system-independent) and vfile (open file description) layers. It primarily manages the current file offset (pf_offset) and associated synchronization (pf_offlock). In single-cell (non-distributed) configurations, the pfile layer directly handles offset and flag operations. In distributed (multi-cell) environments using Cellular IRIX features, higher layers (DC - Distributed Coordinator, DS - Distributed Server) take over offset and flag management for coherence across cells.&lt;br /&gt;
The pfile is integrated via the behavior descriptor (bhv_desc_t) mechanism, part of IRIX&amp;#039;s chained vnode/behavior system. This allows stacking behaviors (e.g., pfile on top of filesystem-specific behaviors) on a common vfile_t structure. The pfile behavior is registered through pfile_ops (a vfileops_t table) at position VFILE_POSITION_PFILE.&lt;br /&gt;
== Key Functions ==&lt;br /&gt;
The implementation provides operations for creation, offset management, flag handling, teardown, close, and migration.&lt;br /&gt;
Initialization (pfile_init)&lt;br /&gt;
Allocates a kernel zone (pfile_zone) for efficient pfile_t structures using kmem_zone_init.&lt;br /&gt;
Creation (pfile_create)&lt;br /&gt;
Called on file open: allocates a pfile_t from the zone, initializes offset mutex and sets offset to 0, creates and inserts a bhv_desc_t (pf_bd) into the vfile_t behavior chain at the initial position.&lt;br /&gt;
Migration (pfile_target_migrate)&lt;br /&gt;
Used during distributed target migration (e.g., cell handover): creates a new pfile behavior, inserts it into the chain, and sets a specific offset (preserving position across migration).&lt;br /&gt;
Flag Management (pfile_setflags)&lt;br /&gt;
Locks the vfile_t, modifies open flags (vf_flag) using atomic mask/or operations, unlocks.&lt;br /&gt;
Offset Access (pfile_getoffset / pfile_setoffset)&lt;br /&gt;
Simple unprotected read/write of pf_offset. VFILE_NO_OFFSET is ignored on set.&lt;br /&gt;
Locked Offset Access (pfile_getoffset_locked / pfile_setoffset_locked)&lt;br /&gt;
Optional locking of pf_offlock (cell mutex) around offset operations for distributed safety.&lt;br /&gt;
Teardown (pfile_teardown)&lt;br /&gt;
Destroys offset mutex, removes behavior from chain (if vnode exists), frees pfile_t to zone. Asserts mutex not held.&lt;br /&gt;
Close Handling (pfile_close)&lt;br /&gt;
Called twice per close (first/last): decrements vf_count in vfile_t, returns flags indicating last close.&lt;br /&gt;
== Undocumented or IRIX-Specific Interfaces and Behaviors ==&lt;br /&gt;
Critical Structures&lt;br /&gt;
&lt;br /&gt;
pfile_t (from pfile_private.h):&lt;br /&gt;
off_t pf_offset — current file position.&lt;br /&gt;
mutex_t pf_offlock — mutex protecting offset in distributed mode.&lt;br /&gt;
bhv_desc_t pf_bd — behavior descriptor linking to vfile.&lt;br /&gt;
&lt;br /&gt;
vfileops_t pfile_ops — operations table registered in behavior chain:&lt;br /&gt;
Position: VFILE_POSITION_PFILE&lt;br /&gt;
Functions: setflags, getoffset, setoffset, locked variants, teardown, close.&lt;br /&gt;
&lt;br /&gt;
Integration with vfile_t:&lt;br /&gt;
Contains vf_flag (open flags), vf_count (reference count), vf_bh (behavior chain head).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Distributed vs Single-Cell Behavior&lt;br /&gt;
&lt;br /&gt;
Single-cell: pfile directly manages offset/flags.&lt;br /&gt;
Multi-cell (Cellular IRIX): DC/DS layers override; pfile provides fallback or local cache.&lt;br /&gt;
&lt;br /&gt;
Behavior Chain Mechanics&lt;br /&gt;
Uses bhv_desc_t chaining (bhv_insert_initial, bhv_insert, bhv_remove). Allows dynamic stacking of behaviors (e.g., pfile over XFS/EFS vnode).&lt;br /&gt;
Migration Support&lt;br /&gt;
pfile_target_migrate enables seamless offset preservation during distributed file target changes (rare in standard IRIX, specific to Cellular configurations).&lt;br /&gt;
== Similarities to illumos and BSD libc/kernel Implementations ==&lt;br /&gt;
IRIX file handling differs significantly from modern open-file-description models due to its vnode/behavior layering.&lt;br /&gt;
illumos (Solaris-derived)&lt;br /&gt;
Moderate similarity in layered vnode design (vnode ops, but no direct behavior chaining). File offsets live in struct file (user fd) or uio; no separate pfile-like object. Distributed features (Cluster) use different mechanisms. illumos uses struct cred, zones; no exact pfile equivalent.&lt;br /&gt;
BSD (FreeBSD, etc.)&lt;br /&gt;
Less similar: file offsets in struct file (per-fd), with filedesc table. Vnode ops direct, no behavior descriptors/chaining. No distributed cell concept; clustering separate. Close handling simpler (single decrement).&lt;br /&gt;
Overall, IRIX&amp;#039;s pfile is unique to its bhv_desc_t behavior system, designed for extensibility and distributed coherence. For replication or porting, focus on exact behavior insertion order and mutex usage. No direct illumos/BSD analog for easy porting; closest is Solaris vnode layering but without pfile separation.&lt;/div&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
</feed>