type
stringclasses
5 values
content
stringlengths
9
163k
functions
long hash_name(const char *name, unsigned int *hashp) { unsigned long hash = init_name_hash(); unsigned long len = 0, c; c = (unsigned char)*name; do { len++; hash = partial_name_hash(c, hash); c = (unsigned char)name[len]; }
functions
int link_path_walk(const char *name, struct nameidata *nd) { struct path next; int err; while (*name=='/') name++; if (!*name) return 0; /* At this point we know we have a real path component. */ for(;;) { struct qstr this; long len; int type; err = may_lookup(nd); if (err) break; len = h...
functions
int path_init(int dfd, const char *name, unsigned int flags, struct nameidata *nd, struct file **fp) { int retval = 0; nd->last_type = LAST_ROOT; /* if there are only slashes... */ nd->flags = flags | LOOKUP_JUMPED; nd->depth = 0; if (flags & LOOKUP_ROOT) { struct dentry *root = nd->root.dentry; struct...
functions
else if (dfd == AT_FDCWD) { if (flags & LOOKUP_RCU) { struct fs_struct *fs = current->fs; unsigned seq; rcu_read_lock(); do { seq = read_seqcount_begin(&fs->seq); nd->path = fs->pwd; nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); }
functions
int lookup_last(struct nameidata *nd, struct path *path) { if (nd->last_type == LAST_NORM && nd->last.name[nd->last.len]) nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; nd->flags &= ~LOOKUP_PARENT; return walk_component(nd, path, nd->flags & LOOKUP_FOLLOW); }
functions
int path_lookupat(int dfd, const char *name, unsigned int flags, struct nameidata *nd) { struct file *base = NULL; struct path path; int err; /* * Path walking is largely split up into 2 different synchronisation * schemes, rcu-walk and ref-walk (explained in * Documentation/filesystems/path-lookup.txt)....
functions
int filename_lookup(int dfd, struct filename *name, unsigned int flags, struct nameidata *nd) { int retval = path_lookupat(dfd, name->name, flags | LOOKUP_RCU, nd); if (unlikely(retval == -ECHILD)) retval = path_lookupat(dfd, name->name, flags, nd); if (unlikely(retval == -ESTALE)) retval = path_lookupat(dfd...
functions
int do_path_lookup(int dfd, const char *name, unsigned int flags, struct nameidata *nd) { struct filename filename = { .name = name }
functions
int kern_path(const char *name, unsigned int flags, struct path *path) { struct nameidata nd; int res = do_path_lookup(AT_FDCWD, name, flags, &nd); if (!res) *path = nd.path; return res; }
functions
int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, const char *name, unsigned int flags, struct path *path) { struct nameidata nd; int err; nd.root.dentry = dentry; nd.root.mnt = mnt; BUG_ON(flags & LOOKUP_PARENT); /* the first argument of do_path_lookup() is ignored with LOOKUP_ROOT */ ...
functions
int user_path_at_empty(int dfd, const char __user *name, unsigned flags, struct path *path, int *empty) { struct nameidata nd; struct filename *tmp = getname_flags(name, flags, empty); int err = PTR_ERR(tmp); if (!IS_ERR(tmp)) { BUG_ON(flags & LOOKUP_PARENT); err = filename_lookup(dfd, tmp, flags, &nd); ...
functions
int user_path_at(int dfd, const char __user *name, unsigned flags, struct path *path) { return user_path_at_empty(dfd, name, flags, path, NULL); }
functions
int mountpoint_last(struct nameidata *nd, struct path *path) { int error = 0; struct dentry *dentry; struct dentry *dir = nd->path.dentry; /* If we're in rcuwalk, drop out of it to handle last component */ if (nd->flags & LOOKUP_RCU) { if (unlazy_walk(nd, NULL)) { error = -ECHILD; goto out; }
functions
int path_mountpoint(int dfd, const char *name, struct path *path, unsigned int flags) { struct file *base = NULL; struct nameidata nd; int err; err = path_init(dfd, name, flags | LOOKUP_PARENT, &nd, &base); if (unlikely(err)) return err; current->total_link_count = 0; err = link_path_walk(name, &nd); if (er...
functions
int filename_mountpoint(int dfd, struct filename *s, struct path *path, unsigned int flags) { int error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU); if (unlikely(error == -ECHILD)) error = path_mountpoint(dfd, s->name, path, flags); if (unlikely(error == -ESTALE)) error = path_mountpoint(dfd, s-...
functions
int user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags, struct path *path) { struct filename *s = getname(name); int error; if (IS_ERR(s)) return PTR_ERR(s); error = filename_mountpoint(dfd, s, path, flags); putname(s); return error; }
functions
int kern_path_mountpoint(int dfd, const char *name, struct path *path, unsigned int flags) { struct filename s = {.name = name}
functions
int check_sticky(struct inode *dir, struct inode *inode) { kuid_t fsuid = current_fsuid(); if (!(dir->i_mode & S_ISVTX)) return 0; if (uid_eq(inode->i_uid, fsuid)) return 0; if (uid_eq(dir->i_uid, fsuid)) return 0; return !capable_wrt_inode_uidgid(inode, CAP_FOWNER); }
functions
int may_delete(struct inode *dir, struct dentry *victim, bool isdir) { struct inode *inode = victim->d_inode; int error; if (d_is_negative(victim)) return -ENOENT; BUG_ON(!inode); BUG_ON(victim->d_parent->d_inode != dir); audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); error = inode_permission(dir,...
functions
int may_create(struct inode *dir, struct dentry *child) { audit_inode_child(dir, child, AUDIT_TYPE_CHILD_CREATE); if (child->d_inode) return -EEXIST; if (IS_DEADDIR(dir)) return -ENOENT; return inode_permission(dir, MAY_WRITE | MAY_EXEC); }
functions
void unlock_rename(struct dentry *p1, struct dentry *p2) { mutex_unlock(&p1->d_inode->i_mutex); if (p1 != p2) { mutex_unlock(&p2->d_inode->i_mutex); mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex); }
functions
int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool want_excl) { int error = may_create(dir, dentry); if (error) return error; if (!dir->i_op->create) return -EACCES; /* shouldn't it be ENOSYS? */ mode &= S_IALLUGO; mode |= S_IFREG; error = security_inode_create(dir, dentry, mode); ...
functions
int may_open(struct path *path, int acc_mode, int flag) { struct dentry *dentry = path->dentry; struct inode *inode = dentry->d_inode; int error; /* O_PATH? */ if (!acc_mode) return 0; if (!inode) return -ENOENT; switch (inode->i_mode & S_IFMT) { case S_IFLNK: return -ELOOP; case S_IFDIR: if (acc_mo...
functions
int handle_truncate(struct file *filp) { struct path *path = &filp->f_path; struct inode *inode = path->dentry->d_inode; int error = get_write_access(inode); if (error) return error; /* * Refuse to truncate files with mandatory locks held on them. */ error = locks_verify_locked(inode); if (!error) error ...
functions
int open_to_namei_flags(int flag) { if ((flag & O_ACCMODE) == 3) flag--; return flag; }
functions
int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode) { int error = security_path_mknod(dir, dentry, mode, 0); if (error) return error; error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); if (error) return error; return security_inode_create(dir->dentry->d_inode, dentry, m...
functions
int atomic_open(struct nameidata *nd, struct dentry *dentry, struct path *path, struct file *file, const struct open_flags *op, bool got_write, bool need_lookup, int *opened) { struct inode *dir = nd->path.dentry->d_inode; unsigned open_flag = open_to_namei_flags(op->open_flag); umode_t mode; int error...
functions
else if (!dentry->d_inode) { goto out; }
functions
int lookup_open(struct nameidata *nd, struct path *path, struct file *file, const struct open_flags *op, bool got_write, int *opened) { struct dentry *dir = nd->path.dentry; struct inode *dir_inode = dir->d_inode; struct dentry *dentry; int error; bool need_lookup; *opened &= ~FILE_CREATED; dentry = lo...
functions
int do_last(struct nameidata *nd, struct path *path, struct file *file, const struct open_flags *op, int *opened, struct filename *name) { struct dentry *dir = nd->path.dentry; int open_flag = op->open_flag; bool will_truncate = (open_flag & O_TRUNC) != 0; bool got_write = false; int acc_mode = op->acc_m...
functions
int do_tmpfile(int dfd, struct filename *pathname, struct nameidata *nd, int flags, const struct open_flags *op, struct file *file, int *opened) { static const struct qstr name = QSTR_INIT("/", 1); struct dentry *dentry, *child; struct inode *dir; int error = path_lookupat(dfd, pathname->name, flags | L...
functions
void done_path_create(struct path *path, struct dentry *dentry) { dput(dentry); mutex_unlock(&path->dentry->d_inode->i_mutex); mnt_drop_write(path->mnt); path_put(path); }
functions
int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) { int error = may_create(dir, dentry); if (error) return error; if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) return -EPERM; if (!dir->i_op->mknod) return -EPERM; error = devcgroup_inode_mknod(mode, dev); if ...
functions
int may_mknod(umode_t mode) { switch (mode & S_IFMT) { case S_IFREG: case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: case 0: /* zero mode translates to S_IFREG */ return 0; case S_IFDIR: return -EPERM; default: return -EINVAL; }
functions
int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) { int error = may_create(dir, dentry); unsigned max_links = dir->i_sb->s_max_links; if (error) return error; if (!dir->i_op->mkdir) return -EPERM; mode &= (S_IRWXUGO|S_ISVTX); error = security_inode_mkdir(dir, dentry, mode); if (error) ...
functions
void dentry_unhash(struct dentry *dentry) { shrink_dcache_parent(dentry); spin_lock(&dentry->d_lock); if (dentry->d_lockref.count == 1) __d_drop(dentry); spin_unlock(&dentry->d_lock); }
functions
int vfs_rmdir(struct inode *dir, struct dentry *dentry) { int error = may_delete(dir, dentry, 1); if (error) return error; if (!dir->i_op->rmdir) return -EPERM; dget(dentry); mutex_lock(&dentry->d_inode->i_mutex); error = -EBUSY; if (d_mountpoint(dentry)) goto out; error = security_inode_rmdir(dir, d...
functions
long do_rmdir(int dfd, const char __user *pathname) { int error = 0; struct filename *name; struct dentry *dentry; struct nameidata nd; unsigned int lookup_flags = 0; retry: name = user_path_parent(dfd, pathname, &nd, lookup_flags); if (IS_ERR(name)) return PTR_ERR(name); switch(nd.last_type) { case LAST_DO...
functions
int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode) { struct inode *target = dentry->d_inode; int error = may_delete(dir, dentry, 0); if (error) return error; if (!dir->i_op->unlink) return -EPERM; mutex_lock(&target->i_mutex); if (d_mountpoint(dentry)) error = -EBUSY...
functions
long do_unlinkat(int dfd, const char __user *pathname) { int error; struct filename *name; struct dentry *dentry; struct nameidata nd; struct inode *inode = NULL; struct inode *delegated_inode = NULL; unsigned int lookup_flags = 0; retry: name = user_path_parent(dfd, pathname, &nd, lookup_flags); if (IS_ERR(na...
functions
int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) { int error = may_create(dir, dentry); if (error) return error; if (!dir->i_op->symlink) return -EPERM; error = security_inode_symlink(dir, dentry, oldname); if (error) return error; error = dir->i_op->symlink(dir, dentry, ol...
functions
int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode) { struct inode *inode = old_dentry->d_inode; unsigned max_links = dir->i_sb->s_max_links; int error; if (!inode) return -ENOENT; error = may_create(dir, new_dentry); if (error) return error;...
functions
int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { int error = 0; struct inode *target = new_dentry->d_inode; unsigned max_links = new_dir->i_sb->s_max_links; /* * If we are going to change the parent - check write permissions, * we'll ...
functions
int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, struct inode **delegated_inode) { struct inode *target = new_dentry->d_inode; struct inode *source = old_dentry->d_inode; int error; error = security_inode_rename(old_dir, old_dent...
functions
int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, struct inode **delegated_inode) { int error; int is_dir = d_is_directory(old_dentry) || d_is_autodir(old_dentry); const unsigned char *old_name; if (old_dentry->d_inode == new_dentry->...
functions
int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link) { int len; len = PTR_ERR(link); if (IS_ERR(link)) goto out; len = strlen(link); if (len > (unsigned) buflen) len = buflen; if (copy_to_user(buffer, link, len)) len = -EFAULT; out: return len; }
functions
int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) { struct nameidata nd; void *cookie; int res; nd.depth = 0; cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); if (IS_ERR(cookie)) return PTR_ERR(cookie); res = vfs_readlink(dentry, buffer, buflen, nd_get_link(&nd)); if (den...
functions
int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) { struct page *page = NULL; char *s = page_getlink(dentry, &page); int res = vfs_readlink(dentry,buffer,buflen,s); if (page) { kunmap(page); page_cache_release(page); }
functions
void page_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) { struct page *page = cookie; if (page) { kunmap(page); page_cache_release(page); }
functions
int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) { struct address_space *mapping = inode->i_mapping; struct page *page; void *fsdata; int err; char *kaddr; unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE; if (nofs) flags |= AOP_FLAG_NOFS; retry: err = pagecache_write_begin(NULL, ...
functions
int page_symlink(struct inode *inode, const char *symname, int len) { return __page_symlink(inode, symname, len, !(mapping_gfp_mask(inode->i_mapping) & __GFP_FS)); }
includes
#include <xorg-config.h>
includes
#include <X11/X.h>
defines
#define PSZ 8
functions
void cfb8_32PaintWindow( WindowPtr pWin, RegionPtr pRegion, int what ){ WindowPtr pBgWin; int xorg, yorg; switch (what) { case PW_BACKGROUND: switch (pWin->backgroundState) { case None: break; case ParentRelative: do { pWin = pWin->parent; }
functions
PANORAMIX if(!noPanoramiXExtension) { int index = pWin->drawable.pScreen->myNum; if(WindowTable[index] == pWin) { xorg -= panoramiXdataPtr[index].x; yorg -= panoramiXdataPtr[index].y; }
functions
PANORAMIX if(!noPanoramiXExtension) { int index = pWin->drawable.pScreen->myNum; if(WindowTable[index] == pBgWin) { xorg -= panoramiXdataPtr[index].x; yorg -= panoramiXdataPtr[index].y; }
functions
void cfb8_32FillBoxSolid8( DrawablePtr pDraw, int nbox, BoxPtr pbox, unsigned long color ){ CARD8 *ptr, *data; int pitch, height, width, i; CARD8 c = (CARD8)color; cfbGetByteWidthAndPointer(pDraw, pitch, ptr); ptr += 3; /* point to the top byte */ while(nbox--) { data = ptr + (pbo...
functions
void cfb8_32FillBoxSolid32( DrawablePtr pDraw, int nbox, BoxPtr pbox, unsigned long color ){ CARD8 *ptr, *data; CARD16 *ptr2, *data2; int pitch, pitch2; int height, width, i; CARD8 c = (CARD8)(color >> 16); CARD16 c2 = (CARD16)color; cfbGetByteWidthAndPointer(pDraw, pitch, ptr);...
includes
#include <sys/types.h>
includes
#include <sys/wait.h>
includes
#include <stdlib.h>
includes
#include <stdio.h>
includes
#include <X11/IntrinsicP.h>
includes
#include <X11/StringDefs.h>
includes
#include <X11/Xatom.h>
includes
#include <X11/Xproto.h>
includes
#include <X11/Xos.h>
includes
#include <Mowitz/Mowitz.h>
includes
#include <ctype.h>
includes
#include <signal.h>
includes
#include <fcntl.h>
includes
#include <errno.h>
includes
#include <descrip.h>
includes
#include <ssdef.h>
includes
#include <clidef.h>
includes
#include <lnmdef.h>
includes
#include <iodef.h>
includes
#include <dvidef.h>
defines
#define SIGVAL int
defines
#define SIGVAL void
defines
#define O_NONBLOCK O_NDELAY
defines
#define EWOULDBLOCK EAGAIN
defines
#define EAGAIN EWOULDBLOCK
defines
#define GV_BUFSIZ 512
defines
#define GV_BUFSIZ 1024
defines
#define offset(field) XtOffsetOf(GhostviewRec, ghostview.field)
defines
#define SEEK_SET 0
defines
#define NUM_ARGS 100
defines
#define vfork fork
defines
#define done(type, value) \
defines
#define ERR_SIGNAL(s) if(!((s) & 1))lib$signal((s), 0, 0)
defines
#define XtEFN 23
structs
struct g_l_i { GhostviewWidget w; struct g_l_i *next; };
functions
endif if (gvw->ghostview.buffer_bytes_left == 0) { /* Get a new section if required */ if (gvw->ghostview.ps_input && gvw->ghostview.bytes_left == 0) { struct record_list *ps_old = gvw->ghostview.ps_input; gvw->ghostview.ps_input = ps_old->next; if (ps_old->close) fclose(ps_old->fp); MwFree((char *...
functions
else if (gvw->ghostview.bytes_left > 0) { gvw->ghostview.buffer_bytes_left = fread(gvw->ghostview.input_buffer, sizeof (char), gvw->ghostview.bytes_left, gvw->ghostview.ps_input->fp); }
functions
else if (bytes_written == -1) { if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) { InterpreterFailed(w); /* Something bad happened */ }
functions
else if (bytes == -1) { InterpreterFailed(w); /* Something bad happened */ return; }
functions
else if (*source == gvw->ghostview.interpreter_error) { bytes = read(gvw->ghostview.interpreter_error, buf, GV_BUFSIZ); if (bytes == 0) { /* EOF occurred */ close(gvw->ghostview.interpreter_error); gvw->ghostview.interpreter_error = -1; XtRemoveInput(gvw->ghostview.interpreter_error_id); return; ...
functions
else if (bytes == -1) { InterpreterFailed(w); /* Something bad happened */ return; }