Previous: , Up: File Library Types   [Index]


7.12.2.3 struct x1f4_sffile_type

typedef struct x1f4_sffile_type {
    int (*fine)(void *), (*hold)(void *, int *), (*kate)(void *, off_t),
	(*lose)(void *), (*over)(void *), (*pull)(void *, void *, unsigned),
	(*push)(void *, void *, unsigned);
    off_t (*seek)(void *, off_t, int);
    unsigned bits;
} x1f4_sffile_type;

The x1f4_sffile_type record lists the file operation methods used by the file library objects.

See File Interfacing.

All the methods have their first argument of a file type specific layout. For the file types setup as such, the layout would be struct x1f4_cdfile_type.

See struct x1f4_cdfile_type.

The value of errno may be interpreted by the callers for determining or reporting the nature of failure, and it is used by the file library code as further detailed.

The fields that are assumed always set are:

bits

is a bitwise OR of zero or more file interface flag bits.

See File Library File Interface Flags.

fine

sets the close-on-exec flag.

expected to return zero for success, non zero for failure.

kate

truncates the file. Second argument is the size to truncate the file to.

may be set to NULL if the operation is not defined.

expected to return zero for success, non zero for failure (operation not applicable may be included).

lose

closes the file.

expected to return zero for success, non zero for failure.

over

frees all allocated resources. It does not close the underneath file object, if there exists such an object or resource (like a system file descriptor). Similar to lose, the method is intended for closing those aime file objects that are attached to objects that belong to a different layer and that are meant to stay opened.

expected to return zero for success, non zero for failure.

may be set to NULL if the operation is not defined.

pull

reads the file. Arguments starting with the second are the address where to store the read data and the number of bytes to read.

may be set to NULL if the operation is not defined.

expected to return the number of read bytes for success, -1 for failure.

When the method fails, errno is tested for EINTR, EAGAIN and EWOULDBLOCK, with the first always allowed and the other two allowed for nonblocking file reading.

push

writes the file. Arguments starting with the second are the address of data to write and its size in bytes.

may be set to NULL if the operation is not defined.

expected to return the number of written bytes for success, -1 for failure.

When the method fails, errno is tested for EINTR, always allowed.

seek

gets and sets the file position. Arguments starting with the second are the offset to seek and from where to seek, one of SEEK_CUR, SEEK_END and SEEK_SET, to be interpreted as for lseek(2).

expected to return the file position for success, -1 for failure.

The fields that are interpreted only if marked set are:

See File Library File Interface Flags.

hold

stores the associated file descriptor (non system file types will not qualify). Second argument is the address where to store the descriptor.

may be set to NULL if the operation is not defined.

expected to return 0 for success, -1 for failure.


Previous: struct x1f4_lxfile_type, Up: File Library Types   [Index]