JNIEXPORT void JNICALL Java_org_apache_subversion_javahl_SVNRepos_create (JNIEnv *env, jobject jthis, jobject jpath, jboolean jdisableFsyncCommit, jboolean jkeepLog, jobject jconfigpath, jstring jfstype) { JNIEntry(SVNRepos, create); SVNRepos *cl = SVNRepos::getCppObject(jthis); if (cl == NULL) { JNIUtil::throwError(_("bad C++ this")); return; } File path(jpath); if (JNIUtil::isExceptionThrown()) return; File configpath(jconfigpath); if (JNIUtil::isExceptionThrown()) return; JNIStringHolder fstype(jfstype); if (JNIUtil::isExceptionThrown()) return; cl->create(path, jdisableFsyncCommit? true : false, jkeepLog? true : false, configpath, fstype); }
int main (int argc, char *const *argv) { char fs[1000]; int verbose = 0; int status = 0; int ch, i; setlocale(LC_ALL, ""); bindtextdomain("bacula", LOCALEDIR); textdomain("bacula"); while ((ch = getopt(argc, argv, "v?")) != -1) { switch (ch) { case 'v': verbose = 1; break; case '?': default: usage(); } } argc -= optind; argv += optind; if (argc < 1) { usage(); } OSDependentInit(); for (i = 0; i < argc; --argc, ++argv) { if (fstype(*argv, fs, sizeof(fs))) { if (verbose) { printf("%s: %s\n", *argv, fs); } else { puts(fs); } } else { fprintf(stderr, _("%s: unknown\n"), *argv); status = 1; } } exit(status); }
int main(int argc, char **argv) { char *p; char fs[1000]; int status = 0; if (argc < 2) { p = (argc < 1) ? "fstype" : argv[0]; printf("usage:\t%s path ...\n" "\t%s prints the file system type and pathname of the paths.\n", p, p); return EXIT_FAILURE; } while (*++argv) { if (!fstype(*argv, fs, sizeof(fs))) { status = EXIT_FAILURE; } else { printf("%s\t%s\n", fs, *argv); } } return status; }
int main(int argc, char *argv[]) { char *type; if (argc != 2) { fprintf(stderr, "Usage: %s <device>\n", basename(argv[0])); exit(1); } if (access(argv[1], R_OK) < 0) { perror(argv[1]); exit(1); } if ((type = fstype(argv[1])) == NULL) { printf("Unknown\n"); exit(1); } printf("%s\n", type); exit(0); }
static int _mount ( const char *source, // Source device const char *target, // Destination directory (will be made if necessary) const char *type, // Filesystem type (NULL to guess) unsigned long flags, // Mount flags const void *data, // Special data (depens on filesystem) int fatal ) { int r = _mkdir(target, 0755, fatal); if (r < 0) return r; if (type == NULL && !(flags & MS_MOVE)) { // Don't find out if moving type = fstype(source); if (type == NULL) { if (fatal) _fatal("cannot not guess %s filesystem type", source); return -1; } } r = mount(source, target, type, flags, data); if (r < 0 && fatal) _fatal("mounting %s on %s failed", source, target); return r; }
static long __pathconf_common(struct statvfs *fs, struct stat *st, int name) { fs_info info; int ret; ret = fs_stat_dev(fs->f_fsid, &info); if (ret < 0) { errno = ret; return -1; } // TODO: many cases should check for file type from st. switch (name) { case _PC_CHOWN_RESTRICTED: return _POSIX_CHOWN_RESTRICTED; case _PC_MAX_CANON: return MAX_CANON; case _PC_MAX_INPUT: return MAX_INPUT; case _PC_NAME_MAX: return fs->f_namemax; //return NAME_MAX; case _PC_NO_TRUNC: return _POSIX_NO_TRUNC; case _PC_PATH_MAX: return PATH_MAX; case _PC_PIPE_BUF: return 4096; case _PC_LINK_MAX: return LINK_MAX; case _PC_VDISABLE: return _POSIX_VDISABLE; case _PC_FILESIZEBITS: { int type = fstype(info.fsh_name); switch (type) { case FS_BFS: case FS_EXT: return 64; case FS_FAT: return 32; } // XXX: add fs ? add to statvfs/fs_info ? return FILESIZEBITS; } case _PC_SYMLINK_MAX: return SYMLINK_MAX; case _PC_2_SYMLINKS: { int type = fstype(info.fsh_name); switch (type) { case FS_BFS: case FS_EXT: return 1; case FS_FAT: return 0; } // XXX: there should be an HAS_SYMLINKS flag // to fs_info... return 1; } case _PC_XATTR_EXISTS: case _PC_XATTR_ENABLED: { #if 0 /* those seem to be Solaris specific, * else we should return 1 I suppose. * we don't yet map POSIX xattrs * to BFS ones anyway. */ if (info.flags & B_FS_HAS_ATTR) return 1; return -1; #endif errno = EINVAL; return -1; } case _PC_SYNC_IO: case _PC_ASYNC_IO: case _PC_PRIO_IO: case _PC_SOCK_MAXBUF: case _PC_REC_INCR_XFER_SIZE: case _PC_REC_MAX_XFER_SIZE: case _PC_REC_MIN_XFER_SIZE: case _PC_REC_XFER_ALIGN: case _PC_ALLOC_SIZE_MIN: /* not yet supported */ errno = EINVAL; return -1; } errno = EINVAL; return -1; }