2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * Linux support routines.
14 #include <afsconfig.h>
15 #include "afs/param.h"
18 #include <linux/module.h> /* early to avoid printf->printk mapping */
19 #include <linux/dcache.h>
20 #include <linux/namei.h>
21 #include <linux/kthread.h>
22 #include "afs/sysincludes.h"
23 #include "afsincludes.h"
24 #include "afs/afs_stats.h"
26 #include "osi_compat.h"
28 int afs_osicred_initialized = 0;
29 afs_ucred_t afs_osi_cred;
32 afs_osi_SetTime(osi_timeval_t * tvp)
35 tv.tv_sec = tvp->tv_sec;
36 tv.tv_nsec = tvp->tv_usec * NSEC_PER_USEC;
38 AFS_STATCNT(osi_SetTime);
47 sigfillset(¤t->blocked);
48 RECALC_SIGPENDING(current);
52 /* LOOKUP_POSITIVE is becoming the default */
53 #ifndef LOOKUP_POSITIVE
54 #define LOOKUP_POSITIVE 0
56 /* Lookup name and return vnode for same. */
58 osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt,
64 int flags = LOOKUP_POSITIVE;
68 flags |= LOOKUP_FOLLOW;
69 code = afs_kern_path(aname, flags, &nd, &path);
72 afs_get_dentry_ref(&nd, &path, mnt, dpp);
78 osi_lookupname(char *aname, uio_seg_t seg, int followlink,
84 if (seg == AFS_UIOUSER) {
85 tname = getname(aname);
87 return PTR_ERR(tname);
91 code = osi_lookupname_internal(tname, followlink, NULL, dpp);
92 if (seg == AFS_UIOUSER) {
98 int osi_abspath(char *aname, char *buf, int buflen,
99 int followlink, char **pathp)
101 struct dentry *dp = NULL;
102 struct vfsmount *mnt = NULL;
107 tname = getname(aname);
109 return -PTR_ERR(tname);
110 code = osi_lookupname_internal(tname, followlink, &mnt, &dp);
112 #if defined(D_PATH_TAKES_STRUCT_PATH)
113 struct path p = { mnt, dp };
114 path = d_path(&p, buf, buflen);
116 path = d_path(dp, mnt, buf, buflen);
120 code = -PTR_ERR(path);
134 /* This could use some work, and support on more platforms. */
135 int afs_thread_wrapper(void *rock)
137 void (*proc)(void) = rock;
138 __module_get(THIS_MODULE);
142 module_put(THIS_MODULE);
146 void afs_start_thread(void (*proc)(void), char *name)
148 kthread_run(afs_thread_wrapper, proc, "%s", name);