sofs19  0.1
FUSE based file system
other syscalls

Other system calls. More...

Functions

int soOpenFileSystem (const char *devname)
 Open the sofs19 file system. More...
 
int soCloseFileSystem (void)
 Close the sofs19 file system. More...
 
int soStatFS (const char *path, struct statvfs *st)
 Get file system statistics. More...
 
int soStat (const char *path, struct stat *st)
 Get file status. More...
 
int soAccess (const char *path, int opRequested)
 Check real user's permissions for a file. More...
 
int soChmod (const char *path, mode_t mode)
 Change permissions of a file. More...
 
int soChown (const char *path, uid_t owner, gid_t group)
 Change the ownership of a file. More...
 
int soUtime (const char *path, const struct utimbuf *times)
 Change the last access and modification times of a file. More...
 
int soUtimens (const char *path, const struct timespec tv[2])
 Change the last access and modification times of a file with nanosecond resolution. More...
 
int soOpen (const char *path, int flags)
 Open a regular file. More...
 
int soClose (const char *path)
 Close a regular file. More...
 
int soFsync (const char *path)
 Synchronize a file's in-core state with storage device. More...
 
int soOpendir (const char *path)
 Open a directory for reading. More...
 
int soClosedir (const char *path)
 Close a directory. More...
 

Detailed Description

Other system calls.

Function Documentation

◆ soOpenFileSystem()

int sofs19::soOpenFileSystem ( const char *  devname)

Open the sofs19 file system.

The rawdisk is open and, if it does not fail, the three dealers are open. This function is called by the mount operation.

Parameters
devnameabsolute path to the Linux file that simulates the storage device
Returns
0 on success; ” -errno in case of error, being errno the system error that better represents the cause of failure

◆ soCloseFileSystem()

int sofs19::soCloseFileSystem ( void  )

Close the sofs19 file system.

The three dealers are closed and then the raw disk is closed. This function is called by the unmount operation.

Returns
0 on success; ” -errno in case of error, being errno the system error that better represents the cause of failure

◆ soStatFS()

int sofs19::soStatFS ( const char *  path,
struct statvfs *  st 
)

Get file system statistics.

It tries to emulate statvfs system call.

Information about a mounted file system is returned. It checks whether the calling process can access the file specified by the path.

To get more information, execute in a terminal the command man 2 statvfs

Parameters
pathpath to any file within the mounted file system
stpointer to a statvfs structure
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soStat()

int sofs19::soStat ( const char *  path,
struct stat *  st 
)

Get file status.

It tries to emulate stat system call.

Information about a specific file is returned. It checks whether the calling process can access the file specified by the path.

To get more information, execute in a terminal the command man 2 stat

Parameters
pathpath to the file
stpointer to a stat structure
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soAccess()

int sofs19::soAccess ( const char *  path,
int  opRequested 
)

Check real user's permissions for a file.

It tries to emulate access system call.

It checks whether the calling process can access the file specified by the path for the requested operation.

To get more information, execute in a terminal the command man 2 access

Parameters
pathpath to the file
opRequestedoperation to be performed: F_OK (check if file exists) a bitwise combination of R_OK, W_OK, and X_OK
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soChmod()

int sofs19::soChmod ( const char *  path,
mode_t  mode 
)

Change permissions of a file.

It tries to emulate chmod system call.

It changes the permissions of a file specified by the path.

Remarks
If the file is a symbolic link, its contents shall always be used to reach the destination file, so the permissions of a symbolic link can never be changed (they are set to rwx for user, group and other when the link is created and remain unchanged thereafter).

To get more information, execute in a terminal the command man 2 chmod

Parameters
pathpath to the file
modepermissions to be set: a bitwise combination of S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soChown()

int sofs19::soChown ( const char *  path,
uid_t  owner,
gid_t  group 
)

Change the ownership of a file.

It tries to emulate chown system call.

It changes the ownership of the file specified by the path.

Only root may change the owner of a file. The file's owner may change the group if the specified group is one of the owner's supplementary groups.

To get more information, execute in a terminal the command man 2 chown

Parameters
pathpath to the file
ownerfile user id (-1, if user is not to be changed)
groupfile group id (-1, if group is not to be changed)
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soUtime()

int sofs19::soUtime ( const char *  path,
const struct utimbuf *  times 
)

Change the last access and modification times of a file.

It tries to emulate utime system call.

To get more information, execute in a terminal the command man 2 utime

Parameters
pathpath to the file
timespointer to a structure where the last access and modification times are passed, if NULL, the last access and modification times are set to the current time
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soUtimens()

int sofs19::soUtimens ( const char *  path,
const struct timespec  tv[2] 
)

Change the last access and modification times of a file with nanosecond resolution.

It tries to emulate utimensat system call.

To get more information, execute in a terminal the command man 2 utimensat

Parameters
pathpath to the file
tvstructure array where the last access, element of index 0, and modification, element of index 1, times are passed, if NULL, the last access and modification times are set to the current time if the tv_nsec field of one of the timespec structures has the special value UTIME_NOW, then the corresponding file timestamp is set to the current time if the tv_nsec field of one of the timespec structures has the special value UTIME_OMIT, then the corresponding file timestamp is left unchanged
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soOpen()

int sofs19::soOpen ( const char *  path,
int  flags 
)

Open a regular file.

It tries to emulate open system call.

In the current implementation it only checks if the calling process can access the file for the openning operation.

To get more information, execute in a terminal the command man 2 open

Parameters
pathpath to the file
flagsaccess modes to be used: O_RDONLY, O_WRONLY, O_RDWR
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soClose()

int sofs19::soClose ( const char *  path)

Close a regular file.

It tries to emulate close system call.

To get more information, execute in a terminal the command man 2 close

Parameters
pathpath to the file
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soFsync()

int sofs19::soFsync ( const char *  path)

Synchronize a file's in-core state with storage device.

It tries to emulate fsync system call.

To get more information, execute in a terminal the command man 2 fsync

Parameters
pathpath to the file
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soOpendir()

int sofs19::soOpendir ( const char *  path)

Open a directory for reading.

It tries to emulate opendir system call. In the current implementation it only checks if the calling process can access the file for the openning operation.

To get more information, execute in a terminal the command man opendir

Parameters
pathpath to the file
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure

◆ soClosedir()

int sofs19::soClosedir ( const char *  path)

Close a directory.

It tries to emulate closedir system call.

To get more information, execute in a terminal the command man closedir

Parameters
pathpath to the file
Returns
0 on success; -errno in case of error, being errno the system error that better represents the cause of failure