mirror of https://github.com/MidnightCommander/mc
VFS: mc_fgetflags, mc_fsetflags: new APIs.
(mc_fgetflags): fgetflags(3) VFS wrapper. (mc_fsetflags): fsetflags(3) VFS wrapper. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
50f4717f45
commit
2a6580127a
|
@ -253,6 +253,8 @@ int mc_##name inarg \
|
|||
|
||||
MC_NAMEOP (chmod, (const vfs_path_t *vpath, mode_t mode), (vpath, mode))
|
||||
MC_NAMEOP (chown, (const vfs_path_t *vpath, uid_t owner, gid_t group), (vpath, owner, group))
|
||||
MC_NAMEOP (fgetflags, (const vfs_path_t *vpath, unsigned long *flags), (vpath, flags))
|
||||
MC_NAMEOP (fsetflags, (const vfs_path_t *vpath, unsigned long flags), (vpath, flags))
|
||||
MC_NAMEOP (utime, (const vfs_path_t *vpath, mc_timesbuf_t * times), (vpath, times))
|
||||
MC_NAMEOP (readlink, (const vfs_path_t *vpath, char *buf, size_t bufsiz), (vpath, buf, bufsiz))
|
||||
MC_NAMEOP (unlink, (const vfs_path_t *vpath), (vpath))
|
||||
|
|
|
@ -169,6 +169,10 @@ typedef struct vfs_class
|
|||
|
||||
int (*chmod) (const vfs_path_t * vpath, mode_t mode);
|
||||
int (*chown) (const vfs_path_t * vpath, uid_t owner, gid_t group);
|
||||
|
||||
int (*fgetflags) (const vfs_path_t * vpath, unsigned long *flags);
|
||||
int (*fsetflags) (const vfs_path_t * vpath, unsigned long flags);
|
||||
|
||||
int (*utime) (const vfs_path_t * vpath, mc_timesbuf_t * times);
|
||||
|
||||
int (*readlink) (const vfs_path_t * vpath, char *buf, size_t size);
|
||||
|
@ -318,6 +322,8 @@ int mc_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
|||
int mc_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int mc_chmod (const vfs_path_t * vpath, mode_t mode);
|
||||
int mc_chown (const vfs_path_t * vpath, uid_t owner, gid_t group);
|
||||
int mc_fgetflags (const vfs_path_t * vpath, unsigned long *flags);
|
||||
int mc_fsetflags (const vfs_path_t * vpath, unsigned long flags);
|
||||
int mc_chdir (const vfs_path_t * vpath);
|
||||
int mc_unlink (const vfs_path_t * vpath);
|
||||
int mc_ctl (int fd, int ctlop, void *arg);
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef ENABLE_EXT2FS_ATTR
|
||||
#include <e2p/e2p.h> /* fgetflags(), fsetflags() */
|
||||
#endif
|
||||
|
||||
#include "lib/global.h"
|
||||
|
||||
|
@ -185,6 +188,32 @@ local_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef ENABLE_EXT2FS_ATTR
|
||||
|
||||
static int
|
||||
local_fgetflags (const vfs_path_t * vpath, unsigned long *flags)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
return fgetflags (path_element->path, flags);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_fsetflags (const vfs_path_t * vpath, unsigned long flags)
|
||||
{
|
||||
const vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, -1);
|
||||
return fsetflags (path_element->path, flags);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_EXT2FS_ATTR */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_utime (const vfs_path_t * vpath, mc_timesbuf_t * times)
|
||||
{
|
||||
|
@ -469,6 +498,10 @@ vfs_init_localfs (void)
|
|||
vfs_local_ops->fstat = local_fstat;
|
||||
vfs_local_ops->chmod = local_chmod;
|
||||
vfs_local_ops->chown = local_chown;
|
||||
#ifdef ENABLE_EXT2FS_ATTR
|
||||
vfs_local_ops->fgetflags = local_fgetflags;
|
||||
vfs_local_ops->fsetflags = local_fsetflags;
|
||||
#endif
|
||||
vfs_local_ops->utime = local_utime;
|
||||
vfs_local_ops->readlink = local_readlink;
|
||||
vfs_local_ops->symlink = local_symlink;
|
||||
|
|
Loading…
Reference in New Issue