Merge "[MIPS] Updated support for statfs and fstatfs."
This commit is contained in:
@@ -14,8 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <statfs_portable.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <statfs_portable.h>
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
|
|
||||||
static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *p_statfs)
|
static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *p_statfs)
|
||||||
{
|
{
|
||||||
@@ -35,7 +38,13 @@ static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *
|
|||||||
int statfs_portable(const char* path, struct statfs_portable* stat)
|
int statfs_portable(const char* path, struct statfs_portable* stat)
|
||||||
{
|
{
|
||||||
struct statfs mips_stat;
|
struct statfs mips_stat;
|
||||||
int ret = statfs(path, &mips_stat);
|
int ret;
|
||||||
|
|
||||||
|
if (invalid_pointer(stat)) {
|
||||||
|
errno = EFAULT;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ret = statfs(path, &mips_stat);
|
||||||
statfs_ntop(&mips_stat, stat);
|
statfs_ntop(&mips_stat, stat);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -43,7 +52,13 @@ int statfs_portable(const char* path, struct statfs_portable* stat)
|
|||||||
int fstatfs_portable(int fd, struct statfs_portable* stat)
|
int fstatfs_portable(int fd, struct statfs_portable* stat)
|
||||||
{
|
{
|
||||||
struct statfs mips_stat;
|
struct statfs mips_stat;
|
||||||
int ret = fstatfs(fd, &mips_stat);
|
int ret;
|
||||||
|
|
||||||
|
if (invalid_pointer(stat)) {
|
||||||
|
errno = EFAULT;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ret = fstatfs(fd, &mips_stat);
|
||||||
statfs_ntop(&mips_stat, stat);
|
statfs_ntop(&mips_stat, stat);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user