本文整理汇总了C++中path_get函数的典型用法代码示例。如果您正苦于以下问题:C++ path_get函数的具体用法?C++ path_get怎么用?C++ path_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
/*
* Get the current working directory for the current process.
* Returns the pointer to the string, which is NOT going to be at the beginning
* of buf.
* Buf must be at least 1 page in size.
*/
char *npm_getcwd(char *buf, unsigned long bufsize)
{
struct path pwd;
char *res;
ASSERT(bufsize >= PAGE_SIZE - 1);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) || defined CONFIG_VE
get_fs_pwd(current->fs, &pwd);
#else
read_lock(¤t->fs->lock);
pwd = current->fs->pwd;
path_get(&pwd);
read_unlock(¤t->fs->lock);
#endif
res = d_path(&pwd, buf, bufsize);
if (IS_ERR(res))
res = NULL;
path_put(&pwd);
return res;
}
示例2: find_autofs_mount
/* Find the topmost mount satisfying test() */
static int find_autofs_mount(const char *pathname,
struct path *res,
int test(const struct path *path, void *data),
void *data)
{
struct path path;
int err;
err = kern_path_mountpoint(AT_FDCWD, pathname, &path, 0);
if (err)
return err;
err = -ENOENT;
while (path.dentry == path.mnt->mnt_root) {
if (path.dentry->d_sb->s_magic == AUTOFS_SUPER_MAGIC) {
if (test(&path, data)) {
path_get(&path);
*res = path;
err = 0;
break;
}
}
if (!follow_up(&path))
break;
}
path_put(&path);
return err;
}
示例3: find_autofs_mount
static int find_autofs_mount(const char *pathname,
struct path *res,
int test(struct path *path, void *data),
void *data)
{
struct path path;
int err = kern_path(pathname, 0, &path);
if (err)
return err;
err = -ENOENT;
while (path.dentry == path.mnt->mnt_root) {
if (path.mnt->mnt_sb->s_magic == AUTOFS_SUPER_MAGIC) {
if (test(&path, data)) {
path_get(&path);
if (!err) /* already found some */
path_put(res);
*res = path;
err = 0;
}
}
if (!follow_up(&path))
break;
}
path_put(&path);
return err;
}
示例4: vfsub_lookup_one_len
struct dentry *au_lkup_one(struct qstr *name, struct dentry *h_parent,
struct au_branch *br, struct nameidata *nd)
{
struct dentry *h_dentry;
int err;
struct nameidata h_nd;
if (au_test_fs_null_nd(h_parent->d_sb))
return vfsub_lookup_one_len(name->name, h_parent, name->len);
au_h_nd(&h_nd, nd);
h_nd.path.dentry = h_parent;
h_nd.path.mnt = br->br_mnt;
err = __lookup_one_len(name->name, &h_nd.last, NULL, name->len);
h_dentry = ERR_PTR(err);
if (!err) {
path_get(&h_nd.path);
h_dentry = vfsub_lookup_hash(&h_nd);
path_put(&h_nd.path);
}
AuTraceErrPtr(h_dentry);
return h_dentry;
}
示例5: big_key_preparse
/*
* Preparse a big key
*/
int big_key_preparse(struct key_preparsed_payload *prep)
{
struct path *path = (struct path *)&prep->payload.data[big_key_path];
struct file *file;
ssize_t written;
size_t datalen = prep->datalen;
int ret;
ret = -EINVAL;
if (datalen <= 0 || datalen > 1024 * 1024 || !prep->data)
goto error;
/* Set an arbitrary quota */
prep->quotalen = 16;
prep->payload.data[big_key_len] = (void *)(unsigned long)datalen;
if (datalen > BIG_KEY_FILE_THRESHOLD) {
/* Create a shmem file to store the data in. This will permit the data
* to be swapped out if needed.
*
* TODO: Encrypt the stored data with a temporary key.
*/
file = shmem_kernel_file_setup("", datalen, 0);
if (IS_ERR(file)) {
ret = PTR_ERR(file);
goto error;
}
written = kernel_write(file, prep->data, prep->datalen, 0);
if (written != datalen) {
ret = written;
if (written >= 0)
ret = -ENOMEM;
goto err_fput;
}
/* Pin the mount and dentry to the key so that we can open it again
* later
*/
*path = file->f_path;
path_get(path);
fput(file);
} else {
/* Just store the data in a buffer */
void *data = kmalloc(datalen, GFP_KERNEL);
if (!data)
return -ENOMEM;
prep->payload.data[big_key_data] = data;
memcpy(data, prep->data, prep->datalen);
}
return 0;
err_fput:
fput(file);
error:
return ret;
}
示例6: path_get
bool HashSet::store( ) const
{
OutputFile out;
for ( const auto &id : _set )
id.store( out );
return out.rename( path_get( PathType::OBJ, "index" ).string( ) );
}
示例7: probe_subsys_event
/*
* Here the caller only guarantees locking for struct file and struct inode.
* Locking must therefore be done in the probe to use the dentry.
*/
static void probe_subsys_event(struct inode *inode, struct file *file)
{
path_get(&file->f_path);
dget(file->f_path.dentry);
printk(KERN_INFO "Event is encountered with filename %s\n",
file->f_path.dentry->d_name.name);
dput(file->f_path.dentry);
path_put(&file->f_path);
}
示例8: menu_action_setting_disp_set_label_core_option_create
static void menu_action_setting_disp_set_label_core_option_create(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
*s = '\0';
*w = 19;
strlcpy(s, "", len);
if (!string_is_empty(path_get(RARCH_PATH_BASENAME)))
strlcpy(s, path_basename(path_get(RARCH_PATH_BASENAME)), len);
strlcpy(s2, path, len2);
}
示例9: frontend_xdk_exec
static void frontend_xdk_exec(const char *path, bool should_load_game)
{
#ifndef IS_SALAMANDER
bool original_verbose = verbosity_is_enabled();
#endif
#if defined(_XBOX1)
LAUNCH_DATA ptr;
#elif defined(_XBOX360)
char game_path[1024] = {0};
#endif
(void)should_load_game;
#ifdef IS_SALAMANDER
if (!string_is_empty(path))
XLaunchNewImage(path, NULL);
#else
#if defined(_XBOX1)
memset(&ptr, 0, sizeof(ptr));
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
snprintf((char*)ptr.Data, sizeof(ptr.Data), "%s", path_get(RARCH_PATH_CONTENT));
if (!string_is_empty(path))
XLaunchNewImage(path, !string_is_empty((const char*)ptr.Data) ? &ptr : NULL);
#elif defined(_XBOX360)
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
{
strlcpy(game_path, path_get(RARCH_PATH_CONTENT), sizeof(game_path));
XSetLaunchData(game_path, MAX_LAUNCH_DATA_SIZE);
}
if (!string_is_empty(path))
XLaunchNewImage(path, 0);
#endif
#endif
#ifndef IS_SALAMANDER
if (original_verbose)
verbosity_enable();
else
verbosity_disable();
#endif
}
示例10: load_dynamic_core
static void load_dynamic_core(void)
{
function_t sym = dylib_proc(NULL, "retro_init");
if (sym)
{
/* Try to verify that -lretro was not linked in from other modules
* since loading it dynamically and with -l will fail hard. */
RARCH_ERR("Serious problem. RetroArch wants to load libretro cores"
"dyamically, but it is already linked.\n");
RARCH_ERR("This could happen if other modules RetroArch depends on "
"link against libretro directly.\n");
RARCH_ERR("Proceeding could cause a crash. Aborting ...\n");
retroarch_fail(1, "init_libretro_sym()");
}
if (string_is_empty(path_get(RARCH_PATH_CORE)))
{
RARCH_ERR("RetroArch is built for dynamic libretro cores, but "
"libretro_path is not set. Cannot continue.\n");
retroarch_fail(1, "init_libretro_sym()");
}
/* Need to use absolute path for this setting. It can be
* saved to content history, and a relative path would
* break in that scenario. */
path_resolve_realpath(
path_get_ptr(RARCH_PATH_CORE),
path_get_realsize(RARCH_PATH_CORE));
RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n",
path_get(RARCH_PATH_CORE));
lib_handle = dylib_load(path_get(RARCH_PATH_CORE));
if (!lib_handle)
{
RARCH_ERR("Failed to open libretro core: \"%s\"\n",
path_get(RARCH_PATH_CORE));
RARCH_ERR("Error(s): %s\n", dylib_error());
retroarch_fail(1, "load_dynamic()");
}
}
示例11: in
bool HashSet::load( )
{
InputFile in( path_get( PathType::OBJ, "index" ).string( ) );
HashId id;
while ( id.load( in ) )
_set.insert( id );
_old_size = _set.size( );
return true;
}
示例12: set_fs_pwd
// ARM10C 20160521
// current->fs: (&init_task)->fs, &root
void set_fs_pwd(struct fs_struct *fs, const struct path *path)
{
struct path old_pwd;
// path: &root
path_get(path);
// path_get에서 한일:
// [pcp0] (kmem_cache#2-oX (struct mount))->mnt_pcp->mnt_count 을 1만큼 증가 시킴
// (&(kmem_cache#5-oX (struct dentry))->d_lockref)->count: 1 만큼 증가 시킴
// &fs->lock: &((&init_task)->fs)->lock
spin_lock(&fs->lock);
// spin_lock 에서 한일:
// &((&init_task)->fs)->lock 을 사용하여 spin lock 을 수행
// &fs->seq: &((&init_task)->fs)->seq
write_seqcount_begin(&fs->seq);
// write_seqcount_begin에서 한일:
// (&((&init_task)->fs)->seq)->sequence: 1
// 공유자원을 다른 cpu core가 사용할수 있게 메모리 적용
// fs->pwd: ((&init_task)->fs)->pwd: (&init_fs)->pwd: 맴버가 0 으로 초기화된 값
old_pwd = fs->pwd;
// old_pwd: 맴버가 0 으로 초기화된 값
// root.mnt: &(kmem_cache#2-oX (struct mount))->mnt
// root.dentry: kmem_cache#5-oX (struct dentry)
// fs->pwd: ((&init_task)->fs)->pwd: (&init_fs)->pwd: 맴버가 0 으로 초기화된 값, *path: root
fs->pwd = *path;
// fs->pwd: ((&init_task)->fs)->pwd.mnt: &(kmem_cache#2-oX (struct mount))->mnt
// fs->pwd: ((&init_task)->fs)->pwd.dentry: kmem_cache#5-oX (struct dentry)
// &fs->seq: &((&init_task)->fs)->seq
write_seqcount_end(&fs->seq);
// write_seqcount_end에서 한일:
// 공유자원을 다른 cpu core가 사용할수 있게 메모리 적용
// (&((&init_task)->fs)->seq)->sequence: 2
// &fs->lock: &((&init_task)->fs)->lock
spin_unlock(&fs->lock);
// spin_unlock 에서 한일:
// &((&init_task)->fs)->lock 을 사용하여 spin unlock 을 수행
// old_pwd.dentry: NULL
if (old_pwd.dentry)
path_put(&old_pwd);
}
示例13: sh_getinterp
static_fn char *nextdir(glob_t *gp, char *dir) {
Shell_t *shp = sh_getinterp();
Pathcomp_t *pp = gp->gl_handle;
if (!dir) {
pp = path_get(shp, "");
} else {
pp = pp->next;
}
gp->gl_handle = pp;
if (pp) return pp->name;
return NULL;
}
示例14: memset
char *getfullPath(const char *pathname, char *fullpath) {
//char *fullpath = NULL;
char *path = NULL;
char *start = NULL;
//struct dentry *pwd;
//struct vfsmount *vfsmount;
struct fs_struct *fs = current->fs;
struct path pwd;
/*fullpath = kmalloc(PATH_MAX, GFP_KERNEL);
if (!fullpath) {
// kmalloc error
return fullpath;
}
memset(fullpath, 0, PATH_MAX);*/
path = kmalloc(PATH_MAX, GFP_KERNEL);
if (!path) {
return NULL;
}
// 2.4
// get dentry and vfsmnt
//read_lock(&(fs->lock));
//pwd = dget(fs->pwd);
//vfsmount = mntget(fs->pwdmnt);
//read_unlock(&(fs->lock));
// get path
//start = d_path(pwd, vfsmount, path, PATH_MAX);
//strcat(fullpath, start);
// 2.6.32
read_lock(&fs->lock);
pwd = fs->pwd;
path_get(&pwd);
read_unlock(&fs->lock);
//set_fs_pwd(fs, &pwd);
start = d_path(&pwd, path, PATH_MAX);
strcat(fullpath, start);
strcat(fullpath, "/");
strcat(fullpath, pathname);
// 2.6.35
// use spinlock
kfree(path);
return fullpath;
}
示例15: path_get
struct file *vfsub_dentry_open(struct path *path, int flags)
{
struct file *file;
path_get(path);
file = dentry_open(path->dentry, path->mnt,
flags /* | __FMODE_NONOTIFY */,
current_cred());
if (!IS_ERR_OR_NULL(file)
&& (file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
i_readcount_inc(path->dentry->d_inode);
return file;
}