master
go 50 lines 1.99 KB
Raw
1 package mount
2
3 import "os"
4
5 // Default POSIX modes used by FUSE mounts when the UnixFS DAG node does
6 // not contain explicit permission metadata. Most data on IPFS does not
7 // include mode, so these apply to the majority of files and directories.
8 //
9 // Per the UnixFS spec, implementations may default to 0755 for directories
10 // and 0644 for files when mode is absent.
11 // See https://specs.ipfs.tech/unixfs/#dag-pb-optional-metadata
12
13 // Writable mounts (/ipns, /mfs): standard POSIX defaults matching umask 022.
14 const (
15 DefaultFileModeRW = os.FileMode(0o644)
16 DefaultDirModeRW = os.ModeDir | 0o755
17 )
18
19 // Read-only mount (/ipfs): no write bits.
20 const (
21 DefaultFileModeRO = os.FileMode(0o444)
22 DefaultDirModeRO = os.ModeDir | 0o555
23 )
24
25 // NamespaceRootMode is for the /ipfs/ and /ipns/ root directories.
26 // Execute-only: these are virtual namespaces where users traverse by
27 // name (CID or IPNS key) but listing the full namespace is not possible.
28 const NamespaceRootMode = os.ModeDir | 0o111
29
30 // SymlinkMode is the POSIX permission bits for symlinks. Symlink
31 // permissions are always 0777; access control uses the target's mode.
32 const SymlinkMode = os.FileMode(0o777)
33
34 // MaxReadAhead tells the kernel how far ahead to read in a single FUSE
35 // request. 64 MiB works well for sequential access (streaming, file
36 // copies) because most data is served from the local blockstore after
37 // the initial fetch. Network-backed reads are already chunked by the
38 // DAG layer, so oversized readahead does not cause extra round-trips.
39 const MaxReadAhead = 64 * 1024 * 1024
40
41 // XattrCID is the extended attribute name for the node's CID.
42 // Follows the convention used by CephFS (ceph.*), Btrfs (btrfs.*),
43 // and GlusterFS (glusterfs.*) of using a project-specific namespace.
44 const XattrCID = "ipfs.cid"
45
46 // XattrCIDDeprecated is the old xattr name. Getxattr normalizes it
47 // to XattrCID and logs a deprecation error so existing tooling keeps
48 // working while users migrate.
49 // TODO: remove after 2 releases.
50 const XattrCIDDeprecated = "ipfs_cid"