#define rounddown(x, y) (((x)/(y))*(y))
#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
-extern int platform_check_ismounted(char *, char *, struct stat64 *, int);
+extern int platform_check_ismounted(char *, char *, struct stat *, int);
int logfd;
char *logfile_name;
extern int optind;
libxfs_init_t xargs;
thread_args *tcarg;
- struct stat64 statbuf;
+ struct stat statbuf;
progname = basename(argv[0]);
die_perror();
}
- if (fstat64(source_fd, &statbuf) < 0) {
+ if (fstat(source_fd, &statbuf) < 0) {
do_log(_("%s: couldn't stat source \"%s\"\n"),
progname, source_name);
die_perror();
for (i = 0; i < num_targets; i++) {
int write_last_block = 0;
- if (stat64(target[i].name, &statbuf) < 0) {
+ if (stat(target[i].name, &statbuf) < 0) {
/* ok, assume it's a file and create it */
do_out(_("Creating file %s\n"), target[i].name);
* of that.
*/
static char *
-find_mountpoint_check(struct stat64 *sb, struct mntent *t)
+find_mountpoint_check(struct stat *sb, struct mntent *t)
{
- struct stat64 ms;
+ struct stat ms;
if (S_ISDIR(sb->st_mode)) { /* mount point */
- if (stat64(t->mnt_dir, &ms) < 0)
+ if (stat(t->mnt_dir, &ms) < 0)
return NULL;
if (sb->st_ino != ms.st_ino)
return NULL;
if (strcmp(t->mnt_type, MNTTYPE_XFS) != 0)
return NULL;
} else { /* device */
- if (stat64(t->mnt_fsname, &ms) < 0)
+ if (stat(t->mnt_fsname, &ms) < 0)
return NULL;
if (sb->st_rdev != ms.st_rdev)
return NULL;
* Make sure the mountpoint given by mtab is accessible
* before using it.
*/
- if (stat64(t->mnt_dir, &ms) < 0)
+ if (stat(t->mnt_dir, &ms) < 0)
return NULL;
}
}
static char *
-find_mountpoint(char *mtab, char *argname, struct stat64 *sb)
+find_mountpoint(char *mtab, char *argname, struct stat *sb)
{
struct mntent_cursor cursor;
struct mntent *t = NULL;
int
main(int argc, char **argv)
{
- struct stat64 sb;
+ struct stat sb;
char *argname;
int c;
char *mntp;
for (; optind < argc; optind++) {
argname = argv[optind];
- if (lstat64(argname, &sb) < 0) {
+ if (lstat(argname, &sb) < 0) {
fprintf(stderr,
_("%s: could not stat: %s: %s\n"),
progname, argname, strerror(errno));
}
if (S_ISLNK(sb.st_mode)) {
- struct stat64 sb2;
+ struct stat sb2;
- if (stat64(argname, &sb2) == 0 &&
+ if (stat(argname, &sb2) == 0 &&
(S_ISBLK(sb2.st_mode) ||
S_ISCHR(sb2.st_mode)))
sb = sb2;
struct mntent *mnt= NULL;
int mi;
char *cp;
- struct stat64 sb;
+ struct stat sb;
/* malloc a number of descriptors, increased later if needed */
if (!(fsbase = (fsdesc_t *)malloc(fsbufsize * sizeof(fsdesc_t)))) {
int rw = 0;
if (strcmp(mnt->mnt_type, MNTTYPE_XFS ) != 0 ||
- stat64(mnt->mnt_fsname, &sb) == -1 ||
+ stat(mnt->mnt_fsname, &sb) == -1 ||
!S_ISBLK(sb.st_mode))
continue;
char *ptr;
xfs_ino_t startino = 0;
fsdesc_t *fsp;
- struct stat64 sb, sb2;
+ struct stat sb, sb2;
fsrprintf("xfs_fsr -m %s -t %d -f %s ...\n", mtab, howlong, leftofffile);
fs = fsbase;
/* where'd we leave off last time? */
- if (lstat64(leftofffile, &sb) == 0) {
+ if (lstat(leftofffile, &sb) == 0) {
if ( (fd = open(leftofffile, O_RDONLY)) == -1 ) {
fsrprintf(_("%s: open failed\n"), leftofffile);
}
- else if ( fstat64(fd, &sb2) == 0) {
+ else if ( fstat(fd, &sb2) == 0) {
/*
* Verify that lstat & fstat point to the
* same regular file (no links/no quick spoofs)
xfs_bstat_t *bstatp)
{
#ifdef HAVE_FSETXATTR
- struct stat64 tstatbuf;
+ struct stat tstatbuf;
int i;
int diff = 0;
int last_forkoff = 0;
/* attr2 w/ fork offsets */
- if (fstat64(tfd, &tstatbuf) < 0) {
+ if (fstat(tfd, &tstatbuf) < 0) {
fsrprintf(_("unable to stat temp file: %s\n"),
strerror(errno));
return -1;
typedef int64_t xfs_daddr_t;
typedef __u32 xfs_nlink_t;
-#define stat64 stat
-#define fstat64 fstat
#define lseek64 lseek
#define pread64 pread
#define pwrite64 pwrite
# include <sys/param.h>
#include <sys/ucred.h>
#include <errno.h>
-#define statvfs64 statfs
-#define lstat64 lstat
+#define statvfs64 statfs
#define _PATH_MOUNTED "/etc/mtab"
struct mntent
#define __LITTLE_ENDIAN LITTLE_ENDIAN
/* FreeBSD file API is 64-bit aware */
-#define fstat64 fstat
#define ftruncate64 ftruncate
#define lseek64 lseek
-#define stat64 stat
#define pwrite64 pwrite
#define pread64 pread
#define fdatasync fsync
static off64_t
copy_src_filesize(int fd)
{
- struct stat64 st;
+ struct stat st;
- if (fstat64(fd, &st) < 0) {
- perror("fstat64");
+ if (fstat(fd, &st) < 0) {
+ perror("fstat");
return -1;
};
return st.st_size;
off64_t
filesize(void)
{
- struct stat64 st;
+ struct stat st;
- if (fstat64(file->fd, &st) < 0) {
- perror("fstat64");
+ if (fstat(file->fd, &st) < 0) {
+ perror("fstat");
return -1;
}
return st.st_size;
{
struct dioattr dio;
struct fsxattr fsx, fsxa;
- struct stat64 st;
+ struct stat st;
int verbose = (argc == 2 && !strcmp(argv[1], "-v"));
printf(_("fd.path = \"%s\"\n"), file->name);
file->flags & IO_APPEND ? _(",append-only") : "",
file->flags & IO_NONBLOCK ? _(",non-block") : "",
file->flags & IO_TMPFILE ? _(",tmpfile") : "");
- if (fstat64(file->fd, &st) < 0) {
- perror("fstat64");
+ if (fstat(file->fd, &st) < 0) {
+ perror("fstat");
} else {
printf(_("stat.ino = %lld\n"), (long long)st.st_ino);
printf(_("stat.type = %s\n"), filetype(st.st_mode));
set_extsize(const char *path, int fd, long extsz)
{
struct fsxattr fsx;
- struct stat64 stat;
+ struct stat stat;
- if (fstat64(fd, &stat) < 0) {
- perror("fstat64");
+ if (fstat(fd, &stat) < 0) {
+ perror("fstat");
return 0;
}
if ((xfsctl(path, fd, FS_IOC_FSGETXATTR, &fsx)) < 0) {
goto done;
}
} else {
- struct stat64 stat;
+ struct stat stat;
- if (fstat64(fd, &stat) < 0) {
- perror("fstat64");
+ if (fstat(fd, &stat) < 0) {
+ perror("fstat");
goto done;
}
count = stat.st_size;
const char *name,
dev_t *devnum)
{
- struct stat64 sbuf;
+ struct stat sbuf;
- if (stat64(name, &sbuf) < 0)
+ if (stat(name, &sbuf) < 0)
return errno;
/*
* We want to match st_rdev if the path provided is a device
extern char *progname;
int
-platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
{
return 0;
}
int
-platform_check_iswritable(char *name, char *block, struct stat64 *s)
+platform_check_iswritable(char *name, char *block, struct stat *s)
{
int fd, writable;
platform_findsizes(char *path, int fd, long long *sz, int *bsz)
{
__uint64_t size;
- struct stat64 st;
+ struct stat st;
- if (fstat64(fd, &st) < 0) {
+ if (fstat(fd, &st) < 0) {
fprintf(stderr,
_("%s: cannot stat the device file \"%s\": %s\n"),
progname, path, strerror(errno));
extern char *progname;
int
-platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
{
- struct stat64 st;
+ struct stat st;
int cnt, i;
struct statfs *fsinfo;
if (!s) {
- if (stat64(block, &st) < 0)
+ if (stat(block, &st) < 0)
return 0;
s = &st;
}
}
int
-platform_check_iswritable(char *name, char *block, struct stat64 *s)
+platform_check_iswritable(char *name, char *block, struct stat *s)
{
int cnt, i;
struct statfs *fsinfo;
static int
check_isactive(char *name, char *block, int fatal)
{
- struct stat64 st;
+ struct stat st;
- if (stat64(block, &st) < 0)
+ if (stat(block, &st) < 0)
return 0;
if ((st.st_mode & S_IFMT) != S_IFBLK)
return 0;
dev_t dev;
int fd, d, flags;
int readonly, dio, excl;
- struct stat64 statb;
+ struct stat statb;
readonly = (xflags & LIBXFS_ISREADONLY);
excl = (xflags & LIBXFS_EXCLUSIVELY) && !creat;
exit(1);
}
- if (fstat64(fd, &statb) < 0) {
+ if (fstat(fd, &statb) < 0) {
fprintf(stderr, _("%s: cannot stat %s: %s\n"),
progname, path, strerror(errno));
exit(1);
int readonly = (flags & LIBXFS_ISREADONLY);
int inactive = (flags & LIBXFS_ISINACTIVE);
int dangerously = (flags & LIBXFS_DANGEROUSLY);
- struct stat64 stbuf;
+ struct stat stbuf;
- if (stat64(path, &stbuf) < 0) {
+ if (stat(path, &stbuf) < 0) {
perror(path);
return 0;
}
#ifndef LIBXFS_INIT_H
#define LIBXFS_INIT_H
-struct stat64;
+struct stat;
extern int platform_check_ismounted (char *path, char *block,
- struct stat64 *sptr, int verbose);
-extern int platform_check_iswritable (char *path, char *block, struct stat64 *sptr);
+ struct stat *sptr, int verbose);
+extern int platform_check_iswritable (char *path, char *block, struct stat *sptr);
extern int platform_set_blocksize (int fd, char *path, dev_t device, int bsz, int fatal);
extern void platform_flush_device (int fd, dev_t device);
extern char *platform_findrawpath(char *path);
extern __int64_t findsize(char *);
int
-platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
{
return 0;
}
int
-platform_check_iswritable(char *name, char *block, struct stat64 *s)
+platform_check_iswritable(char *name, char *block, struct stat *s)
{
return 1;
}
void
platform_findsizes(char *path, int fd, long long *sz, int *bsz)
{
- struct stat64 st;
+ struct stat st;
- if (fstat64(fd, &st) < 0) {
+ if (fstat(fd, &st) < 0) {
fprintf(stderr,
_("%s: cannot stat the device file \"%s\": %s\n"),
progname, path, strerror(errno));
#define CHECK_MOUNT_WRITABLE 0x2
static int
-platform_check_mount(char *name, char *block, struct stat64 *s, int flags)
+platform_check_mount(char *name, char *block, struct stat *s, int flags)
{
FILE *f;
- struct stat64 st, mst;
+ struct stat st, mst;
struct mntent *mnt;
char mounts[MAXPATHLEN];
if (!s) {
/* If either fails we are not mounted */
- if (stat64(block, &st) < 0)
+ if (stat(block, &st) < 0)
return 0;
if ((st.st_mode & S_IFMT) != S_IFBLK)
return 0;
return 1;
}
while ((mnt = getmntent(f)) != NULL) {
- if (stat64(mnt->mnt_dir, &mst) < 0)
+ if (stat(mnt->mnt_dir, &mst) < 0)
continue;
if (mst.st_dev != s->st_rdev)
continue;
}
int
-platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)
{
int flags;
}
int
-platform_check_iswritable(char *name, char *block, struct stat64 *s)
+platform_check_iswritable(char *name, char *block, struct stat *s)
{
int flags;
void
platform_flush_device(int fd, dev_t device)
{
- struct stat64 st;
+ struct stat st;
if (major(device) == RAMDISK_MAJOR)
return;
- if (fstat64(fd, &st) < 0)
+ if (fstat(fd, &st) < 0)
return;
if (S_ISREG(st.st_mode))
void
platform_findsizes(char *path, int fd, long long *sz, int *bsz)
{
- struct stat64 st;
+ struct stat st;
__uint64_t size;
int error;
- if (fstat64(fd, &st) < 0) {
+ if (fstat(fd, &st) < 0) {
fprintf(stderr, _("%s: "
"cannot stat the device file \"%s\": %s\n"),
progname, path, strerror(errno));
exit(1);
}
-extern int platform_check_ismounted(char *, char *, struct stat64 *, int);
+extern int platform_check_ismounted(char *, char *, struct stat *, int);
int
main(
int dst_fd;
int c;
int open_flags;
- struct stat64 statbuf;
+ struct stat statbuf;
int is_target_file;
progname = basename(argv[0]);
/* check and open target */
open_flags = O_RDWR;
is_target_file = 0;
- if (stat64(argv[optind], &statbuf) < 0) {
+ if (stat(argv[optind], &statbuf) < 0) {
/* ok, assume it's a file and create it */
open_flags |= O_CREAT;
is_target_file = 1;
filesize(
int fd)
{
- struct stat64 stb;
+ struct stat stb;
- if (fstat64(fd, &stb) < 0)
+ if (fstat(fd, &stb) < 0)
return -1;
return (long)stb.st_size;
}
bool force_overwrite,
const char *optname)
{
- struct stat64 statbuf;
+ struct stat statbuf;
if (*isfile && (no_size || no_name)) {
fprintf(stderr,
usage();
}
- if (stat64(name, &statbuf)) {
+ if (stat(name, &statbuf)) {
if (errno == ENOENT && *isfile) {
if (create)
*create = 1;
#: .././rtcp/xfs_rtcp.c:86
#, c-format
-msgid "%s: stat64 of %s failed\n"
-msgstr "%s: stat64 von %s fehlgeschlagen\n"
+msgid "%s: stat of %s failed\n"
+msgstr "%s: stat von %s fehlgeschlagen\n"
#: .././rtcp/xfs_rtcp.c:93
#, c-format
#: .././rtcp/xfs_rtcp.c:140
#, c-format
-msgid "%s: failed stat64 on %s: %s\n"
-msgstr "%s: stat64 auf %s fehlgeschlagen: %s\n"
+msgid "%s: failed stat on %s: %s\n"
+msgstr "%s: stat auf %s fehlgeschlagen: %s\n"
#: .././rtcp/xfs_rtcp.c:161
#, c-format
#: .././rtcp/xfs_rtcp.c:84
#, c-format
-msgid "%s: stat64 of %s failed\n"
-msgstr "%s: stat64 na %s nie powiodło się\n"
+msgid "%s: stat of %s failed\n"
+msgstr "%s: stat na %s nie powiodło się\n"
#: .././rtcp/xfs_rtcp.c:91
#, c-format
#: .././rtcp/xfs_rtcp.c:138
#, c-format
-msgid "%s: failed stat64 on %s: %s\n"
-msgstr "%s: nie udało się wykonać stat64 na %s: %s\n"
+msgid "%s: failed stat on %s: %s\n"
+msgstr "%s: nie udało się wykonać stat na %s: %s\n"
#: .././rtcp/xfs_rtcp.c:159
#, c-format
/* -f forces this, but let's be nice and autodetect it, as well. */
if (!isa_file) {
int fd = libxfs_device_to_fd(x.ddev);
- struct stat64 statbuf;
+ struct stat statbuf;
- if (fstat64(fd, &statbuf) < 0)
+ if (fstat(fd, &statbuf) < 0)
do_warn(_("%s: couldn't stat \"%s\"\n"),
progname, fs_name);
else if (S_ISREG(statbuf.st_mode))
main(int argc, char **argv)
{
int c, i, r, errflg = 0;
- struct stat64 s2;
+ struct stat s2;
int extsize = - 1;
progname = basename(argv[0]);
* which really exists.
*/
if (argc > 2) {
- if (stat64(argv[argc-1], &s2) < 0) {
- fprintf(stderr, _("%s: stat64 of %s failed\n"),
+ if (stat(argv[argc-1], &s2) < 0) {
+ fprintf(stderr, _("%s: stat of %s failed\n"),
progname, argv[argc-1]);
exit(2);
}
int remove = 0, rtextsize;
char *sp, *fbuf, *ptr;
char tbuf[ PATH_MAX ];
- struct stat64 s1, s2;
+ struct stat s1, s2;
struct fsxattr fsxattr;
struct dioattr dioattr;
*sp = '\0';
}
- if ( stat64(source, &s1) ) {
- fprintf(stderr, _("%s: failed stat64 on %s: %s\n"),
+ if ( stat(source, &s1) ) {
+ fprintf(stderr, _("%s: failed stat on %s: %s\n"),
progname, source, strerror(errno));
return( -1);
}
* check for a realtime partition
*/
snprintf(tbuf, sizeof(tbuf), "%s", target);
- if ( stat64(target, &s2) ) {
+ if ( stat(target, &s2) ) {
if (!S_ISDIR(s2.st_mode)) {
/* take out target file name */
if ((ptr = strrchr(tbuf, '/')) != NULL)
* check if target is a directory
*/
snprintf(tbuf, sizeof(tbuf), "%s", target);
- if ( !stat64(target, &s2) ) {
+ if ( !stat(target, &s2) ) {
if (S_ISDIR(s2.st_mode)) {
snprintf(tbuf, sizeof(tbuf), "%s/%s", target,
basename(source));
}
}
- if ( stat64(tbuf, &s2) ) {
+ if ( stat(tbuf, &s2) ) {
/*
* create the file if it does not exist
*/