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 "afs/sysincludes.h"
20 #include "afsincludes.h"
21 #include "afs/afs_stats.h"
22 #if defined(AFS_LINUX24_ENV)
23 #include "h/smp_lock.h"
26 int afs_osicred_initialized = 0;
27 AFS_UCRED afs_osi_cred;
30 afs_osi_SetTime(osi_timeval_t * tvp)
32 #if defined(AFS_LINUX24_ENV)
34 tv.tv_sec = tvp->tv_sec;
35 tv.tv_usec = tvp->tv_usec;
37 AFS_STATCNT(osi_SetTime);
41 extern int (*sys_settimeofdayp) (struct timeval * tv,
42 struct timezone * tz);
46 AFS_STATCNT(osi_SetTime);
49 if (sys_settimeofdayp)
50 (void)(*sys_settimeofdayp) (tvp, NULL);
59 sigfillset(¤t->blocked);
60 RECALC_SIGPENDING(current);
64 #if defined(AFS_LINUX24_ENV)
65 /* LOOKUP_POSITIVE is becoming the default */
66 #ifndef LOOKUP_POSITIVE
67 #define LOOKUP_POSITIVE 0
69 /* Lookup name and return vnode for same. */
71 osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt,
76 int flags = LOOKUP_POSITIVE;
80 flags |= LOOKUP_FOLLOW;
81 if (path_init(aname, flags, &nd))
82 code = path_walk(aname, &nd);
85 #if defined(STRUCT_NAMEIDATA_HAS_PATH)
86 *dpp = dget(nd.path.dentry);
88 *mnt = mntget(nd.path.mnt);
91 *dpp = dget(nd.dentry);
93 *mnt = mntget(nd.mnt);
101 osi_lookupname(char *aname, uio_seg_t seg, int followlink,
107 if (seg == AFS_UIOUSER) {
108 tname = getname(aname);
110 return PTR_ERR(tname);
114 code = osi_lookupname_internal(tname, followlink, NULL, dpp);
115 if (seg == AFS_UIOUSER) {
122 osi_lookupname(char *aname, uio_seg_t seg, int followlink, struct dentry **dpp)
124 struct dentry *dp = NULL;
128 if (seg == AFS_UIOUSER) {
129 dp = followlink ? namei(aname) : lnamei(aname);
131 dp = lookup_dentry(aname, NULL, followlink ? 1 : 0);
134 if (dp && !IS_ERR(dp)) {