/*
* Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
+ * Mountain View, CA 94043, USA, or: http://www.sgi.com
+ */
+
#include "global.h"
int
if (ioctl(writefd, XFS_IOC_RESVSP64, &resvsp) < 0) {
fprintf(stdout, "attempt to reserve %lld bytes for %s "
"using %s failed: %s (%d)\n",
- resvsize, filename, "XFS_IOC_RESVSP64",
+ (long long int)resvsize, filename, "XFS_IOC_RESVSP64",
strerror(errno), errno);
} else {
fprintf(stdout, "reserved %lld bytes for %s using %s\n",
- resvsize, filename, "XFS_IOC_RESVSP64");
+ (long long int)resvsize, filename, "XFS_IOC_RESVSP64");
}
/* Space is now preallocated, start IO --
fail++;
} else {
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble), strerror(errno));
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble), strerror(errno));
fail++;
}
close(fd);
if (!getuid()) {
if (stat("/dev/null", &st) != -1) {
if (mknod(path, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH, st.st_rdev) != -1) {
- fprintf(stderr, "mknod(%s, S_IFCHR|0666, %lld) did not fail\n", path, st.st_rdev);
+ fprintf(stderr, "mknod(%s, S_IFCHR|0666, %lld) did not fail\n", path, (long long int)st.st_rdev);
fail++;
unlink(path);
} else if (errno != EACCES) {
- fprintf(stderr, "mknod(%s, S_IFCHR|0666, %lld) did not set errno == EACCESS\n", path, st.st_rdev);
+ fprintf(stderr, "mknod(%s, S_IFCHR|0666, %lld) did not set errno == EACCESS\n", path, (long long int)st.st_rdev);
fail++;
}
}
fail++;
} else {
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble), strerror(errno));
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble), strerror(errno));
fail++;
}
close(fd);
} else {
lseek(fd, 0, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
lseek(fd, origsize, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
else {
if (read(fd, buf, strlen(scribble2)) == -1) {
fprintf(stderr, "read(%s, &buf, %d) failed: %s\n", path,
- strlen(scribble2), strerror(errno));
+ (int)strlen(scribble2), strerror(errno));
fail++;
} else {
if (memcmp(scribble2, buf, strlen(scribble2))) {
} else {
lseek(fd, 0, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
lseek(fd, origsize, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
else {
if (read(fd, buf, strlen(scribble4)) == -1) {
fprintf(stderr, "read(%s, &buf, %d) failed: %s\n", path,
- strlen(scribble4), strerror(errno));
+ (int)strlen(scribble4), strerror(errno));
fail++;
} else {
if (memcmp(scribble4, buf, strlen(scribble4))) {
} else {
lseek(fd, 0, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
lseek(fd, origsize, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
else {
if (read(fd, buf, strlen(scribble2)) == -1) {
fprintf(stderr, "read(%s, &buf, %d) failed: %s\n", path,
- strlen(scribble2), strerror(errno));
+ (int)strlen(scribble2), strerror(errno));
fail++;
} else {
if (memcmp(scribble2, buf, strlen(scribble2))) {
} else {
lseek(fd, 0, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
lseek(fd, origsize, SEEK_SET); /* this is silently ignored */
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble),
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble),
strerror(errno));
fail++;
}
else {
if (read(fd, buf, strlen(scribble4)) == -1) {
fprintf(stderr, "read(%s, &buf, %d) failed: %s\n", path,
- strlen(scribble4), strerror(errno));
+ (int)strlen(scribble4), strerror(errno));
fail++;
} else {
if (memcmp(scribble4, buf, strlen(scribble4))) {
fail++;
} else {
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble), strerror(errno));
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble), strerror(errno));
fail++;
}
close(fd);
asprintf(&path, "%s/append-only.d/newdev-%d", dir, getuid());
if (stat("/dev/null", &st) != -1) {
if (mknod(path, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH, st.st_rdev) == -1) {
- fprintf(stderr, "mknod(%s, S_IFCHR|0666, %lld) failed: %s\n", path, st.st_rdev, strerror(errno));
+ fprintf(stderr, "mknod(%s, S_IFCHR|0666, %lld) failed: %s\n", path, (long long int)st.st_rdev, strerror(errno));
fail++;
} else if (unlink(path) != -1) {
fprintf(stderr, "unlink(%s) did not fail\n", path);
fail++;
} else {
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble), strerror(errno));
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble), strerror(errno));
fail++;
}
close(fd);
} else
chown(path, 0, 0);
}
-
+
free(path);
asprintf(&path, "%s/append-only.d/dir/newfile-%d", dir, getuid());
if ((fd = open(path, O_RDWR|O_CREAT, 0666)) == -1) {
fail++;
} else {
if (write(fd, scribble, strlen(scribble)) != strlen(scribble)) {
- fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, strlen(scribble), strerror(errno));
+ fprintf(stderr, "write(%s, %s, %d) failed: %s\n", path, scribble, (int)strlen(scribble), strerror(errno));
fail++;
}
close(fd);