gtpc2mjj | C/C++ Language Support User's Guide |
This type of function is specified as part of the file system device driver interface and is called by fopen, ftruncate, and open to change the size of the special file. If the file is extended beyond its current size, the extended part will (logically) contain \0.
Format
typedef int TPF_FSDD_RESIZE(long size, const TPF_FSDD_FILEDATA *filedata);
Normal Return
Error Return
Programming Considerations
#include <c$spif.h> #include <errno.h> int device_type_resize(long new_size, const TPF_FSDD_FILEDATA *state_ptr) { errno = EINVAL return -1; }
Examples
The following example is the set size device driver interface function for the null file (/dev/null).
#include <c$spif.h> /* Device driver interface */ #include <errno.h> /* errno, EINVAL */ /**********************************************************************/ /* The null_resize() function always fails (the size of a null file */ /* is always zero). */ /**********************************************************************/ int null_resize(long new_size, const TPF_FSDD_FILEDATA *filedata) { errno = EINVAL; return -1; }
Related Information