struct file_system_type *get_fs_type(const char *name) { struct file_system_type *fs; const char *dot = strchr(name, '.'); unsigned len = dot ? dot - name : strlen(name); read_lock(&file_systems_lock); fs = *(find_filesystem(name, len)); if (fs && !try_module_get(fs->owner)) fs = NULL; read_unlock(&file_systems_lock); if (!fs && (request_module("%.*s", len, name) == 0)) { read_lock(&file_systems_lock); fs = *(find_filesystem(name, len)); if (fs && !try_module_get(fs->owner)) fs = NULL; read_unlock(&file_systems_lock); } if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) { put_filesystem(fs); fs = NULL; } return fs; }
/* * shoggoth mounting_point filesystem_name [fuse_options] */ int main(int argc, char *argv[]) { struct sockaddr_in addr; struct fuse_args args = FUSE_ARGS_INIT(0, NULL); int i; char fs_name[256]; memset(fs_name, 0, 256); for(i = 0; i < argc; i++) { if (i == 1) strncpy(fs_name, argv[i], 256); else fuse_opt_add_arg(&args, argv[i]); } if (!fs_name[0]) return 1; srand(time(NULL)); if (find_filesystem(fs_name, &addr) < 0) return 1; if (!connect_server(addr)) return 1; return fuse_main(args.argc, args.argv, &operations, NULL); }
static struct volume *ubi_volume_find(char *name) { struct volume *ret = NULL; DIR *ubi_dir; struct dirent *ubi_dirent; unsigned int ubi_num; if (find_filesystem("ubifs")) return ret; ubi_dir = opendir(ubi_dir_name); /* check for os ubi support */ if (!ubi_dir) return ret; /* probe ubi devices and volumes */ while ((ubi_dirent = readdir(ubi_dir)) != NULL) { if (ubi_dirent->d_name[0] == '.') continue; sscanf(ubi_dirent->d_name, "ubi%u", &ubi_num); ret = ubi_part_match(name, ubi_num); if (ret) break; } closedir(ubi_dir); return ret; }
struct file_system_type *get_fs_type(const char *name) { struct file_system_type *fs; read_lock(&file_systems_lock); fs = *(find_filesystem(name)); if (fs && !try_module_get(fs->owner)) fs = NULL; read_unlock(&file_systems_lock); if (!fs && (request_module("%s", name) == 0)) { read_lock(&file_systems_lock); fs = *(find_filesystem(name)); if (fs && !try_module_get(fs->owner)) fs = NULL; read_unlock(&file_systems_lock); } return fs; }
static struct file_system_type *__get_fs_type(const char *name, int len) { struct file_system_type *fs; read_lock(&file_systems_lock); fs = *(find_filesystem(name, len)); if (fs && !try_module_get(fs->owner)) fs = NULL; read_unlock(&file_systems_lock); return fs; }
int register_filesystem(struct file_system_type * fs) { int res = 0; struct file_system_type ** p; BUG_ON(strchr(fs->name, '.')); if (fs->next) return -EBUSY; write_lock(&file_systems_lock); p = find_filesystem(fs->name, strlen(fs->name)); if (*p) res = -EBUSY; else *p = fs; write_unlock(&file_systems_lock); return res; }
int register_filesystem(struct file_system_type * fs) { int res = 0; struct file_system_type ** p; if (fs->next) return -EBUSY; INIT_LIST_HEAD(&fs->fs_supers); write_lock(&file_systems_lock); p = find_filesystem(fs->name); if (*p) res = -EBUSY; else *p = fs; write_unlock(&file_systems_lock); return res; }
int main(int argc, char **argv) { struct volume *v; int ch, yes = 0, reset = 0; while ((ch = getopt(argc, argv, "yr")) != -1) { switch(ch) { case 'y': yes = 1; break; case 'r': reset = 1; break; } } if (!yes && ask_user()) return -1; /* * TODO: Currently this only checks if kernel supports OverlayFS. We * should check if there is a mount point using it with rootfs_data * as upperdir. */ if (find_filesystem("overlay")) { ULOG_ERR("overlayfs not supported by kernel\n"); return -1; } v = volume_find("rootfs_data"); if (!v) { ULOG_ERR("MTD partition 'rootfs_data' not found\n"); return -1; } volume_init(v); if (!strcmp(*argv, "jffs2mark")) return jffs2_mark(v); return jffs2_reset(v, reset); }
int register_filesystem(struct file_system_type *fs){ INIT_LIST_HEAD(&fs->fs_supers); struct file_system_type **p = find_filesystem(fs->name); if(!*p) *p = fs; return 0; }