rfc:streammetadata

This is an old revision of the document!


Request for Comments: How to write RFCs

Purpose

PHP file streams provide very powerful and useful abstraction layer over the I/O-related functions. However, there's a group of functions which are excluded from this support - namely, touch(), chmod(), chown() and chgrp() - i.e., functions dealing with file metadata. This lead to libraries implementing FS virtualization developing various hacks, such as here: https://code.google.com/p/bovigo/wiki/vfsStreamDocsFilemode

The purpose of this RFC is to plug this hole by creating stream metadata API allowing to override these functions.

Engine part

The stream wrapper gets an additional optional handler, like this:

int (*stream_metadata)(php_stream_wrapper *wrapper, char *url, int options, void *value, php_stream_context *context TSRMLS_DC);

The options supported currently are:

    #define PHP_STREAM_META_TOUCH		1
    #define PHP_STREAM_META_OWNER_NAME	2
    #define PHP_STREAM_META_OWNER		3
    #define PHP_STREAM_META_GROUP_NAME	4
    #define PHP_STREAM_META_GROUP		5
    #define PHP_STREAM_META_ACCESS		6

implementing various aspects of touch(), chmod(), etc.

Userspace part

Userspace stream handler implements this wrapper by using userspace method:

  public function stream_metadata($path, $option, $var)

See example below as for suggested implementation for virtualized filesystem.

Examples

rfc/streammetadata.1300074333.txt.gz · Last modified: 2017/09/22 13:28 (external edit)