Skip to content

Commit cf5dab0

Browse files
committed
libnilfs: add functions to get pathname or FD of mount point directory
Add export functions to get the absolute path name or file descriptor of the mount point directory (file system root directory). Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
1 parent 87b1c80 commit cf5dab0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

include/nilfs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ struct nilfs *nilfs_open(const char *dev, const char *dir, int flags);
7979
void nilfs_close(struct nilfs *nilfs);
8080

8181
const char *nilfs_get_dev(const struct nilfs *nilfs);
82+
const char *nilfs_get_root_path(const struct nilfs *nilfs);
83+
int nilfs_get_root_fd(const struct nilfs *nilfs);
8284

8385
int nilfs_opt_test(const struct nilfs *nilfs, unsigned int index);
8486
int nilfs_opt_set(struct nilfs *nilfs, unsigned int index);

lib/nilfs.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,31 @@ const char *nilfs_get_dev(const struct nilfs *nilfs)
598598
return nilfs->n_dev;
599599
}
600600

601+
/**
602+
* nilfs_get_root_path - get the path name string of the mount point
603+
* @nilfs: nilfs object
604+
*
605+
* Return: The absolute path name of the mount point directory, or %NULL if
606+
* unavailable.
607+
*/
608+
const char *nilfs_get_root_path(const struct nilfs *nilfs)
609+
{
610+
return nilfs->n_ioc;
611+
}
612+
613+
/**
614+
* nilfs_get_root_fd - get the file descriptor of the mount point directory
615+
* (file system root directory)
616+
* @nilfs: nilfs object
617+
*
618+
* Return: The file descriptor of the mount point directory, or -1 if not
619+
* available.
620+
*/
621+
int nilfs_get_root_fd(const struct nilfs *nilfs)
622+
{
623+
return nilfs->n_iocfd;
624+
}
625+
601626
/**
602627
* nilfs_lock - acquire a lock
603628
* @nilfs: nilfs object

0 commit comments

Comments
 (0)